Repository navigation
Dependency graphs lead with direct changes: churn folds into the dependency it came with - #343
agorischek wants to merge 19 commits into
Conversation
… diff-changes honours aliases Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Active issues can hide packages under revision-absent owners, let alias-based visual regressions pass checks, and leave summaries visible after their owners disappear.
3 open issues
What changed in this PR
This PR makes Projections dependency graphs emphasize direct changes by folding related transitive churn into summary cards.
Changes:
- Adds revision-aware churn detection, summary updates, and folded-package aliases.
- Extends
diff-changeschecks to recognize aliases. - Adds migration/removal scenarios, regression coverage, documentation, and changelog entries.
| File | Description |
|---|---|
| packages/renderers/testing/test/helpers.test.mjs | Adds alias-check coverage. |
| packages/renderers/testing/src/types.ts | Adds optional sample aliases. |
| packages/renderers/testing/src/measure/entities.ts | Reads entity aliases. |
| packages/renderers/testing/src/checks/comparison/diff.ts | Recognizes aliased changes. |
| packages/renderers/testing/src/checks/catalog.ts | Documents alias-aware checks. |
| packages/renderers/testing/README.md | Explains alias support. |
| packages/renderers/harness/browser/checks.spec.ts | Records known scenario failures. |
| packages/renderers/graph/test/dependencies.test.mjs | Tests churn folding. |
| packages/renderers/graph/src/dependencies/view.tsx | Clarifies folded-card behavior in comments. |
| packages/renderers/graph/src/dependencies/model.ts | Maps folded entities into summaries and steps. |
| packages/renderers/graph/src/dependencies/graph.ts | Adds per-revision adjacency. |
| packages/renderers/graph/src/dependencies/collapse.ts | Folds churn and updates summary status. |
| packages/renderers/graph/src/dependencies/churn.ts | Identifies transitive churn. |
| packages/renderers/graph/scenarios.json | Registers two dependency scenarios. |
| packages/renderers/graph/README.md | Documents folding behavior. |
| packages/renderers/graph/fixtures/make-bundler-migration.mjs | Generates synthetic workspace revisions. |
| docs/builtins/renderers/graph.md | Explains churn summaries. |
| docs/builtins/extractors/workspace-dependencies.md | Describes dependency presentation changes. |
| changelog.d/343.md | Announces graph improvements. |
| changelog.d/343-renderer-authors.md | Announces alias-aware checks. |
Review effort: Balanced
…ges matches references by alias Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Ownership changes can leave summary counts stale and remove collapse controls, while incomplete alias handling causes comparison checks to reject valid highlighting or miss unmarked changes.
4 open issues
3 resolved since last review
Review effort: Balanced
…aliased cards count as touched in every check Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Summary scheduling remains order-dependent and omits synthetic edges, causing reverse-comparison count mismatches and edge highlights that are out of sync with their cards.
2 open issues
4 resolved since last review
Review effort: Balanced
…e summary steps by cause, with their edges Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…vision Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
With churn folded, the first summary card is express's; expanding it reveals packages whose own summary cards can come first, so re-resolving .first() after the click found a different, collapsed card. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>


What changed
Fixes the
workspace-dependenciesimage from the Projections setup trials. On a webpack-to-Rspack migration, the default PNG showed transitive packages and left out the workspace and its direct changes.--focus changesand--entity workspace:<name>didn't help. A mass-removal pull request was unreadable in the same way. Both reproduce on main 49d66f0 with the new scenarios below.Previously, the
dependenciespresentation showed every changed package and the path that pulls it in. Adding or removing a direct dependency also adds or removes every transitive package only it depended on: about 150 for webpack, webpack-cli, webpack-dev-server and their loaders against Rspack. Because all of them counted as changed, the renderer drew them all and buried the direct changes.churn.ts) when, in each revision it's in, the graph reaches it only through changed direct dependencies, whether they arrive, leave or move to another version. It is also churn when it only moved to another version itself: a bump, or npm installing it under another key (pkg@1.2) while a package of its name is in the other revision. Churn collapses into summary cards like unchanged packages do. A transitive package new to the dependency tree, or gone from it, under an unchanged direct dependency still shows. On one real Webpack-to-Rspack pull request that also refreshed its lockfile, the whole-PR comparison fell from 447 cards to 159, close to the 146 for its single bundler commit. Its height fell from 10864 px to 5695 px, and what's left is mostly unchanged direct dependencies, which are always shown. Thenpm-express-5andnpm-react-updatescenarios now fold the packages Express 5 and React DOM bring.data-entity-aliases, the same way a NuGet project folds onto its framework's card. Host selection, hover, filter and focus requests for a folded package land on that card.diff-changeshonours aliases. Previously the built-in check required each changed entity to have its own element. It now also accepts a visible entity element that lists the entity indata-entity-aliases.EntitySampleadds an optionalaliasesfield, documented in the check description and the testing README.make-bundler-migration.mjsgenerates three synthetic revisions of an npm workspace for two scenarios:npm-bundler-migration(webpack to Rspack in the web app) andnpm-mass-removal(the admin app leaves the workspace along with the packages only it used).Before and after
webpack to Rspack, before (main, clipped at 4096 px):
After:
A workspace member removed, before and after:
Known issues the new scenarios expose
checks.spec.tslists two known failures for the new scenarios. Both come from how the existing renderer counts dependents and sizes cards, which this change doesn't touch. I didn't run the checks against main for these scenarios.neutral-endpoints(both scenarios) anddiff-neutral(migration): a package's "+N dependents" note counts the dependents of both revisions whose edges aren't drawn, so at an endpoint it can differ from that revision alone.neutral-endpoints(removal): cards share one width over both revisions, so@rspack/plugin-react-refreshwraps at a different dot than After alone draws it, like the existingdatabase/prisma-licensingentry.Evidence
npm run tools -- test packages/renderers/graph: 49 pass, including the newpackages that come and go only with a direct dependency that comes or goes fold into its summary card, which fails on main.npm run tools -- test packages/renderers/testing: 29 pass, including the newdiff-changes counts a change drawn on a card that presents it in data-entity-aliases.Harness on Chromium desktop, all specs filtered to
npm-andnuget(npx playwright test --project=chromium-desktop --grep "npm-|nuget" --timeout=300000), withchecks.spec.tsrun locally on Chromium desktop for every scenario instead of its usual project: 64 passed. On this two-core machine the checks needed more than the default 90 s.PNGs from
projections compare HEAD~1..HEAD -p deps --png …in a scratch repository whose extractor replays the fixtures, built from main and from this branch.npm run tools -- check --fastpasses, apart from the format check ondocs/guides/host-core.mdandtools/scripts/check-styles.mjs, which this PR doesn't touch and which fail the same way on main.Documentation that this change affects is updated, and generated reference
pages are regenerated (
npm run docs:generate). The graph renderer's built-in page and README, the workspace-dependencies page and the testing README describe the fold.Fixes include a regression test.
A changelog fragment at
changelog.d/<this PR's number>.mddescribes whatusers will notice, or the PR has the
no changeloglabel (seechangelog.d/README.md).
No credentials, private source or machine-specific paths are included.