Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #628
Problem
merge-batch-graphs.pysilently drops cross-batch edges whose endpoint carries the wrong node-type prefix.Each
file-analyzersubagent picks the ID prefix for a node it owns (file:/config:/document:/pipeline:/table:/schema:/endpoint:). When batch A emits an edge pointing at a file that batch B classified, A has to guess that prefix —batchImportDataandneighborMaponly resolve project-internal code imports, so doc→pipeline, doc→config and config→code references have no ground truth.Step 6 then compares IDs by exact equality and drops anything that doesn't match:
Code files almost always end up as
file:, so the loss lands entirely on the non-code node types — which is where the most valuable semantic edges live (documents,triggers,configures,depends_on).The failure is quiet: the drop only reaches stderr, and the only consumer of that stderr in the pipeline is the optional Phase 3
assemble-reviewerLLM agent. Runs that skip it (or that don't read its output closely) lose the edges with no visible signal — the final graph just has fewer relationships than it should.Real-world impact
On a 205-file project (Next.js CRM + 46 SQL migrations + 17 n8n workflow docs + docs tree), a single
/understandrun had 25 edges about to be dropped this way. 21 of them weredocumentsedges fromREADME.md/CLAUDE.md/ two other root docs →pipeline:n8n-workflows/*.md— the batch that owned the docs guesseddocument:, the batch that owned the workflow files chosepipeline:. That is the entire "which document describes which automation" map, gone.The remaining 4 were
file:vsconfig:(next.config.ts, a large JSON data file). Exactly one of the 26 reported drops was legitimate (a path referenced in a doc that no longer exists on disk).Fix
Before dropping, try to resolve the endpoint ignoring its prefix.
file:x.tsandconfig:x.tsexist, the ID stays ambiguous and the edge is dropped and reported exactly as it is today.The count surfaces in the existing "Fixed" report section:
Tests
Adds
PrefixResolutionTeststotests/skill/understand/test_merge_batch_graphs.py— six cases throughmerge_and_normalize, covering both the recovery and the guardrails:document:wf/a.mdpipeline:wf/a.mdconfig:src/x.tsfile:src/x.tsdocument:ghost/nope.mddocument:amb/y.tsfile:amb/y.tsandconfig:amb/y.tspipeline:wf/a.md(already valid)pipeline:wf/a.mdThe diff is additive only (+130 / −0); no existing test changed.
Also run against the real 205-file project described above: 511 nodes, 1011 edges, 25 endpoints resolved, 1 legitimate drop remaining, and the resulting graph passes the Phase 6 inline validator with 0 issues.
Notes
VALID_NODE_PREFIXESis reused for the prefix test rather than hardcoding a second list, so new node types are picked up automatically.compute-batches.mjspublish an authoritativepath → nodeTypemap to every batch, so analyzers never have to guess. That's a bigger change; this one is the safety net regardless of whether that lands.