Skip to content

Comments

fix(query): prevent chain backtracking from discarding all paths on high fanout#174

Merged
rocketman-code merged 1 commit intomainfrom
fix/chain-backtrack-explosion
Feb 22, 2026
Merged

fix(query): prevent chain backtracking from discarding all paths on high fanout#174
rocketman-code merged 1 commit intomainfrom
fix/chain-backtrack-explosion

Conversation

@rocketman-code
Copy link
Owner

Summary

  • --chain and --cut returned false negatives on high-fanout modules (e.g. src/dialogs.ts in workers-sdk with 25+ importers)
  • Root cause: backtracking explosion guard broke the entire loop when partial paths exceeded max_chains * 2, discarding all incomplete paths before any reached entry
  • Changed to a capped-expansion strategy that stops spawning new branches but still extends existing paths to completion

Test plan

  • New unit test: chain_high_fanout_not_dropped (25-way fan-out graph)
  • Verified --chain src/dialogs.ts on workers-sdk now returns 10 chains (was "not reachable")
  • Verified --cut also works correctly
  • Full test suite passes (464 tests)

Closes #172

@rocketman-code rocketman-code force-pushed the fix/chain-backtrack-explosion branch from cd7d7ef to f57fd31 Compare February 22, 2026 23:20
@rocketman-code rocketman-code merged commit c5d7d1a into main Feb 22, 2026
8 checks passed
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.

Bug: --chain/--cut reports false "not reachable" on high-fanout modules

1 participant