Repository navigation
feat(depgraph): dominator, zone-SCC, and cohesion report summaries - #3285
Conversation
Adds three report-only fields to `pnpm depgraph` nothing in scripts/layering or scripts/check-affected reads: a dominator-tree summary of one entry's eager-load closure over value edges (default src/daemon.ts, overridable with --dominator-entry), zone-level strongly connected components over value zone pairs, and Louvain community detection scored against declared zones with getModularity, plus a per-zone cohesion share. Each reproduces the numbers #3276 quotes from the earlier ad hoc analysis (621/1837 eager files, the maestro/provider-webdriver dominator branches, the 9-zone cycle, 0.373 vs 0.564 modularity, and the five lowest per-zone cohesion shares) against the current tree. getModularity wants Community<N> (full node objects) but getLouvainCommunities returns bare ids; computeCohesionSummary maps ids back onto the graph's own nodes rather than working around it at every call site. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Review findings on #3285: - model.test.ts asserted the SCC/modularity summary lines with shape-only regexes that accepted any count or score, so a CLI line inconsistent with the JSON it was derived from still passed. Compare against the exact payload values instead (planted a wrong modularity value to confirm the test now fails without the fix). - flagValue returned an empty string for `--out ""` / `--dominator-entry ""` verbatim, which bypassed the `?? <default>` fallback (only nullish values trigger it) and resolved --out to the current directory, crashing the write with EISDIR instead of falling back like a missing value does. Fixed at the shared helper, with a regression test for both flags (confirmed both fail against the prior flagValue). - README overstated dominatorSummary.bottlenecks as covering "every reachable file"; the entry itself is excluded by construction. - Clarified the ALL_EDGES doc comment: computeZoneSccSummary builds its own value-only zone graph and never reads this constant, only computeCohesionSummary does. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Addressed all 4 review findings in 520f5d1:
|
|
The PR is ready at 520f5d1. The code looks correct. All 17 checks pass, and that includes the depgraph gate, which runs Not blocking, and you can take or leave these: the I did not run Nothing blocks this PR. #3283 can close once the four upstream issues are filed and linked there, since this PR is only "Part of" it. The four cubic-dev-ai threads no longer apply at this commit, so you can resolve them: the exact-payload assertions in |
|
Thanks for the review. Decisions on the 3 non-blocking suggestions — all accepted:
Committed in |
Summary
Part of #3283 (workstream 7 of the architecture-quality umbrella #3276). Adds three report-only fields to
pnpm depgraph, stacked on #3275's@statelyai/graphmigration:dominatorSummary— dominator tree of one entry's eager-load closure over value edges only (defaultsrc/daemon.ts, override with--dominator-entry <path>). Reproduces Architecture quality: replace custom graph/layering code with maintained tools, close guardrail gaps, fix collocation (umbrella) #3276's own numbers against the current tree: 621/1837 eager files, withrequest-binding.ts/replay-device-selection.tspulling in all ofmaestroandprovider-device-runtimes.tspulling in all ofprovider-webdriver.zoneSccSummary— strongly connected components of the zone graph over value zone-pairs only (same edge kind R4 keeps acyclic at file level). Reproduces the quoted 9-zone cycle (cli, commands, core, daemon-client, daemon-server, remote, sdk, plugins, (root)).cohesionSummary— Louvain communities vs. declared zones scored withgetModularity, plus per-zone cohesion share. Reproduces 0.373 (declared) vs 0.564 (detected) modularity and the five lowest per-zone shares (kernel 26%, contracts 29%, sdk 31%, (root) 37%, host-kit 38%).Nothing in
scripts/layering/orscripts/check-affected/reads these fields — no gate behavior changed.getModularitywantsCommunity<N>(full node objects) butgetLouvainCommunitiesreturns bare ids;computeCohesionSummarymaps ids back onto the graph's own nodes once, in the owning module, rather than at each call site (this mismatch is also one of the four upstream@statelyai/graphissues deliverable 2 of #3283 covers — not yet filed this round, tracked separately in #3283).7 files touched, +506/-10 lines (
git diff --stat), within budget.Validation
Tested at
8368e7b67:pnpm depgraph:test— 37/37 pass (newstructure-summary.test.tswired into the script's explicit file list).pnpm check:quick(lint + typecheck) — clean.pnpm check:affected --run— all runnable checks passed (includingfallow audit, which initially flaggedmain's cyclomatic complexity inbuild.ts; fixed by extracting aflagValuehelper, then clean).pnpm depgraphagainst the current tree reproduces every number Architecture quality: replace custom graph/layering code with maintained tools, close guardrail gaps, fix collocation (umbrella) #3276 quotes, as evidence the new code measures what it claims to.No device-facing or routing changes; docs-only risk is the README section added for the new fields.