Repository navigation
Kit: fold mass removals into one summary card - #396
Open
agorischek wants to merge 10 commits into
Open
agorischek wants to merge 10 commits into
agorischek wants to merge 10 commits into
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…gress) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
… folds 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>
There was a problem hiding this comment.
🟡 Changes recommended
Grid folds can hide changed relationships inside otherwise unchanged cards; remapping folded relationship endpoints can discard a valid revision; and summaries that inherit the leading card’s timing can leave members scheduled for earlier steps invisible. These issues conceal meaningful changes in the rendered diff.
5 open issues
Retain both relationship revisions when folding rewired endpoints · New Keep cards with changed relationships out of unchanged folds · New Derive fold timing from all member cards · New Preserve hidden descendant IDs in fold aliases and presented IDs · New Prevent status-footer clicks from triggering selection · New
What changed in this PR
Adds shared folding to the renderer kit so large comparisons remain readable without per-renderer changes. The database renderer’s custom canvas remains a follow-up.
Changes:
- Folds mass additions/removals into expandable cards and unchanged grid runs into bands.
- Adds alias-aware selection, focus and renderer checks.
- Adds scenarios, regression coverage, documentation and changelog entries.
| File | Description |
|---|---|
| packages/renderers/testing/test/helpers.test.mjs | Tests alias-aware comparison checks. |
| packages/renderers/testing/src/types.ts | Adds aliases and selectable probe types. |
| packages/renderers/testing/src/probe.ts | Registers selectable probing. |
| packages/renderers/testing/src/measure/entities.ts | Measures aliases and selectable entities. |
| packages/renderers/testing/src/checks/interaction.ts | Excludes fold actions from selection checks. |
| packages/renderers/testing/src/checks/comparison/steps.ts | Accepts alias-based emphasis. |
| packages/renderers/testing/src/checks/comparison/diff.ts | Recognizes changes presented through aliases. |
| packages/renderers/testing/src/checks/catalog.ts | Updates check descriptions. |
| packages/renderers/testing/README.md | Documents alias-aware checks. |
| packages/renderers/kit/test/mass-fold.test.mjs | Tests folding models and schedules. |
| packages/renderers/kit/styles/layout.css | Styles summary cards and grid bands. |
| packages/renderers/kit/styles/diff.css | Prevents striking fold counts. |
| packages/renderers/kit/src/summary.ts | Resolves kind-specific nouns. |
| packages/renderers/kit/src/react/shell/kit-renderer.tsx | Provides nouns to kit components. |
| packages/renderers/kit/src/react/shell/focus.ts | Reveals items through fold aliases. |
| packages/renderers/kit/src/react/layout-components.tsx | Integrates folding into card grids. |
| packages/renderers/kit/src/react/kind-nouns.ts | Adds noun context and hook. |
| packages/renderers/kit/src/react/grid-folds.tsx | Implements grid folding and controls. |
| packages/renderers/kit/src/react/graph-canvas/mass-folds.ts | Adapts graph props for folds. |
| packages/renderers/kit/src/react/graph-canvas/entity-card.tsx | Makes summary cards expandable. |
| packages/renderers/kit/src/react/graph-canvas/canvas.tsx | Applies folding before graph layout. |
| packages/renderers/kit/src/react/fold.tsx | Adds fold identity and aliases. |
| packages/renderers/kit/src/mass-fold/model.ts | Defines fold types, threshold and labels. |
| packages/renderers/kit/src/mass-fold/links.ts | Consolidates folded relationships. |
| packages/renderers/kit/src/mass-fold/groups.ts | Groups siblings and creates summaries. |
| packages/renderers/kit/src/mass-fold.ts | Transforms models and step schedules. |
| packages/renderers/kit/src/index.ts | Exports mass-fold APIs. |
| packages/renderers/kit/browser/suite.ts | Counts presented items during scrubbing. |
| packages/renderers/kit/browser/invariants/frame.ts | Measures card aliases. |
| packages/renderers/kit/browser/fixtures.ts | Adds mass-removal fixture. |
| packages/renderers/kit/browser/card-grid.spec.ts | Tests grid folds and expansion. |
| packages/renderers/kit/browser/card-grid-page.ts | Provides grid browser-test fixture. |
| packages/renderers/graph/scenarios.json | Registers mass-removal scenario. |
| packages/renderers/graph/fixtures/mass-removal-before.json | Defines reports before removal. |
| packages/renderers/graph/fixtures/mass-removal-after.json | Defines graph after removal. |
| packages/renderers/graph/browser/graph.spec.ts | Tests graph folding and host interactions. |
| packages/cli/templates/renderer/scenarios.json | Adds unchanged-service catalog scenario. |
| packages/cli/browser/starter.spec.ts | Tests starter grid bands. |
| packages/cli/browser/starter-repository.spec.ts | Updates expected scenario count. |
| docs/guides/renderer-kit-graphs.md | Documents folding behavior and APIs. |
| docs/guides/renderer-kit-components.md | Links card grids to folding guidance. |
| changelog.d/396.md | Announces graph folding. |
| changelog.d/396-renderer-authors.md | Describes author-facing changes. |
| changelog.d/396-kit.md | Summarizes kit folding APIs. |
Review effort: Balanced
Comment on lines
+31
to
+32
| if (!touched.length) kept.push(row) | ||
| for (const {side, item} of touched) { |
| run = [] | ||
| } | ||
| for (const entry of read.entries) { | ||
| if (entry?.status === 'unchanged') run.push(entry) |
| return ( | ||
| <> | ||
| {fold.type === 'mass' ? ( | ||
| <GridFoldCard fold={fold} onToggle={place.toggle} emphasis={emphasis} mark={mark} presence={presence} /> |
Comment on lines
+60
to
+61
| const id = child.getAttribute(slotAttribute) | ||
| return [id === null ? null : {id, status: child.getAttribute(statusAttribute) ?? '', kind: child.getAttribute(kindAttribute) ?? ''}] |
| {...(fold.open ? {} : {[entityAliasesAttribute]: JSON.stringify(fold.members)})} | ||
| data-projections-unit="" | ||
| data-fold={fold.open ? 'open' : 'closed'} | ||
| data-projections-action="" |
…s and timing Siblings with no container fold only when they share their neighbours, so a dependency graph's scattered removals stay apart. A relationship rewired from a folded item keeps the revision that still has both ends. A card grid keeps the cards a fold takes, hidden, with their parts, so a fold presents those too; it leaves an unchanged card whose relationships change out of its bands, and takes its presence and emphasis from all its cards. A click anywhere in an element that is its own action selects nothing. Regenerated the reference pages. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
3 of 4 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What changed
A comparison that removes a whole schema, package set or job list used to draw every removed item as its own card. On one Next.js app, 48 removed tables made a database frame 1862 × 81,546 px, over
rendererLimits.maxHeight(20,000), so the PNG failed. On a monorepo's workspace dependencies the image was a wall of red. Refs #343.The renderer kit now folds mass changes in its shared primitives, so the graph canvas and the card grid fold them for every renderer built on them, with no per-renderer code.
massFoldMinimum, 12),GraphCanvasdraws one card in the removed style, labelled with the plural of the definition's noun: "48 tables removed". Siblings are items of one kind with the same status in the same container (or at the top level). The parts they contain fold with them, and their relationships to items that stay are drawn once from the card for each other end, kind and direction. The card and its links take the first step that changes what they stand for. Mass additions fold the same way ("14 tables added").Fold. Activating the card (or one of its links) opens the items in place. The card stays, labelled "Hide 48 removed tables", as the way to fold them again, until the document changes.--entity. Following Dependency graphs lead with direct changes: churn folds into the dependency it came with #343'sdata-entity-aliasespattern, the card keeps an ID of its own (pk-mass:…) and lists everything it stands for indata-entity-aliases, so the host's selection, hover, filter and annotations of a folded item find it. The canvas moves a selection, a focus request (--entity) or afocusof a folded item onto the card, and the shell's opening reveal finds an item on the fold that presents it. The card is its own action (data-projections-action): activating it opens the fold and reports no selection.CardGridfolds a dozen or more of itsEntityCards removed (or added) together, of one kind, into one card in their style ("14 jobs removed"). It also folds a run of a dozen or more unchanged cards with nothing between them into a full-widthFoldband ("14 unchanged services") that opens in place. The Changes scope shows its unchanged cards as context, so no bands are drawn under it. A single revision folds nothing. Each card reports its status and kind from itschangerow, and keeps its place in the grid, hidden, while a fold takes it, so runs stay correct as folds open and close.Foldtakes anidand the IDs itpresentsfor a fold that stands for selectable items.pk-label. A diff doesn't strike a fold's count the way it strikes a removed name, because "removed" is already in words.diff-changes,diff-neutralandhighlight-scopeverbatim, so the two merge cleanly. The selection round trip now passes by an entity element that is its own action (data-projections-action), using a newselectableprobe measurement.Why 12. It is twice a sibling block's
blockMinimum(6): two full lines of a block's tray, past which more cards add height without saying more than their count. It is also about where a stack of removed tables alone outgrows a frame: the 48-table frame works out to about 1,700 px a table, so a dozen pass the 20,000 px limit.Not covered. The database renderer lays out its own schema canvas, not
GraphCanvasorCardGrid, so this change doesn't fold its tables and doesn't by itself fix the 81,546 px frame.foldMassChangesis exported from the kit for it. I'd suggest that as a follow-up rather than patching the renderer here.Before and after
graph/mass-removal, a new scenario: a reporting service retires with the 16 reports it ran, and an analytics service arrives. Diff mode, desktop.Before (main):
After:
The card grid folds 14 removed jobs into one card, and a run of 14 unchanged jobs into a band:
Evidence
npm run tools -- check --fast: pass. This covers lint, typecheck, format (oxfmt), Considered size and complexity limits, and repository rules.npm run tools -- test packages/renderers/kit: 206 pass, plus the newmass-fold.test.mjs(6 cases: folding in a container, aliases, step placement both ways, open folds, threshold, additions, and nouns).npm run tools -- test packages/renderers/testing: 29 pass (including Dependency graphs lead with direct changes: churn folds into the dependency it came with #343's alias test).npm run tools -- test packages/renderers/graph: 50 pass.Browser, Chromium desktop, through the harness config (
npx playwright test -c packages/renderers/harness/playwright.config.ts --project chromium-desktop):graph.spec.ts"16 reports removed together fold into one card…" passes. It covers the card's label and aliases, host selection and hover ringing the card, opening and closing it with no selection reported, in animated and diff modes, andfocus: {id}on a folded report.massRemovalpair (1% steps both ways, plus 0.5% through the first window) passes with no overlaps, detached arrows or framing changes, and the endpoints show their revisions. The suite now counts items a card presents indata-entity-aliases.file reflowandwide fan-outstill pass.card-grid.spec.ts(3 cases: the removed fold in diff and transition modes, and the unchanged band in and out of the Changes scope) passes.graph/mass-removal(checks.spec.ts, run locally on Chromium, since the sharding gives it the WebKit project) pass.Starter renderer (
packages/cli, scaffolded, installed and built):starter.spec.tspasses the built-in checks for the newcatalogand existingsplitscenarios and the new band test.starter-repository.spec.tspasses with three scenarios.I checked the frames in the renderer gallery at desktop width in diff mode, with the fold both closed and open. I didn't run WebKit, the phone projects or the full harness suite locally.
Documentation that this change affects is updated, and generated reference
pages are regenerated (
npm run docs:generate). The renderer kit graph and components guides and the testing README describe the folds and the check changes. No generated pages are affected.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.