refactor(depgraph): run graph traversals on @statelyai/graph
Merged
TH
2mo ago+273+273+012345678901234567890123456789-142-142-012345678901234567890123456789
Summary
Moves scripts/depgraph/ traversals (report and pnpm depgraph affected) from hand-rolled adjacency maps and BFS walks to @statelyai/graph. Import extraction still uses the layering gate's oxc edge model.
import-graph.tsbuilds one library graph, filtered by edge kind. Its NUL-separatedimportEdgeIdis the single file-pair identity.- The transitive-reachability flag comes from the library's transitive reduction and is computed only in the report. On a value-import cycle the report lists the cycle and leaves that count uncomputed;
affectedstill answers. - Levels use postorder; dependents and handler closures use BFS.
- Adds dev dependency
@statelyai/graph@2.4.0; 2.5.1 is younger than the minimum release age.
9 files. Findings and next steps: #3276.
Validation
At e2a049f00:
pnpm check:affected --run(full set, due to lockfile) andpnpm check:toolingpassed; device and replay lanes are GitHub-authoritative.pnpm depgraph:test29/29, including unambiguous ids andbuildGraphon a value cycle (fails if marking moves back intobuildGraph).- With a value cycle planted in the tree, the report shows
value-import cycles (R4): 1andaffectedstill answers. - On the current tree,
graph.jsonanddepgraph affected --json(three sample files) are byte-identical tomain. Runtime 2.0 s โ 1.5 s.
๐ค Generated with Claude Code