Repository navigation
fix(graph): impact reads a node's edges in one unlimited query again - #3341
Merged
Merged
Conversation
colbymchenry
force-pushed
the
claude/land-3249
branch
2 times, most recently
from
November 17, 2026 23:17
629c73b to
559d0c7
Compare
…3248) PR #3125 gave impact traversal a node and edge budget, and fetched each visited node's incoming edges as `kind IN (<every kind but contains>) ... LIMIT ?`. Both halves slowed the read the walk makes once per visited node: the kind list searches the target index once per kind, and the LIMIT under the read's ORDER BY made it slower still. getImpactRadius took 2-3x as long for the same subgraph. The walk now reads `WHERE target = ? AND kind != 'contains'` with no LIMIT, through a cached statement, and the slice applies the budget as before. A container's members are read without a LIMIT too, for the same reason. A contains edge still never takes a budget slot or marks the result truncated, and the output is unchanged: the same nodes, edges, order and truncation as main on 20,000 random graphs and 500 traversals of codegraph's own index. Fixes #3248 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
colbymchenry
force-pushed
the
claude/land-3249
branch
from
November 18, 2026 00:05
559d0c7 to
fad875e
Compare
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.
Summary
Lands @inth3shadows's #3249 as theirs: their commit, unchanged, on current
main, with them as the author, plus a CHANGELOG bullet. Impact traversal is back to its 1.6.2 speed with the same results.Root cause (from #3248 / #3249)
#3125 made
getImpactRecursiveread each visited node's dependents askind IN (<12 kinds>) … ORDER BY kind, source, line, col LIMIT ?. The kind list searchesidx_edges_target_kindonce per kind, and theLIMITunder thatORDER BYmade each read slower still. The walk runs that read once per visited node, sogetImpactRadiustook 2–3x as long. That shipped in 1.6.3.Fix (#3249, unchanged)
getIncomingEdgesExceptContainsreadsWHERE target = ? AND kind != 'contains'with noLIMIT, through a cached statement. The walk slices it to the edge budget as before, sotruncatedkeeps its meaning. A container's members are read without aLIMITtoo.Review and validation
Security: every line read. Queries, traversal and tests only; no network, exec, file writes or dependencies. The cherry-picked diff is identical to the PR diff that was reviewed (+98/−6 in 3 files); the only addition here is the CHANGELOG bullet. The commit message differs only in rewording one line that started with
#.Red→green:
__tests__/graph.test.ts44 passed with the fix; with main'squeries.tsandtraversal.ts, its 2 new tests fail (getIncomingEdgesExceptContains is not a function; aLIMITreached the read).Timing, codegraph's own source (1,377 files, 32k nodes),
getImpactRadiusbest of 7 per process, median of 7 interleaved rounds:initgetNodeSame subgraph on main and this branch: 827 nodes / 2,708 edges for
init, 901 / 4,449 forgetNode.Same output: on byte-identical copies of the 1.6.3 index, main and this branch return the same nodes (in order), edges (in order) and
truncatedfor all 30,625 non-file nodes at the default budget and depth, and for 3,000 tight-budget cases (maxNodes 1–40, maxEdges 1–60, depth 1–5; 497 of them truncated).Full suite: see the READY report.
Fixes #3248
@Marcos-199-GitHub's #3285 builds on the same commit and adds a schema bump with a new edges index created on open; that part is left out.
🤖 Generated with Claude Code