Skip to content

fix(lsp): enrich all supported languages in polyglot repos - #391

Open
cookerpapa wants to merge 1 commit into
trailhq:mainfrom
cookerpapa:fix/lsp-polyglot-servers
Open

cookerpapa wants to merge 1 commit into
trailhq:mainfrom
cookerpapa:fix/lsp-polyglot-servers

Conversation

@cookerpapa

Copy link
Copy Markdown

In a mixed C/Python repo, server selection stops at clangd, so pyright never runs.

Select the first installed server per language and run each selected server once, restricted to its own source files. Continue after failed initialization, share edge deduplication and a repo-wide node budget, and report all attempted servers.

Refs #376. This addresses server selection only. Retaining LSP edges across pre-query refreshes remains a separate issue.

Validation on Linux:

  • Four regression scenarios fail on main and pass with the fix.
  • Fixture language servers exercise real stdio JSON-RPC, including language isolation, failed initialization, shared servers, and the node budget. These executable fixtures are skipped on Windows.
  • All 9 LSP tests pass.
  • Full suite: 1,222 passed, 4 skipped.
  • Build and git diff --check pass.

@trailhq-graft

trailhq-graft Bot commented Sep 15, 2026

Copy link
Copy Markdown

🌱 graft blast radius

2 areas changed → 6 areas can be affected. 16 dependent symbols, depth 2.
Tests: Graph Building has tests the diff did not touch; 1 area updated its tests.
Tag: @anirudhkumar-nanonets — 5 of 8 areas · @shhdwi — 7 of 8 areas · @bhavesh-gupta-investis — Claude Sync

flowchart TB
  A0(("Pull Request Review<br/>8 symbols"))
  A1(("Graph Freshness<br/>3 symbols"))
  A2(("CLI Engine<br/>2 symbols"))
  A3(("Viewer Build<br/>1 symbol"))
  A4(("MCP Tools<br/>1 symbol"))
  AX(("1 smaller area<br/>1 symbol"))
  classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
  class A0,A1,A2,A3,A4 reached;
  classDef tail fill:#EEF2F3,stroke:#9AA4A9,stroke-width:1px,color:#3A4247;
  class AX tail;
Loading
Can be affected Symbols Nearest hop Reached from
Pull Request Review 8 src/app/brain-build.ts:L251-L358 readRepository — calls, depth 1 Graph Building, LSP Enrichment
Graph Freshness 3 src/graph/refresh.ts:L150-L227 ensureFreshGraph — calls, depth 1 Graph Building, LSP Enrichment
CLI Engine 2 src/engine.ts:L91-L101 graph — calls, depth 1 Graph Building, LSP Enrichment
Viewer Build 1 scripts/build-viewer.mjs:L1-L45 build-viewer.mjs — calls, depth 2 Graph Building
MCP Tools 1 src/mcp/tools.ts:L216-L244 callTool — calls, depth 2 Graph Building
Claude Sync 1 src/claude/sync-run.ts:L19-L33 runSync — calls, depth 2 Graph Building
Who knows this code — 3 people across 8 areas
Area Who knows it
Graph Building · changed @anirudhkumar-nanonets — 17 commits, last 26d ago · @shhdwi — 5 commits, last 1mo ago
LSP Enrichment · changed @shhdwi — 2 commits, last 1mo ago
Pull Request Review · affected @anirudhkumar-nanonets — 12 commits, last 4d ago
Graph Freshness · affected @anirudhkumar-nanonets — 8 commits, last 1mo ago · @shhdwi — 3 commits, last 1mo ago
CLI Engine · affected @anirudhkumar-nanonets — 41 commits, last 5d ago · @shhdwi — 24 commits, last 1mo ago
Viewer Build · affected @shhdwi — 2 commits, last 1mo ago
MCP Tools · affected @shhdwi — 14 commits, last 1mo ago · @anirudhkumar-nanonets — 7 commits, last 13d ago
Claude Sync · affected @shhdwi — 3 commits, last 2mo ago · @bhavesh-gupta-investis — 1 commit, last 22d ago

Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no @ has no GitHub handle in its commit email — tag them by hand, or add a .mailmap entry. A suggestion from history, not a CODEOWNERS rule.

All 16 dependent symbols, grouped by area

Pull Request Review — 8 symbols in 6 files

  • src/app/brain-build.ts:L251-L358 — readRepository (calls, depth 1)
    282: await buildGraph(checkout.dir, { graphOnly: true });
  • src/app/review.ts:L45-L99 — reviewPullRequest (calls, depth 1)
    55: await buildGraph(checkout.dir);
  • src/app/brain-build-worker.ts:L1-L83 — brain-build-worker.ts (calls, depth 2)
    12: import { readRepository, type BrainBuildJob, type RepoReadAuth } from "./brain-build.js";
  • src/app/brain-build-worker.ts:L29-L32 — DoneMessage (references, depth 2)
  • src/app/brain-build.ts:L237-L239 — buildRepoIntoBrain (calls, depth 2)
  • src/app/review-process.ts:L179-L183 — childReviewer (references, depth 2)
  • src/app/review-worker.ts:L67-L87 — run (calls, depth 2)
  • src/app/server.ts:L34-L46 — AppSeams (references, depth 2)

Graph Freshness — 3 symbols in 2 files

  • src/graph/refresh.ts:L150-L227 — ensureFreshGraph (calls, depth 1)
    216: await buildGraph(dir, { contextDir: opts.contextDir, graphOnly: true, onlyDirs });
  • src/graph/refresh.ts:L235-L261 — ensureFreshChildren (calls, depth 2)
  • src/graph/workspace-cli.ts:L49-L70 — buildChild (calls, depth 2)

CLI Engine — 2 symbols in 2 files

  • src/engine.ts:L91-L101 — graph (calls, depth 1)
    92: return buildGraph(dir, {
  • src/cli.ts:L168-L178 — refreshBefore (calls, depth 2)

Viewer Build — 1 symbol in 1 file

  • scripts/build-viewer.mjs:L1-L45 — build-viewer.mjs (calls, depth 2)
    3: * assets). Runs as part of `npm run build`; the bundle ships in the package

MCP Tools — 1 symbol in 1 file

  • src/mcp/tools.ts:L216-L244 — callTool (calls, depth 2)

Claude Sync — 1 symbol in 1 file

  • src/claude/sync-run.ts:L19-L33 — runSync (calls, depth 2)
Test signal per changed area — 1 ✓ · 1 ⚠

Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.

  • Graph Building — 1 of 1 reached · 33 test files reach it, none changed here
  • LSP Enrichment — 2 of 2 reached · 2 test files changed here: test/lsp-enrich.test.ts, test/lsp-polyglot.test.ts
33 test suites also reference this code

41 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.

  • test/ask-index.test.ts
  • test/ask.test.ts
  • test/container-extract.test.ts
  • test/context-only-dir.test.ts
  • test/context.test.ts
  • test/covers.test.ts
  • test/generic-extract.test.ts
  • test/graph-go.test.ts
  • test/graph-incremental.test.ts
  • test/graph-invariants.test.ts
  • test/graph-java.test.ts
  • test/graph-languages.test.ts
  • test/graph-php.test.ts
  • test/graph-posix-paths.test.ts
  • test/graph-python.test.ts
  • test/graph-r-classes.test.ts
  • test/graph-r-phase3.test.ts
  • test/graph-r-phase4.test.ts
  • test/graph-r-phase5.test.ts
  • test/graph-r.test.ts
  • …13 more

⚠️ 1 changed file not in the graph (README.md) — no parser claims the extension, or the index predates the file.

graft blast · origin/main...HEAD · depth 2 · 6 changed files

Open the interactive graph → — click an area to see its dependent symbols at file:line.

github-actions Bot added a commit that referenced this pull request Sep 15, 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.

1 participant