Skip to content

fix: bound large-repo memory and traversal work - #1583

Open
danusha2345 wants to merge 6 commits into
colbymchenry:mainfrom
danusha2345:fix/resolution-memory-and-graph-bounds
Open

danusha2345 wants to merge 6 commits into
colbymchenry:mainfrom
danusha2345:fix/resolution-memory-and-graph-bounds

Conversation

@danusha2345

@danusha2345 danusha2345 commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Addresses #1553.

Rebased onto the 2026-09-27 main. The pieces that landed upstream in the meantime are dropped from this PR:

dropped from this PR now on main as
size guard in the resolver's readFileCached, shared size constant #2006
dropping watches for a removed directory #2025
WAL backpressure #1751
#1606 / #1607 fix #1614
line lookups in callback-synthesizer.ts left to #1985, which does the same

What remains

  1. The resolver's file and line caches are bounded by bytes held, not only by entry count (lru-cache.ts).
  2. C function-pointer synthesis holds less at once. Its caches are bounded by bytes. Macro captures are copied out so they don't pin whole headers. Only macros used in conditionals are kept, and working data is freed between stages.
  3. Synthesis passes are merged as each one finishes, and results from worker threads still merge in registry order. This is compatible with fix(sync): refresh synthesized edges after incremental changes (#1988) #2033, which only changes what happens after the merge.
  4. Idle query workers are recycled after 60 s, and one fresh worker stays warm.
  5. Shortest-path search uses a parent map and a head index instead of copying paths. It keeps fix(graph): enqueue path-search targets once (#1359) #2016's enqueue-once set. fix(graph): enqueue path-search targets once (#1359) #2016's "dense fan-in" test now counts lookups per id instead of queue items; its expectation is unchanged and still fails on the old algorithm.
  6. The impact walk has a node/edge budget (10k/50k by default, 1k/5k from MCP), merged into fix(graph): don't lose dependents within the depth limit to edge order (#1974) #2000's depth-aware walk. Re-expanding a node from a nearer depth is still allowed; only new nodes and new edges spend the budget. The MCP answer says when it was truncated and suggests file or a smaller depth.
  7. Tag-based CFML files release their parse trees.

Tests

The PR's own tests pass, as do graph, lru-cache, query-pool, the resolution suites, watcher, the C function-pointer and synthesis suites and CFML (438 tests). On the full suite (Linux, Node 22) every test passes. The one failure is the known intermittent extraction.test.ts worker crash (V8 Fatal process out of memory: Zone, #1779), which also happens on main.

🤖 Generated with Claude Code

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (3adf067, post-#1770) into this branch: head e681dcd. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (43271f3) into this branch: head 1b81c76. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (85550eb) into this branch: head c48e644. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (8733c28) into this branch: head ef854d5. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (8c04734) into this branch: head 68cc98f. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (ee83636) into this branch: head 8856408. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (e720f6c) into this branch: head a3c66ea. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (de5adba, post-#1790) into this branch: head 5bbaec8. The only conflict was the js-builtins import line beside memory-budget in resolution/index.ts (plus the CHANGELOG) — both imports kept, no behaviour change. tsc clean; the branch's tests and resolution.test.ts pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (cece072) into this branch: head c47857c. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (040ba38) into this branch: head 1cf0ceb. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (374b3b4) into this branch: head b6749d7. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (71d049c) into this branch: head 8b17110. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (9181dd1) into this branch: head 5c6f6a3. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (64bd45c) into this branch: head 9fbbb8b. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (799f8b2, post-#1806) into this branch: head 810ce53. The only conflict was the import lines at the top of extraction.test.ts (#1806's scanDirectoryAsync / ScanSkipStats beside this branch's getParser); all kept. tsc clean; the branch's tests pass (758).

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (748311f) into this branch: head c0c6354. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345
danusha2345 force-pushed the fix/resolution-memory-and-graph-bounds branch from c0c6354 to 8f7df19 Compare September 27, 2026 14:58

This branch has not been deployed

No deployments
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