Skip to content

✨ Stack-graphs-based language analyzers#281

Open
JonahSussman wants to merge 6 commits into
konveyor:masterfrom
JonahSussman:enhancements/stack-graphs-analyzers
Open

✨ Stack-graphs-based language analyzers#281
JonahSussman wants to merge 6 commits into
konveyor:masterfrom
JonahSussman:enhancements/stack-graphs-analyzers

Conversation

@JonahSussman

@JonahSussman JonahSussman commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Proposes building Konveyor's language analysis on a maintained fork of GitHub's stack-graphs library, replacing the current approach of separate Go-based providers depending on heavyweight language servers (JDTLS for Java) and broken grammars (the current C# provider uses stack-graphs but the grammar has correctness issues).

This enhancement is still in flux — putting it out there early to get feedback on the direction and open questions. The document is intentionally narrative rather than rigidly following the template, since the problem space spans multiple providers, a forked upstream library, and design questions that need community input.

Key points

  • Consolidates C# and Java grammars into a single repo with shared infrastructure
  • Extends stack graphs from name resolution into a code introspection platform
  • Identifies gaps in the stack-graphs core (serde dropping metadata, no schema standardization)
  • Raises open questions: TSG vs Lua, AST/source storage, type info strategy, FQDN mechanism, incremental resolution

Open questions that need discussion

  1. TSG vs Lua for grammar authoring
  2. AST/source storage in SQLite
  3. Graduated replacement criteria
  4. Type information: graph edges vs re-parsing
  5. FQDN computation mechanism
  6. How @jmle's Java work fits in
  7. Incrementality vs full-project queries

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added an enhancement proposal describing a plan for a Rust-based language analysis system supporting cross-file resolution, richer definition/reference queries, and a gRPC-compatible introspection API.
    • Covers architecture and control flow, discovered gaps and open design questions (schema, metadata, resolution, incrementality, external deps), a staged test plan, risks/alternatives, and an implementation checklist.

@coderabbitai

coderabbitai Bot commented Apr 17, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds a new enhancement proposal documenting a Rust-based stack-graphs analyzers architecture: per-language parsing (tree-sitter → TSG), per-file graph persistence to SQLite, full-project reverse-reference resolution, a Querier query API, a gRPC provider spec, open design questions, test plan, and risks.

Changes

Cohort / File(s) Summary
Enhancement Proposal Documentation
enhancements/stack-graphs-analyzers/README.md
New proposal document describing architecture (index → SQLite persistence → reverse index → query API → gRPC provider), Rust Querier API sketches, gaps found in upstream stack-graphs, open design questions (FQN/schema/type representation/incrementality), staged test plan, risks/alternatives, and implementation checklist.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant gRPC_Provider as "gRPC Provider"
    participant Query_API as "Query API"
    participant SQLite as "SQLite Store"
    participant ReverseIdx as "Reverse Reference Index"
    participant Indexer

    Note over Indexer, SQLite: Offline/background indexing
    Indexer->>SQLite: persist per-file stack-graphs + SourceInfo
    Indexer->>ReverseIdx: build reverse references (project-wide)

    Client->>gRPC_Provider: request(definition/reference/query)
    gRPC_Provider->>Query_API: forward request
    Query_API->>ReverseIdx: lookup reverse references (if required)
    Query_API->>SQLite: fetch graphs & node metadata
    SQLite-->>Query_API: graph & SourceInfo
    ReverseIdx-->>Query_API: reference results
    Query_API-->>gRPC_Provider: assemble response
    gRPC_Provider-->>Client: reply(results)
Loading

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐇📜 I hop through graphs and stitched-up code,
I stash each node in SQLite's abode,
I chase reverse trails across the tree,
I hum a query song — come find with me!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title includes an emoji (:sparkles:) and is vague. While it relates to the changeset's subject (stack-graphs-based analyzers), it lacks specificity about the main contribution—an enhancement proposal document describing a rearchitected language analysis architecture. Replace the emoji with a descriptive phrase and clarify the main change, such as: 'Add stack-graphs-based language analyzers enhancement proposal' or 'Propose rearchitecting language analysis on stack-graphs library'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
enhancements/stack-graphs-analyzers/README.md (1)

102-102: Consider adding language specifiers to fenced code blocks.

Three code blocks lack language specifiers (lines 102, 427, 520). While these appear to be ASCII diagrams rather than executable code, adding a language specifier (e.g., text) would improve markdown consistency and silence linter warnings.

📝 Example fix for line 102
-```
+```text
   ↑title      ↑Bar           <-- pop nodes (definitions in this scope)

Also applies to: 427-427, 520-520

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@enhancements/stack-graphs-analyzers/README.md` at line 102, Three fenced code
blocks that contain ASCII diagrams (e.g., the block starting with "↑title     
↑Bar           <-- pop nodes (definitions in this scope)" and the similar blocks
near the other two diagrams) lack language specifiers; add a language tag
(preferably text) to each opening fence (```text) so the blocks become ```text
... ``` to satisfy the linter and keep markdown consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@enhancements/stack-graphs-analyzers/README.md`:
- Line 102: Three fenced code blocks that contain ASCII diagrams (e.g., the
block starting with "↑title      ↑Bar           <-- pop nodes (definitions in
this scope)" and the similar blocks near the other two diagrams) lack language
specifiers; add a language tag (preferably text) to each opening fence (```text)
so the blocks become ```text ... ``` to satisfy the linter and keep markdown
consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f923a83f-5bfb-4e1e-baec-c621c22fa391

📥 Commits

Reviewing files that changed from the base of the PR and between 346df19 and 8acc101.

📒 Files selected for processing (1)
  • enhancements/stack-graphs-analyzers/README.md

Proposes building Konveyor's language analysis on a maintained fork of
GitHub's stack-graphs library, replacing heavyweight Go-based providers
that depend on language servers (JDTLS, csharp-ls). Includes narrative
of discoveries (serde gap, schema standardization needs, FQDN
computation), open design questions, and proposed architecture.

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>
- Link to c-sharp-analyzer-provider for context on current C# provider
- Rewrite worked example: start with simplest intra-file case, build
  up to cross-file and member access, show push/pop clearly at each step
- Fix FQDN section: TSG has string concat but it was fragile in practice
- Fix TSG/Lua discussion: frame as real language vs custom DSL
- Connect forward-only resolution to incrementality discussion
- Add incremental resolution via partial path pre/postconditions as
  an alternative to full resolution pass
- Remove "we likely need both" assertion from type info section

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>
Vertical diagram shows directed edges from push node (reference)
through scope nodes to pop nodes (definitions), making the
breadth-first search and gate-check mechanism concrete.

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>
- Fix FQDN expansion: "fully qualified name" not "domain name"
- Standardize on CST terminology with explanatory aside
- Clarify cross-file example: show how using directive creates
  push nodes that build the namespace on the stack
- Clarify member access example: show push chain traversal
  step-by-step before resolution begins
- Add Open Question 8: external dependencies (ILSpy approach)
- Add Open Question 9: resolution failure and diagnostics
- Remove import from syntax_type vocabulary (it's a reference)
- Soften "proof" claim for Java analyzer (81% pass rate)
- Add leaning to graduation criteria (rule pass rate)
- Fix jmle date to 2026-04-16, soften "platform" claim
- Align pop(":") between schema section and open question 4
- Add FQDN format note to find_definitions docstring

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>
- Rename FQDN to FQN (fully qualified name) throughout
- Fix jmle timeline and chronological ordering
- Standardize CST terminology in Alternatives and Implementation History
- Add push/pop intuition, naming convention note, sketch type annotations
- Restore reviewers list, fix YAML frontmatter
- Tighten duplicate explanations, fix orphaned reference

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>
@JonahSussman
JonahSussman force-pushed the enhancements/stack-graphs-analyzers branch from ffc7b90 to a07fb02 Compare April 17, 2026 17:58

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@enhancements/stack-graphs-analyzers/README.md`:
- Around line 558-564: The fenced code block showing the integration diagram for
analyzer-lsp and stack-graphs-provider is missing a language label; update the
fence around the diagram to use a language tag (e.g., text) so the block is
labeled and MD040 is fixed—locate the fenced block containing "analyzer-lsp 
--gRPC-->  stack-graphs-provider  (Rust binary)" and change the opening fence
from ``` to ```text (preserve the exact diagram content and closing backticks).
- Around line 104-115: The fenced ASCII diagram block starting with the triple
backticks in the README should include a language hint to satisfy markdownlint
MD040; change the opening fence from ``` to ```text (or another appropriate info
string) so the block becomes a fenced "text" code block and keep the closing ```
unchanged; locate the fenced diagram block that contains the ASCII lines like
"↑title      ↑Bar" to apply this change.
- Around line 461-502: The fenced code block starting with the triple backticks
that contains the diagram beginning with "Source files (.cs, .java, ...)" is
unlabeled; update the opening fence to include a language label (use "text") so
the block becomes ```text ... ``` to satisfy MD040 and improve rendering,
leaving the block content and closing fence unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bc463a6f-7ff0-4527-80b0-0fee34fe7894

📥 Commits

Reviewing files that changed from the base of the PR and between 8acc101 and a07fb02.

📒 Files selected for processing (1)
  • enhancements/stack-graphs-analyzers/README.md

Comment thread enhancements/stack-graphs-analyzers/README.md
Comment thread enhancements/stack-graphs-analyzers/README.md
Comment thread enhancements/stack-graphs-analyzers/README.md

Each provider is built independently with its own architecture, query capabilities, and rule format. There is no way to write a query that works across languages. Adding a new language means building a new provider from scratch — new Go code, new language server dependency, new containerization, new bugs.

A migration rule like "find all references to `com.example.OldClass`" should be expressible the same way regardless of whether the codebase is Java, C#, or Python. Today, it can't be.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if I am fully on board with this because a language like Rust doesn't have "class", so at the very least, each language will need to have its own set of locations.

Just some food for thought

Rewrite d.Title member access example to show the full type-dependent
resolution trace using ":" pop edges as gate symbols. Each step now
shows exactly which node is encountered and what happens to the stack,
with no hand-waving. Also restructure sections, rename "Serde Gap" to
"SQLite Gap", and miscellaneous editorial improvements.

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
enhancements/stack-graphs-analyzers/README.md (1)

162-173: ⚠️ Potential issue | 🟡 Minor

Add language hints to unlabeled fenced diagram blocks (MD040).

Line 162, Line 532, and Line 629 open fenced blocks without an info string. This can fail strict markdownlint runs; use text for these ASCII diagrams.

Suggested fix
-```
+```text
  ↑title      ↑Bar     <-- pop nodes (definitions in this scope)
    ^           ^
    |           |
  [Foo's member scope]   <-- "Bar is nested in Foo, so Foo's members are visible"
@@
  ↓title                <-- push node (reference to title)

- +text
Source files (.cs, .java, ...)
|
v
tree-sitter (parsing)
@@
gRPC Provider Service
(replaces java-external-provider,
dotnet-external-provider)


-```
+```text
analyzer-lsp  --gRPC-->  stack-graphs-provider  (Rust binary)
                              |
                              +-- C# grammar
                              +-- Java grammar
                              +-- SQLite database
</details>


Also applies to: 532-573, 629-635

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @enhancements/stack-graphs-analyzers/README.md around lines 162 - 173, The
markdown contains unlabeled fenced diagram blocks (plain ASCII diagrams) that
trigger MD040; locate the three fenced code blocks shown by the ASCII diagrams
(the block starting with the arrow diagram that includes "↑title ↑Bar" and
the other two blocks with "Source files (.cs, .java, ...)" and "analyzer-lsp
--gRPC--> stack-graphs-provider") and add the info string text to each opening
fence (change totext) so the diagrams are explicitly marked as plain
text.


</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @enhancements/stack-graphs-analyzers/README.md:

  • Around line 162-173: The markdown contains unlabeled fenced diagram blocks
    (plain ASCII diagrams) that trigger MD040; locate the three fenced code blocks
    shown by the ASCII diagrams (the block starting with the arrow diagram that
    includes "↑title ↑Bar" and the other two blocks with "Source files (.cs,
    .java, ...)" and "analyzer-lsp --gRPC--> stack-graphs-provider") and add the
    info string text to each opening fence (change totext) so the diagrams
    are explicitly marked as plain text.

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: defaults

**Review profile**: CHILL

**Plan**: Pro

**Run ID**: `115c716d-c406-40f1-afd2-7b6c3d7d6e1b`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between a07fb0278a2aba4df27cf9f3bf0e0890bbb494c6 and 22edd6b81b837c33d51d625c1871ab3e2e6b4d53.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `enhancements/stack-graphs-analyzers/README.md`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days.
It will remain open for visibility and reporting purposes.
Please comment if this PR is still relevant.

@github-actions github-actions Bot added the stale label Jun 17, 2026
@jmle

jmle commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@JonahSussman I guess we don't want to keep this anymore after the latest changes to the c-sharp provider?

@github-actions github-actions Bot removed the stale label Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants