Skip to content

Side-by-side panes mark their side's changes with the diff's vocabulary - #417

Open
agorischek wants to merge 5 commits into
mainfrom
kit/side-by-side-vocabulary
Open

agorischek wants to merge 5 commits into
mainfrom
kit/side-by-side-vocabulary

Conversation

@agorischek

Copy link
Copy Markdown
Collaborator

What changed

One vocabulary of change across every comparison mode, drawn by the kit so every renderer gets it. A green card means added everywhere.

  • Kit: a held pane is a static comparison that marks only its side's changes. Before marks removed and modified items, After added and modified ones, and unchanged items are neutral in both. stepEmphasis gives the other side's changes no emphasis (paneShows, paneChange), and the shell provides the pane to components (HeldPane / useHeldPane, and data-pane on the .pk root).
  • Kit: the same status border, band and tint in every mode. EntityCard is now a change region (pk-region, data-change) while emphasized in the diff, a transition and a held pane alike: its border, tint and footer band in its change's hue. Before, a pane's card drew a 3 px leading stripe and a hued band on a grey border. At no emphasis (animated progress 0 and 1) it is drawn exactly as an unchanged card.
  • Kit: values differ by mode, and only there. In a held pane ValueMark, ValueList, Fact, ValueChange, ValueText, SvgValueChange, Chip and MatrixGrid show only their side's value in the change's hue (modified in amber in both panes), with no sign and no strikethrough, whatever sign says. The diff keeps old → new with signs and strikethrough.
  • Neutral endpoints apply only to animated mode. Held panes get the host's highlighting for their side's changes, never the endpoint rule.
  • Per-renderer special cases removed. github-actions drops shownMark's emphasis gate and emphasisIn (values.tsx), the sign={frame.side === 'diff'} props, and the strength threaded through matrix.tsx only to gate marks; agentic-workflows drops its "pane's hue" rewrite of modified entries into removed/added and its sign/marked gating (card.tsx); api tones a pane's signature by its change (modified in amber) with no +/− instead of Before red and After green (signature-view.tsx).
  • Checks (@githubnext/projections-renderer-testing). neutral-endpoints and quiet-endpoints run only for a renderer with animated mode. status-text now expects Before to name its removals and changes and After its additions and changes. A new pane-marks check (probe call paneMarks) loads each held pane with highlighting and fails when Before marks something added or After something removed (in status words, edge or band), or when a changed card's edge (all the way round) and the band behind its status words disagree, such as a tinted band on a neutral border or a stripe beside it. Pills and tags (no taller than a chip) are only held to the side rule.
  • Docs. A "Comparison modes" section in develop-a-renderer.md and change-emphasis.md; the checks list, the testing README and the regenerated kit reference follow.

Refs #373

Agreement with in-flight work

  • kit/status-badges-keep-colour (no PR yet): consistent. Only containers go neutral when they hold coloured descendants, and the kit's nesting rule still neutralizes a pane's card holding changed values. pane-marks reads a card's band only from surfaces spanning the card, so a status badge that keeps its colour inside a neutral card isn't mistaken for a band. Overlap: both edit styles/nesting.css (this PR adds .pk-svg-own, a pane's SVG value, to its selector lists) and the checks list in develop-a-renderer.md, so whichever lands second rebases those hunks.
  • kit/chip-sign-grows (no PR yet): consistent for the diff (signs whole) and animated mode (signs grow in place, neutral at the endpoints). One rule differs: that branch has stepSigns(…, 'before' | 'after') return 1, a whole sign in a held pane, and its change-emphasis.md says so. The approved strategy draws no signs in a pane, so stepSigns should return 0 for a held pane. Here Chip already ignores sign in a held pane, so a pane shows none either way. Overlap: both edit react/chip.tsx (that branch moves Chips out and reworks Chip; this PR adds the pane lines in Chip), styles/chips.css and change-emphasis.md.

Images

Side by side, before this change (left) and after (right), light and dark. The renderer bundles are built from this branch and drawn by the v0.3.3 CLI (PROJECTIONS_INSPECTOR_ASSETS). Before = main.

The sabbasi3-factory-lab/chrono-node-rs#529 repro: compare 2749e6e7..d0c4770 -p github-actions-jobs-v2-router --mode side-by-side --png. An added workflow: the After pane's cards had a green band and stripe on a grey border, and now have the diff's green border, tint and band.

Before After
github-actions before, light github-actions after, light
github-actions before, dark github-actions after, dark

The same range's ci workflow (-p github-actions-jobs-ci), a modified job holding a changed value. Its card stays neutral (no nested accents) in both panes, now without the stripe, and the value is amber with no sign.

Before After
ci before, light ci after, light
ci before, dark ci after, dark

API (packages/renderers/api/fixtures/dotnet-{before,after}.json). Modified signatures were red with − in Before and green with + in After; now each is amber in both panes with no sign. Removed stays red in Before only and added green in After only.

Before After
api before, light api after, light
api before, dark api after, dark

Dependencies (packages/renderers/graph/fixtures/npm-workspace-v{2,3}.json). The graph cards already drew the diff's vocabulary in panes, so the images are unchanged pixel for pixel. They are the reference the other renderers now match.

Before After
dependencies before, light dependencies after, light
dependencies before, dark dependencies after, dark

Evidence

  • npm run tools -- check --fast: passed (lint, typecheck, format, styles, considered, machines and the other fast gates).

  • npm run tools -- test packages/renderers/kit: passed (203 tests), with new tests for paneShows/paneChange/stepEmphasis in a pane, the pane-aware value components and EntityCard as a region in every mode.

  • npm run tools -- test for packages/renderers/github-actions, api, agentic-workflows, runtime-policy, gallery and testing: passed.

  • Every built-in scenario's renderer checks (harness/browser/checks.spec.ts, all 95 run in desktop Chromium, by temporarily pointing its three-project split at chromium-desktop; not committed): 95 passed once pane-marks was limited to cards (the database renderer's tags hang their status in a tab).

  • The new probe spec harness/browser/pane-marks.spec.ts: passed. It shows the probe reads a stripe card as band added/edge neutral, a region card as both added, and a badge as no band.

  • The renderer browser suites of github-actions, api, agentic-workflows, runtime-policy, kit, gallery, code-statistics, database and the harness's other specs: passed on chromium-desktop (847 passed; the 2 specs this PR updates then passed) and chromium-mobile (436 passed).

  • npm run docs:generate: regenerated docs/reference/renderer-kit.md.

  • Not run: WebKit projects (the cloud runner runs only Chromium here), the macOS and Windows suites, and the full tools check.

  • Documentation that this change affects is updated, and generated reference
    pages are regenerated (npm run docs:generate).

  • Fixes include a regression test.

  • A changelog fragment at changelog.d/<this PR's number>.md describes what
    users will notice, or the PR has the no changelog label (see
    changelog.d/README.md).

  • No credentials, private source or machine-specific paths are included.

agorischek and others added 5 commits December 5, 2026 01:01
…abulary

A held pane marks only the changes on its side (Before: removed and
modified; After: added and modified), with the same status border, band
and tint as the diff. Values show their own side's value in the change's
hue, with no signs and nothing struck through. The kit's marks read the
pane (HeldPane), so renderers drop their own pane special cases.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
… side

neutral-endpoints and quiet-endpoints run only for a renderer with
animated mode: a side-by-side or swipe pane is a static comparison.
status-text expects Before to name its removals and changes and After its
additions and changes. The new pane-marks check fails a pane that marks
the other side's arrivals or departures, or a changed card whose band and
edge disagree (a tinted band on a neutral edge).

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
… docs

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Pane filtering leaves incorrect footer and chip statuses visible or announced, while pane checks use the wrong comparison mode and can miss violations or report false failures.

6 open issues
What changed in this PR

This PR unifies change highlighting across Projections’ comparison modes, giving held panes the same visual vocabulary as diffs.

Changes:

  • Adds pane-aware highlighting and value rendering to shared kit components.
  • Removes renderer-specific pane treatments.
  • Adds pane checks, regression coverage, documentation, and changelog entries.
File Description
packages/​renderers/​testing/​test/​helpers.test.mjs Updates the check count.
packages/​renderers/​testing/​src/​types.ts Defines pane measurements and check identifiers.
packages/​renderers/​testing/​src/​probe.ts Registers the pane probe.
packages/​renderers/​testing/​src/​measure/​pane-marks.ts Measures pane status, borders, and bands.
packages/​renderers/​testing/​src/​measure.ts Exports pane measurements.
packages/​renderers/​testing/​src/​checks/​comparison/​status.ts Expects modified status in both panes.
packages/​renderers/​testing/​src/​checks/​comparison/​panes.ts Adds pane consistency checks.
packages/​renderers/​testing/​src/​checks/​comparison/​endpoints.ts Restricts endpoint checks to animation.
packages/​renderers/​testing/​src/​checks/​comparison.ts Registers pane checks.
packages/​renderers/​testing/​src/​checks/​catalog.ts Documents updated check contracts.
packages/​renderers/​testing/​README.md Explains mode-specific checks.
packages/​renderers/​kit/​test/​status.test.mjs Tests pane filtering and emphasis.
packages/​renderers/​kit/​test/​layout.test.mjs Updates card region expectations.
packages/​renderers/​kit/​test/​group.test.mjs Checks pane strikethrough exclusions.
packages/​renderers/​kit/​test/​facts.test.mjs Tests pane-aware values and cards.
packages/​renderers/​kit/​styles/​nesting.css Includes pane SVG values in nesting rules.
packages/​renderers/​kit/​styles/​matrix.css Excludes panes from matrix strikethrough.
packages/​renderers/​kit/​styles/​layout.css Unifies card borders and tints.
packages/​renderers/​kit/​styles/​diff.css Adds pane-aware text styling.
packages/​renderers/​kit/​styles/​chips.css Removes strikethrough in held panes.
packages/​renderers/​kit/​src/​react/​shell/​props.ts Documents pane emphasis behavior.
packages/​renderers/​kit/​src/​react/​shell/​kit-renderer.tsx Provides pane context and root attributes.
packages/​renderers/​kit/​src/​react/​shell/​frame.ts Defines held-pane context and hook.
packages/​renderers/​kit/​src/​react/​shell/​document.ts Limits pane emphasis to held comparisons.
packages/​renderers/​kit/​src/​react/​matrix-grid.tsx Filters matrix change marks by pane.
packages/​renderers/​kit/​src/​react/​layout-components.tsx Makes emphasized cards change regions.
packages/​renderers/​kit/​src/​react/​facts.tsx Adds pane-aware facts and value lists.
packages/​renderers/​kit/​src/​react/​diff-components.tsx Displays each pane’s own values.
packages/​renderers/​kit/​src/​react/​chip.tsx Filters chip marks and signs by pane.
packages/​renderers/​kit/​src/​react.ts Exports pane context APIs.
packages/​renderers/​kit/​src/​emphasis.ts Adds pane classification and emphasis filtering.
packages/​renderers/​harness/​browser/​pane-marks.spec.ts Tests pane border and band measurements.
packages/​renderers/​github-actions/​src/​values.tsx Delegates pane value treatment to the kit.
packages/​renderers/​github-actions/​src/​matrix.tsx Removes redundant emphasis plumbing.
packages/​renderers/​github-actions/​src/​job.tsx Updates matrix rendering arguments.
packages/​renderers/​api/​test/​api.test.mjs Tests signature hues and absent signs.
packages/​renderers/​api/​src/​signature-view.tsx Uses change hues for pane signatures.
packages/​renderers/​api/​browser/​api.spec.ts Updates pane signature browser expectations.
packages/​renderers/​agentic-workflows/​test/​agentic-workflows.test.mjs Tests values under held-pane context.
packages/​renderers/​agentic-workflows/​src/​card.tsx Removes renderer-specific pane marking.
packages/​renderers/​agentic-workflows/​browser/​agentic-workflows.spec.ts Supplies explicit pane identity.
docs/​reference/​renderer-kit.md Regenerates pane API documentation.
docs/​guides/​develop-a-renderer.md Explains comparison modes and pane checks.
docs/​guides/​change-emphasis.md Documents shared pane emphasis rules.
changelog.d/​417.md Announces renderer-author API changes.
changelog.d/​417-behaviour-changes.md Announces updated renderer checks.

Review effort: Balanced

Comment on lines +97 to +99
const pane = useHeldPane()
const change = paneChange(own, pane)
const sign = signed && !pane
Comment on lines +238 to +239
const region =
mark ?? (change && emphasis > 0 && isChanged(change) && (pane === undefined || paneShows(change, pane)) ? change : undefined)
if (!changedEntities(subject.comparison).length) throw new Skip('The comparison changes no entities.')
const failures: string[] = []
for (const pane of ['before', 'after'] as const) {
await driver.load(subject, {progress: pane === 'before' ? 0 : 1, highlighting: 1, pane})
Comment on lines +74 to +76
const found = node.textContent?.match(statusWords)
if (!found) continue
words.push(...found)
range.selectNodeContents(node)
wordBoxes.push(range.getBoundingClientRect())
}
if (!words.length) continue
Comment on lines +86 to +102
if (!ownPart(unit, element)) continue
const own = element.getBoundingClientRect()
const framing = sameBox(own, box)
// A band spans the item, as its tint does; a badge or pill holding the words is not the item's band.
const behindWords = own.width >= box.width - 2 * edgeSlack && wordBoxes.some(word => contains(own, word))
if (!framing && !behindWords) continue
// Text says a change in its hue; only what encloses the words is their band.
const text = element instanceof SVGTextContentElement
const sources: [CSSStyleDeclaration, boolean][] = [[getComputedStyle(element), false]]
if (element instanceof HTMLElement) {
for (const pseudo of ['::before', '::after']) {
const style = getComputedStyle(element, pseudo)
if (style.content !== 'none' && style.content !== 'normal') sources.push([style, true])
}
}
for (const [style, pseudo] of sources) {
if (framing) for (const family of edgeHues(element, style, hues)) if (isChange(family)) edge.add(family)

This branch has not been deployed

No deployments
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.

2 participants