Skip to content

feat(core): DiffViewer moves to Core - #13700

Open
ernestt wants to merge 5 commits into
mainfrom
feat/diffviewer-core
Open

ernestt wants to merge 5 commits into
mainfrom
feat/diffviewer-core

Conversation

@ernestt

@ernestt ernestt commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

User need

A code review surface (a pull request page, a review queue, an agent's proposed change) has to show what changed in each file: removed and added lines, syntax-highlighted, in one column or side by side, with room for review comments on any line. Core has CodeBlock's isDiff layer for a short diff inside prose, but no component for a whole file's change with line numbers, folds for very large changes, header actions, and comment rows. DiffViewer does that job in Lab, and Lab is canary-only with no stability promise, so a product cannot build on it. This PR moves DiffViewer to Core, where it ships on latest as a stable component.

Problem and solution fit

  • Primary: DiffViewer, parseUnifiedDiff, createDiffFile, and the diff model types move from packages/lab/src/DiffViewer/ to packages/core/src/DiffViewer/, exported from @astryxdesign/core/DiffViewer and the package root. Git reads the component, its utilities, their tests, and the showcase block as renames.
  • Supporting, each needed for the move to be complete:
    • Imports become Core-relative, and strings go through Core's component translator with registered English.
    • Core's stricter checks apply: ReadonlyArray types, …Ref names, isRenderable guards, a host-data-attribute fixture, the supporting role's leading on the message row, no 'use client' on the pass-through barrel, and doc prop descriptions that name the literal values their types hide. The moved source cites no claim ids any more, so its comment-provenance baseline entry goes, and the record links those claims instead.
    • The Lab entry re-exports the Core exports. It carries no deprecation marker until an owner decides one (the record's OQ1).
    • The header's caller slot is endContent, the name Core gives this slot on CodeBlock and Banner (architecture:public-component-api INV2, DEC-1), in place of Lab's headerEnd.
    • DiffViewer renders no data-diff-* attribute of its own. A data attribute outside data-astryx-* is public surface (architecture:public-component-api DEC-2), and Lab's seven hooks (change, pane, line-button, bar, sizer, split, fold) only served tests. The tests now find those parts by role, name, and structure, and the perf sandbox page watches for the root's astryx-diff-viewer class. Changed code cells keep data-diff="added" or "removed", the attribute CodeBlock's diff rows already carry.
    • The stories move to Core/DiffViewer. The two Chromium specs and the RTL target take the new story ids.
    • The showcase block moves to the CLI's component blocks, beside a new "Viewed files" example, so DiffViewer has a showcase and an example. The sandbox's route list gains both.
    • The ShadCN route moves to components/diff-viewer and keeps components/lab/diff-viewer as an alias. The probe theme covers the three targets.
    • The code review keyword goes. In Core, a component's keywords tell astryx build which ideas name a part, and "review" turned "quarterly business review" into a DiffViewer part. Search still finds DiffViewer through diff, patch, and its description.
    • Translator descriptions drop "lab". component:CodeBlock names DiffViewer without "Lab" in all four places: an ownership line, FR13, a verification cell, and DEC-4. The DiffViewer perf page's header no longer calls it the Lab DiffViewer.
    • The new component:DiffViewer record, a Core Changeset, and a CLI Changeset for the blocks.

Current specification

  • Based on main. DiffViewer's collapsible came from feat(DiffViewer): one collapsible prop configures the file disclosure, as on Banner #13699, now on main as 0c9df81, decided by architecture:public-component-api INV19 and INV21.
  • component:DiffViewer (new, authority: draft) records the contract this PR ships: FR1–FR15, AR1–AR4, and DEC-1. Each row rests on DiffViewer's documented props and tests and on current records: component:CodeBlock FR12, FR13, and DEC-1 (languages and syntax slots), and spec:AST-025 (scroll areas). It states one requirement gap, spec:AST-094 FR42 (coarse-pointer hit areas, open finding 2), and one open question, OQ1: whether the Lab re-exports are deprecated, and when they are removed. It needs an engineering owner's /approve-spec. DEC-1's decider line reads "pending engineering-owner approval", and owners lists the schema's approval owners; please confirm or change both.
  • Every row of the API delta is decided by that draft record, so under INV25 the rows go to an owner until it is approved.

Public delta and caller burden

  • New Core exports: DiffViewer, parseUnifiedDiff, createDiffFile, and the types DiffViewerProps, DiffViewerViewMode, DiffViewerChangeIndicator, DiffViewerInlineHighlight, CreateDiffFileOptions, DiffViewerFile, DiffViewerFileStatus, DiffViewerHunk, DiffViewerLine, DiffViewerLineKind, DiffViewerLineRef, and DiffViewerSide.

  • Props: file, viewMode, language, codeLanguages, hasLineNumbers, isWrapped, changeIndicator, inlineHighlight, hasChangeBackground, collapsible, endContent, renderLineAnnotation, onLineNumberClick, maxHeight, syntaxTheme, a root ref, and BaseProps. Defaults are unchanged.

  • Theme targets: diff-viewer (reflects viewMode), diff-viewer-header, and diff-viewer-path, as in Lab.

  • Callsite:

    // Before (Lab)
    import {DiffViewer, parseUnifiedDiff} from '@astryxdesign/lab';
    <DiffViewer file={file} headerEnd={<ViewedCheckbox />} />
    // After
    import {DiffViewer, parseUnifiedDiff} from '@astryxdesign/core';
    <DiffViewer file={file} endContent={<ViewedCheckbox />} />
  • Behavior is unchanged except two small effects of Core's rules:

    • An endContent of false, true, or '' leaves no empty wrapper in the header, and a file with no path and nothing in endContent renders no header (Core's nullish-JSX lint; FR1).
    • The binary and no-change message takes the supporting role's leading (Core's text-role leading check). Each message row is about 3 px taller; every row above them stays pixel-identical (multi-file screenshot below).
  • Lab: the @astryxdesign/lab exports re-export the Core ones (FR14), so Lab callers get Core's API, endContent included. They carry no @deprecated marker: deprecating and removing them waits for an owner decision (OQ1).

  • Size: @astryxdesign/core/DiffViewer alone bundles to 88.1 kB gzip of JavaScript (minified, React and StyleX external), most of it the CodeBlock tokenizer and syntax layer; next to CodeBlock it adds 12.8 kB. Only an importer pays it, as with the Lab component.

Design and alternatives

  • A real move, as the lab → core gate asks: the implementation leaves Lab, and Lab keeps a plain re-export of the Core exports.
  • The showcase block keeps its name, so its registry route stays the same.
  • Rejected: keeping code review as a keyword and changing the CLI's build test instead, because "performance review" and "quarterly business review" would then start as DiffViewer parts.

Evidence

Before and after in a real browser

Re-checked at aa7000e, the head with the review fixes: all 16 states below are pixel-identical to these screenshots, and no story renders a data-diff-* attribute.

Chromium 155, static Storybook builds of #13699's head (Lab/DiffViewer, the code now on main) and of this branch (Core/DiffViewer), each an element screenshot of #storybook-root. Every pair below is pixel-identical (pixelmatch, threshold 0), except the multi-file patch: its rows are identical down to the first message row (y = 1017), and then the two message rows are about 3 px taller each.

State Before (Lab) After (Core)
Default, light before after
Split, dark before after
Multi-file patch (message rows) before after
Forced colors, bars before after

The promotion's state matrix, each with its before pair (identical): default dark, Y2K theme, Gothic theme, split light, display options, review comments, large change, folded, right-to-left page, collapsed, viewed and folded, 320 px, and touch, 390 px, pointer: coarse matched. Every before image sits beside its after image under the same name with core-before-.

Accessibility Checklist, item by item

  • Name. The disclosure is named by its path; line-number buttons by "Original line N" or "Changed line N"; the fold button by "Show full diff" or "Hide full diff"; the scroll area by the path, else "Diff"; each split pane by "Original code" or "Changed code".
  • Role. Disclosure for the file header of a file with a path, unless collapsible is false; Table for the hunks, with screen-reader column headers; and Button for the line numbers when onLineNumberClick is set, and for the fold of a large change.
  • State. Open and collapsed are aria-expanded. Added and removed are a hidden "Added" or "Removed" label on every changed line, beside the glyph or bar when changeIndicator shows one, never colour alone. No loading, selected, or disabled state exists, so the busy item does not apply.
  • Keyboard. Every control is a native button (Enter and Space), and each line-number button is its own Tab stop with no arrow-key movement, so no roving-focus pattern applies. A scroll area takes focus while it overflows (spec:AST-025). The hunk area stays left to right in RTL, and no arrow keys are handled.
  • Focus. No overlay. Collapsing from the header keeps focus on the header button, and the fold button stays in place when it toggles. Rings come from the shared focus outline.
  • Announcements. No async state, so not applicable.
  • Reduced motion. The chevron's turn is 0s under prefers-reduced-motion: reduce.
  • Contrast and themes. Measured on rendered colours, composited over their real backdrops: 7,220 text runs and change bars over seven stories in Neutral light, Neutral dark, Y2K, and Gothic (dark-only). Every pair meets 4.5:1 for text and 3:1 for the bars, except one pair that needs an owner decision (below). Rest states were measured; hover and focus-visible paint come from the shared Button, Token, and focus outline and were not re-measured here. No WCAG exception is claimed.
  • Forced colors. Bars paint as CanvasText borders, and a tint-only change gets the bar (DiffViewerForcedColors.a11y.chromium.spec.ts, 5 cases). Glyphs are text.
  • i18n. Every visible and assistive-technology string is an @astryx.diffViewer.* catalog key through Core's component translator.
  • Target size. Line-number buttons take presses across at least 24 px of width (DiffViewer.a11y.chromium.spec.ts, LTR and RTL). The disclosure button is 20 px tall and as wide as its path; it meets WCAG 2.5.8 through the spacing exception, because a 24 px circle on it reaches no other target (the hunk header row sits between it and the first line number, and endContent sits at the far end of the row). The fold button is a 28 px Button. Under a coarse pointer, the disclosure and line-number buttons keep their own box, with no hit area toward 44 px (second open finding).

Open findings for an owner.

  1. In Gothic, the header's line counts take Gothic's --color-text-green and --color-text-red, rgb(36 64 35) and rgb(74 37 32), on its header surface, rgb(16 19 20): 1.6:1 for +10 and 1.4:1 for −8 (see the Gothic screenshot). The counts are hidden from assistive technology, which hears the full sentence, but they are visible content. The pair is the same in Lab today. Gothic sets its hue text tokens dark, for text on its pastel fills (its --color-on-error-muted is var(--color-text-red)), while DiffViewer sets hue text on a surface, as the token's name suggests. Whether Gothic's hue text tokens change or DiffViewer's counts take another role is a theme or design decision, so this PR leaves it open.
  2. spec:AST-094 FR42 asks that a touch target grow toward 44 × 44 px under a coarse pointer, through an invisible hit area, up to halfway to a neighbor. DiffViewer's disclosure button and line-number buttons are raw buttons without the shared hit area, as in Lab, so they keep their own box; the fold button is a Core Button and has it. The record states this as an FR42 gap. Adding the hit area is new behavior beyond the move, so it belongs in its own pull request if an owner wants it before or after graduation.

Audits on this branch

  • axe, .github/scripts/accessibility-audit.js --components DiffViewer with the baseline gate: 15 stories, 0 violations.
  • pnpm rtl:audit --filter DiffViewer: RTL-ready; 1 pass, 0 fail, 0 surprise; coverage 1 measured, 0 gap.
  • Chromium specs DiffViewer.a11y and DiffViewerForcedColors.a11y against the Core build: 7 passed.

Lifecycle evidence

Scope

Components: DiffViewer, parseUnifiedDiff, createDiffFile, CreateDiffFileOptions

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

docs/specs/components/DiffViewer/DiffViewer.spec.md (new):

  • R1 narration: none; every section states what the component does.
  • R2 research in the record: none.
  • R3 evidence naming a change: none; basis cells name documented promises, tests, standards, and records.
  • R4 rejected alternatives: one, inside DEC-1, one line.
  • R5 pull request or issue references: none.
  • R6 ruled open questions still listing options: none; OQ1 is unanswered and lists no options.
  • R7 project status: none. "Released default preserved: not yet released" is the template's own value for that lifecycle field, and the draft review state column is a template field too.

docs/specs/components/CodeBlock/CodeBlock.spec.md: an ownership line, FR13, a verification cell, and DEC-4 drop "Lab" before DiffViewer. R1–R7: none.

Testing

  • pnpm test:ui and pnpm test:node: 1,173 files and 28,019 tests passed in the UI project; 1,944 files passed and 15 skipped in the Node project (30,573 tests passed, 3 expected failures, 111 skipped, 1 todo).
  • pnpm vitest run packages/core/src/DiffViewer packages/lab/src/DiffViewer: 97 passed.
  • Typecheck: Core (sharded, and docs), Lab, and Storybook clean; the sandbox reports no DiffViewer error.
  • ASTRYX_STRICT_LINT=1 eslint and Prettier on the changed files: clean.
  • pnpm review:pre: 0 findings. pnpm check:knowledge and pnpm check:repo: clean.
  • The route lock and the probe theme are exact: node apps/docsite/scripts/generate-data.mjs and pnpm visual:probe-theme:check pass without regenerating.
  • astryx component DiffViewer --dense answers from Core, and astryx template --list lists both blocks.
  • pnpm storybook:build, then the screenshots, specs, and audits above.

Rebased onto main at a2d5ef4, dropping #13699's commit. The only conflict was the astryx search close golden count, which main had moved from 52 to 54; with DiffViewer it is 55, and the golden test confirms it. Apart from those two lines, the pull request's diff is unchanged (patch-ids match). The screenshots above predate the rebase; local runs used the rebased tree.

822f712 changes only record prose (CodeBlock's FR13 and DEC-4) and the perf page's header comment. On it, merged onto main at 5d14a16 (clean): pnpm check:knowledge --base origin/main, pnpm check:repo, pnpm review:pre (0 findings), Prettier, and the DiffViewer and perf-page tests (121) pass.

60d2826 changes only wording: the Core changeset and the record's Behavior summary row now give the file header and its disclosure only to a file with a path, as FR1 and FR7 do. Its content was validated merged onto main at 4d07b8a (clean): pnpm check:changesets, pnpm check:knowledge --base origin/main, pnpm check:repo, pnpm review:pre (0 findings), Prettier, and 311 DiffViewer, Lab, doc-literal, and host-attribute tests pass. The head merges cleanly into main at 25e3032.

aee7438 changes only wording: the Core changeset names the status token for an added, deleted, or renamed file and the line counts when lines changed, and the record's FR1 shows the counts only when any line was added or removed. On it, merged onto main at 01dcc33 (clean): pnpm check:changesets, pnpm check:knowledge --base origin/main, pnpm check:repo, pnpm review:pre (0 findings), and Prettier pass.

@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Dec 2, 2026 7:19pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 24, 2026
@astracat-bot

astracat-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Dec 2, 2026, 7:35 PM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not ready to approve: the new component:DiffViewer record is still a draft, so DiffViewer's Core API and behavior wait on an engineering owner's decision, and the blocking findings below need fixes either way.

Owner decision. Approval needs an engineering owner to approve docs/specs/components/DiffViewer/DiffViewer.spec.md as written (its Core exports, props and defaults, FR1–FR15, AR1–AR4, DEC-1, owners, and the stated FR42 coarse-pointer gap) or say what must change, by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

Blocking findings

  • data-diff-change (packages/core/src/DiffViewer/DiffViewer.tsx:723) is public surface (architecture:public-component-api DEC-2): name it in a current record that says why, or drop it from the source (tests can query by role) or move it to a private data-astryx-* attribute under INV23.
  • data-diff-pane (packages/core/src/DiffViewer/DiffViewer.tsx:1246) is public surface (architecture:public-component-api DEC-2): name it in a current record that says why, or drop it from the source (tests can query by role) or move it to a private data-astryx-* attribute under INV23.
  • data-diff-line-button (packages/core/src/DiffViewer/DiffViewer.tsx:1528) is public surface (architecture:public-component-api DEC-2): name it in a current record that says why, or drop it from the source (tests can query by role) or move it to a private data-astryx-* attribute under INV23.
  • data-diff-bar (packages/core/src/DiffViewer/DiffViewer.tsx:1571) is public surface (architecture:public-component-api DEC-2): name it in a current record that says why, or drop it from the source (tests can query by role) or move it to a private data-astryx-* attribute under INV23.
  • data-diff-sizer (packages/core/src/DiffViewer/DiffViewer.tsx:1966) is public surface (architecture:public-component-api DEC-2): name it in a current record that says why, or drop it from the source (tests can query by role) or move it to a private data-astryx-* attribute under INV23.
  • data-diff-split (packages/core/src/DiffViewer/DiffViewer.tsx:1997) is public surface (architecture:public-component-api DEC-2): name it in a current record that says why, or drop it from the source (tests can query by role) or move it to a private data-astryx-* attribute under INV23.
  • data-diff-fold (packages/core/src/DiffViewer/DiffViewer.tsx:2024) is public surface (architecture:public-component-api DEC-2): name it in a current record that says why, or drop it from the source (tests can query by role) or move it to a private data-astryx-* attribute under INV23.
  • The new Core prop headerEnd (DiffViewer.tsx:216) names the slot Core already calls endContent, as CodeBlock does (CodeBlock.tsx:649), so rename it to endContent (INV2, DEC-1).
  • Lab callers of DiffViewer start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:36), which needs an explicit owner decision for DiffViewer; Found by: deprecation rule.
  • Lab callers of parseUnifiedDiff start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:42), which needs an explicit owner decision for parseUnifiedDiff; Found by: deprecation rule.
  • Lab callers of createDiffFile start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:48), which needs an explicit owner decision for createDiffFile; Found by: deprecation rule.
  • Lab callers of DiffViewerProps start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:54), which needs an explicit owner decision for DiffViewerProps; Found by: deprecation rule.
  • Lab callers of DiffViewerViewMode start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:60), which needs an explicit owner decision for DiffViewerViewMode; Found by: deprecation rule.
  • Lab callers of DiffViewerChangeIndicator start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:66), which needs an explicit owner decision for DiffViewerChangeIndicator; Found by: deprecation rule.
  • Lab callers of DiffViewerInlineHighlight start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:72), which needs an explicit owner decision for DiffViewerInlineHighlight; Found by: deprecation rule.
  • Lab callers of CreateDiffFileOptions start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:78), which needs an explicit owner decision for CreateDiffFileOptions; Found by: deprecation rule.
  • Lab callers of DiffViewerFile start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:84), which needs an explicit owner decision for DiffViewerFile; Found by: deprecation rule.
  • Lab callers of DiffViewerFileStatus start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:90), which needs an explicit owner decision for DiffViewerFileStatus; Found by: deprecation rule.
  • Lab callers of DiffViewerHunk start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:96), which needs an explicit owner decision for DiffViewerHunk; Found by: deprecation rule.
  • Lab callers of DiffViewerLine start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:102), which needs an explicit owner decision for DiffViewerLine; Found by: deprecation rule.
  • Lab callers of DiffViewerLineKind start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:108), which needs an explicit owner decision for DiffViewerLineKind; Found by: deprecation rule.
  • Lab callers of DiffViewerLineRef start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:114), which needs an explicit owner decision for DiffViewerLineRef; Found by: deprecation rule.
  • Lab callers of DiffViewerSide start seeing it marked deprecated and lose it next release (packages/lab/src/DiffViewer/index.ts:120), which needs an explicit owner decision for DiffViewerSide; Found by: deprecation rule.
  • parseUnifiedDiff (packages/core/src/DiffViewer/index.ts) is outside this pull request's scope (Components: DiffViewer): name it in the scope and get an owner decision, or split it into its own pull request.
  • createDiffFile (packages/core/src/DiffViewer/index.ts) is outside this pull request's scope (Components: DiffViewer): name it in the scope and get an owner decision, or split it into its own pull request.
  • CreateDiffFileOptions (packages/core/src/DiffViewer/index.ts) is outside this pull request's scope (Components: DiffViewer): name it in the scope and get an owner decision, or split it into its own pull request.

Non-blocking: a path-less file with headerEnd={false} still renders an empty header bar (DiffViewer.tsx:2073), and the record's "not yet released in Core" line (DiffViewer.spec.md:73) is temporary status. This pull request lands after #13699.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claims: DiffViewer, its two utilities and its types export from the new Core entry and the package root — verified.
  • Claims: imports are Core-relative and strings use Core's component translator — verified.
  • Claims: Core's stricter checks (readonly array types, ref names, renderable guards, host attribute fixture, message leading, doc literal values) apply — verified.
  • Claims: the moved source cites no claim ids and its baseline entry is removed — verified.
  • Claims: the Lab entry is a deprecated re-export with no runtime warning — verified in source; the deprecation decision itself is not cited (finding).
  • Claims: stories, Chromium specs and the RTL target use the Core story ids — verified.
  • Claims: the showcase block moves to the CLI blocks beside a new example, with sandbox routes — verified.
  • Claims: the registry route moves and keeps the Lab path as an alias; the probe theme covers the three targets — verified.
  • Claims: the keyword is removed and translator descriptions and the CodeBlock record drop the Lab wording — verified.
  • Claims: props and defaults are unchanged — verified.
  • Claims: a non-rendering header end leaves no wrapper — verified for the wrapper; the header row itself still renders for a path-less file (note).
  • Claims: message rows take the supporting leading — verified in source; the pixel height was not measured.
  • Claims: the three audit fixes are merged on main — verified.
  • Claims: the Lab package stays private and canary-only — verified.
  • Claims: bundle size, test counts, audits and browser runs — not reproduced here.
  • Claims: both changesets describe the change accurately — verified.
  • Files: .changeset/diffviewer-core-blocks.md — clear
  • Files: .changeset/promote-diffviewer-to-core.md — clear
  • Files: apps/sandbox/scripts/next-export-routes.json — clear
  • Files: apps/sandbox/src/app/(fullscreen)/pages/diffviewer-perf/benchmark.test.ts — clear
  • Files: apps/sandbox/src/app/(fullscreen)/pages/diffviewer-perf/page.tsx — clear
  • Files: apps/storybook/rtl-audit/targets.json — clear
  • Files: apps/storybook/stories/DiffViewer.stories.tsx — clear
  • Files: docs/specs/components/CodeBlock/CodeBlock.spec.md — clear
  • Files: docs/specs/components/DiffViewer/DiffViewer.spec.md — owner decision; note (temporary status)
  • Files: internal/eslint-plugin-astryx/no-comment-provenance.baseline.json — clear
  • Files: internal/shadcn-registry/routes.lock.json — clear
  • Files: packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerShowcase.doc.mjs — clear
  • Files: packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerShowcase.tsx — clear
  • Files: packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerViewedFiles.doc.mjs — clear
  • Files: packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerViewedFiles.tsx — clear
  • Files: packages/cli/test/__golden__/no-icon-set/search-close.json — clear
  • Files: packages/cli/test/__golden__/no-icon-set/search-close.txt — clear
  • Files: packages/cli/test/swizzle-proof/samples.mjs — clear
  • Files: packages/core/locales/en.json — clear
  • Files: packages/core/package.json — clear
  • Files: packages/core/src/DiffViewer/DiffViewer.doc.mjs — finding (prop name)
  • Files: packages/core/src/DiffViewer/DiffViewer.test.tsx — clear
  • Files: packages/core/src/DiffViewer/DiffViewer.tsx — finding (data attributes, prop name, empty header note)
  • Files: packages/core/src/DiffViewer/__tests__/DiffViewer.a11y.chromium.spec.ts — clear
  • Files: packages/core/src/DiffViewer/__tests__/DiffViewerForcedColors.a11y.chromium.spec.ts — clear
  • Files: packages/core/src/DiffViewer/createDiffFile.test.ts — clear
  • Files: packages/core/src/DiffViewer/createDiffFile.ts — clear
  • Files: packages/core/src/DiffViewer/diffTypes.ts — clear
  • Files: packages/core/src/DiffViewer/index.ts — finding (scope)
  • Files: packages/core/src/DiffViewer/inlineDiff.test.ts — clear
  • Files: packages/core/src/DiffViewer/inlineDiff.ts — clear
  • Files: packages/core/src/DiffViewer/parseUnifiedDiff.test.ts — clear
  • Files: packages/core/src/DiffViewer/parseUnifiedDiff.ts — clear
  • Files: packages/core/src/__tests__/hostDataAttributes.test.tsx — clear
  • Files: packages/core/src/index.ts — clear
  • Files: packages/lab/src/DiffViewer/index.test.ts — clear
  • Files: packages/lab/src/DiffViewer/index.ts — finding (deprecation decision)
  • Files: packages/themes/probe/src/probeTheme.ts — clear

Automated review (maintainer link)

Comment thread packages/lab/src/DiffViewer/index.ts Resolved
Comment thread packages/core/src/DiffViewer/index.ts Resolved
@ernestt

ernestt commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Review fixes are in aa7000e, on this pull request only; #13699 is unchanged.

Data attributes (DEC-2). data-diff-change, data-diff-pane, data-diff-line-button, data-diff-bar, data-diff-sizer, data-diff-split, and data-diff-fold are dropped from the source. They only served tests. The unit tests and the line-number Chromium spec now find those parts by role, name, and structure, and the DiffViewer perf sandbox page watches for the root's astryx-diff-viewer class. At this head, no story renders a data-diff-* attribute.

headerEnd → endContent (INV2, DEC-1). Renamed in the component, its doc and anatomy, the record, the story, and the "Viewed files" block. The non-blocking note is fixed too: a file with no path and nothing renderable in endContent renders no header (new unit test).

Lab deprecation (15 findings). The Lab entry is now a plain re-export of the Core exports, with no @deprecated marker and no removal release. The record's FR14 states only the re-export, and a new open question, OQ1, leaves deprecating and removing it to an engineering owner.

Scope (3 findings). The description's scope line now names parseUnifiedDiff, createDiffFile, and CreateDiffFileOptions. The record's FR13 covers them, so the owner decision is the same /approve-spec on the record.

Record note. "Released default preserved" now reads "not yet released", the template's own value for that lifecycle field.

Still open for an engineering owner: /approve-spec on docs/specs/components/DiffViewer/DiffViewer.spec.md.

Validation, on this head merged onto main at cd18d28 (clean merge):

  • pnpm test:ui and pnpm test:node: 27,547 UI tests and 30,342 Node tests pass (3 expected failures, 108 skipped, 1 todo).
  • DiffViewer unit tests: 97 passed. Typecheck (Core, Lab, Storybook) and strict lint: clean. pnpm review:pre: 0 findings. pnpm check:knowledge: clean.
  • Storybook build: the 7 DiffViewer Chromium specs pass, axe finds 0 violations in 15 stories, and the RTL audit is clean.
  • All 16 screenshot states are pixel-identical to the earlier head's.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not ready to approve yet: the new component:DiffViewer record is still a draft, so DiffViewer's Core API and behavior wait on an engineering owner's decision.

What is needed next

  • An engineering owner reviews docs/specs/components/DiffViewer/DiffViewer.spec.md as written, including shipping in Core with its stated spec:AST-094 FR42 gap (the disclosure and line-number buttons grow no hit area toward 44 px under a coarse pointer), and answers its OQ1: whether the Lab re-exports are deprecated, and when they are removed.
  • The owner records the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

No blocking findings remain: the public data attributes, the headerEnd name, the undecided Lab deprecations, the scope line and the empty header are all fixed. One optional suggestion: the 38-line file header in DiffViewer.tsx repeats the docs and the record, and could keep only its @file, @input, @output and @position lines and the SYNC list.

CI has not run on this head yet, and this pull request lands after #13699.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Claim: The component, its utilities and model types move from Lab to Core and export from the DiffViewer subpath and the package root: verified.
  • Claim: The component, utilities, their tests and the showcase block move as renames: verified.
  • Claim: Imports become Core-relative and strings go through Core's component translator with registered English: verified.
  • Claim: Core's stricter conventions apply (readonly array types, ref names, renderable guards, a host data-attribute fixture, supporting leading on the message row, no client directive on the pass-through barrel, literal values named in doc props): verified.
  • Claim: The moved source cites no claim ids, so its comment-provenance baseline entry goes: verified.
  • Claim: The Lab entry re-exports the Core exports with no deprecation marker until an owner decides one: verified.
  • Claim: The header slot is endContent, the name CodeBlock and Banner use, in place of Lab's headerEnd: verified.
  • Claim: DiffViewer renders no data-diff-* attribute of its own; changed code cells keep the data-diff attribute CodeBlock already renders: verified.
  • Claim: Stories, both Chromium specs and the RTL target take the Core story ids: verified.
  • Claim: The showcase block moves to the CLI's component blocks beside a new Viewed files example, and the sandbox route list gains both: verified.
  • Claim: The ShadCN route moves and keeps the Lab path as an alias; the probe theme covers the three targets: verified.
  • Claim: The code review keyword is dropped: verified.
  • Claim: Translator descriptions and the CodeBlock record drop "Lab": verified.
  • Claim: The new record states FR1–FR15, AR1–AR4, DEC-1, one FR42 gap and one open question on the Lab deprecation, and needs an engineering owner's approval: verified (draft, unapproved).
  • Claim: The listed exports, props, unchanged defaults and three theme targets: verified against source.
  • Claim: Two behavior effects only: a non-renderable endContent leaves no wrapper and, with no path, no header; message rows take the supporting leading: verified in source; the 2.5 px measurement is the author's.
  • Claim: Lab callers get Core's API, endContent included: verified.
  • Claim: Bundle size, pixel-identical screenshots, contrast measurements, audit and test results: stated by the author, not rechecked here.
  • Claim: Lab stays private and canary-only; changesets are a component entry for Core and a docs entry for the CLI, neither breaking: verified.
  • Claim: Core changeset: entry points, rendering, non-colour change cues and the shared collapsible config: verified.
  • Claim: CLI changeset: the template listing gains the showcase and the Viewed files example, whose checkbox folds each file through collapsible: verified.
  • .changeset/diffviewer-core-blocks.md: clear (matches the two blocks)
  • .changeset/promote-diffviewer-to-core.md: clear (matches the Core entry and behavior)
  • apps/sandbox/scripts/next-export-routes.json: clear (two block routes)
  • apps/sandbox/src/app/(fullscreen)/pages/diffviewer-perf/benchmark.test.ts: clear (imports the Core utility)
  • apps/sandbox/src/app/(fullscreen)/pages/diffviewer-perf/page.tsx: clear (Core import; waits on the root class)
  • apps/storybook/rtl-audit/targets.json: clear (new story id)
  • apps/storybook/stories/DiffViewer.stories.tsx: clear (Core/DiffViewer, endContent)
  • docs/specs/components/CodeBlock/CodeBlock.spec.md: clear (two cells drop "Lab"; no requirement change)
  • docs/specs/components/DiffViewer/DiffViewer.spec.md: held: new draft record awaiting an engineering owner, with its FR42 gap and OQ1
  • internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear (drops the moved file's entry)
  • internal/shadcn-registry/routes.lock.json: clear (new route, Lab path kept as alias, example route)
  • packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerShowcase.doc.mjs: clear (template grade A)
  • packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerShowcase.tsx: clear (Core import; grade A)
  • packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerViewedFiles.doc.mjs: clear (template grade A)
  • packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerViewedFiles.tsx: clear (grade A)
  • packages/cli/test/__golden__/no-icon-set/search-close.json: clear (match count 52 to 53)
  • packages/cli/test/__golden__/no-icon-set/search-close.txt: clear (match count 52 to 53)
  • packages/cli/test/swizzle-proof/samples.mjs: clear (sample key moves to Core)
  • packages/core/locales/en.json: clear (descriptions drop "lab"; messages unchanged)
  • packages/core/package.json: clear (adds the ./DiffViewer entry)
  • packages/core/src/DiffViewer/DiffViewer.doc.mjs: clear (props, defaults and theme targets match the source)
  • packages/core/src/DiffViewer/DiffViewer.test.tsx: clear (queries by role and name; new empty-header case)
  • packages/core/src/DiffViewer/DiffViewer.tsx: non-blocking: the 38-line file header
  • packages/core/src/DiffViewer/__tests__/DiffViewer.a11y.chromium.spec.ts: clear (story id; buttons found by name)
  • packages/core/src/DiffViewer/__tests__/DiffViewerForcedColors.a11y.chromium.spec.ts: clear (story id)
  • packages/core/src/DiffViewer/createDiffFile.test.ts: clear (moved unchanged)
  • packages/core/src/DiffViewer/createDiffFile.ts: clear (header paths only)
  • packages/core/src/DiffViewer/diffTypes.ts: clear (header paths only)
  • packages/core/src/DiffViewer/index.ts: clear (entry exports)
  • packages/core/src/DiffViewer/inlineDiff.test.ts: clear (moved unchanged)
  • packages/core/src/DiffViewer/inlineDiff.ts: clear (header paths and type spelling)
  • packages/core/src/DiffViewer/parseUnifiedDiff.test.ts: clear (moved unchanged)
  • packages/core/src/DiffViewer/parseUnifiedDiff.ts: clear (header paths only)
  • packages/core/src/__tests__/hostDataAttributes.test.tsx: clear (adds the DiffViewer fixture)
  • packages/core/src/index.ts: clear (root re-export)
  • packages/lab/src/DiffViewer/DiffViewer.doc.mjs: clear (deleted; Core doc keeps the Lab route as alias)
  • packages/lab/src/DiffViewer/index.test.ts: clear (identity and props checks)
  • packages/lab/src/DiffViewer/index.ts: clear (plain re-export of Core)
  • packages/themes/probe/src/probeTheme.ts: clear (generated probe entries for the three targets)

Automated review (maintainer link)

* @output Exports DiffViewer component, DiffViewerProps, DiffViewerViewMode,
* DiffViewerChangeIndicator, DiffViewerInlineHighlight
* @position Lab implementation; read-only, syntax-highlighted file diff for
* @position Core implementation; read-only, syntax-highlighted file diff for

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: this file header now runs to 38 lines, and its behavior paragraph (lines 14–30) repeats DiffViewer.doc.mjs and the component record. The source-comment rule in architecture:knowledge-contracts (INV29) keeps a header to about 12 lines. Consider keeping @file, @input, @output, @position and the SYNC list, and dropping the paragraph.

@ernestt
ernestt changed the base branch from feat/diffviewer-collapsible to main November 30, 2026 21:39
DiffViewer, parseUnifiedDiff, createDiffFile, and the diff model types move
from Lab to Core, imported from `@astryxdesign/core/DiffViewer` or the
package root. The component keeps its props, defaults, and behavior. Core's
stricter rules bring two small visible changes: a `headerEnd` that renders
nothing (`false`, `true`, or an empty string) no longer leaves an empty
wrapper in the header, and the binary and no-change message takes the
supporting text role's leading.

The Lab exports become deprecated re-exports of the Core ones for one release.
The Storybook stories move to Core/DiffViewer, the showcase block moves to the
CLI's component blocks beside a new "Viewed files" example, and the ShadCN
registry keeps the Lab route as an alias. The new `component:DiffViewer`
record is a draft for an engineering owner's approval.
…plain Lab re-exports

Review fixes for the move to Core:

- The header's caller slot is `endContent`, the name Core gives this slot
  (CodeBlock, Banner), in place of `headerEnd`. A file with no path and
  nothing in `endContent` renders no header.
- DiffViewer renders none of the seven `data-diff-*` hooks Lab had
  (`change`, `pane`, `line-button`, `bar`, `sizer`, `split`, `fold`). A data
  attribute outside `data-astryx-*` is public surface, and these only served
  tests, which now find each part by role, name, and structure.
- The Lab entry re-exports the Core exports with no deprecation marker until
  an owner decides it (the record's OQ1).
@ernestt
ernestt force-pushed the feat/diffviewer-core branch from aa7000e to 14e9088 Compare November 30, 2026 22:34
@ernestt

ernestt commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main now that #13699 is merged (0c9df81). New head: 14e9088, on main at a2d5ef4.

  • feat(DiffViewer): one collapsible prop configures the file disclosure, as on Banner #13699's commit is dropped, and this pull request's two commits replay on top of main.
  • One conflict: the astryx search close golden (packages/cli/test/__golden__/no-icon-set/search-close.json and .txt). Main had moved the match count from 52 to 54. With DiffViewer it is 55, and the golden test passes with 55.
  • Nothing else changed. git range-diff shows the review-fix commit identical, and the move commit differing only in those two count lines. Patch-ids match for the fix commit, and for the move commit and the whole pull request with the two golden files left out.

Validation on the rebased tree:

  • pnpm test:ui: 28,019 tests passed. pnpm test:node: 30,573 passed, with 3 expected failures, 111 skipped and 1 todo.
  • DiffViewer unit tests: 97 passed.
  • ASTRYX_STRICT_LINT=1 eslint on the changed files: no errors.
  • pnpm review:pre: 0 findings. pnpm check:knowledge and pnpm check:repo: clean.
  • Builds and the Core, Lab and Storybook typechecks: clean.
  • The route lock and the probe theme are exact.

It merges cleanly into main, including the two newer commits at 61725ae. The description now says it is based on main.

Still open for an engineering owner: /approve-spec on docs/specs/components/DiffViewer/DiffViewer.spec.md, covering its OQ1 (whether the Lab re-exports are deprecated) and its FR42 gap.

@github-actions github-actions Bot added needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:spec-owner-review Current knowledge records await owner approval labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · aee7438

Storybook · Sandbox · built from this PR's head

Current run: Heavy CI deferred: runs when review passes and before merge. Lint, typecheck and any path-filtered checks ran on this push.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not ready to approve yet: DiffViewer's Core API and behavior are decided only by the new component:DiffViewer record, which is still a draft, and one description claim needs correcting.

Blocking

  • Miss: the description says component:CodeBlock names DiffViewer without "Lab", but its FR13 (docs/specs/components/CodeBlock/CodeBlock.spec.md:125) and DEC-4 (:248) still say "Lab's DiffViewer", so either say that two cells drop "Lab" or update those two lines under the same owner approval.

What is needed next

  • An engineering owner reviews docs/specs/components/DiffViewer/DiffViewer.spec.md as written, including shipping in Core with its stated spec:AST-094 FR42 gap (the disclosure and line-number buttons grow no hit area toward 44 px under a coarse pointer), and answers its OQ1: whether the Lab re-exports are deprecated, and when they are removed.
  • The owner records the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

Optional: the 39-line file header in DiffViewer.tsx could keep only its @file, @input, @output and @position lines and the SYNC list, and the sandbox perf page's header still says it evaluates "the Lab DiffViewer".

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Claim: Title: DiffViewer moves to Core: verified (packages/core/src/DiffViewer/, package.json ./DiffViewer, root index.ts).
  • Claim: The component, utilities and model types move from Lab to Core and export from the DiffViewer subpath and the package root: verified (packages/core/package.json, packages/core/src/index.ts, packages/core/src/DiffViewer/index.ts).
  • Claim: Git reads the component, utilities, their tests and the showcase block as renames: verified (rename entries in the changed-file list).
  • Claim: Imports become Core-relative and strings go through Core's component translator with registered English: verified (DiffViewer.tsx imports, registerEnglishFallback, useComponentTranslator).
  • Claim: Core's stricter checks apply: readonly array types, ref names, renderable guards, a host data-attribute fixture, supporting leading on the message row, no client directive on the Core barrel, literal values named in doc props: verified in source; typecheck and lint pass in CI.
  • Claim: The moved source cites no claim ids in comments, so its comment-provenance baseline entry goes: verified (no claim id in any moved file's comments; lint passes).
  • Claim: The Lab entry re-exports the Core exports with no deprecation marker: verified (packages/lab/src/DiffViewer/index.ts; identity test in index.test.ts).
  • Claim: The header slot is endContent, in place of Lab's headerEnd: verified (DiffViewer.tsx:216; no headerEnd caller remains; typecheck passes).
  • Claim: DiffViewer renders no data-diff-* attribute; Lab's seven hooks only served tests and the perf page; changed cells keep the data-diff attribute CodeBlock renders: verified (repository search finds none of the seven names at the head; at the base only Lab tests, the Chromium spec and the perf page read them; CodeBlock.tsx:526).
  • Claim: Stories, both Chromium specs and the RTL target take the Core story ids: verified.
  • Claim: The showcase block moves beside a new Viewed files example, and the sandbox route list gains both: verified.
  • Claim: The ShadCN route moves and keeps the Lab path as an alias; the probe theme covers the three targets; the showcase route stays the same: verified (routes.lock.json, probeTheme.ts).
  • Claim: The code review keyword goes; search still finds DiffViewer through diff, patch and its description: verified (doc keywords; search reads keywords).
  • Claim: Translator descriptions drop "lab": verified (packages/core/locales/en.json).
  • Claim: The CodeBlock record names DiffViewer without "Lab": false: FR13 and DEC-4 still say "Lab's DiffViewer".
  • Claim: The new record states FR1–FR15, AR1–AR4, DEC-1, one FR42 gap and one open question, and needs an engineering owner's approval: verified (draft, unapproved).
  • Claim: The listed exports, props, unchanged defaults and three theme targets: verified against source.
  • Claim: Only two behavior effects: a non-renderable endContent leaves no wrapper and, with no path, no header; message rows take the supporting leading: verified (isRenderable returns false for false, true and ''; annotation guards were already normalized; new header test); the 2.5 px figure is reported.
  • Claim: Lab callers get Core's API, endContent included: verified.
  • Claim: Accessibility checklist: names, roles, states, keyboard, focus, reduced motion and strings: verified in source and unit tests; contrast, target-size and forced-colors measurements are reported.
  • Claim: Lab stays private and canary-only; changesets are a Core component entry and a CLI docs entry, neither breaking: verified.
  • Claim: Core changeset: entry points, rendering, non-colour change cues and the shared collapsible config: verified (unit tests for default, collapsed, controlled and off).
  • Claim: CLI changeset: the template list gains the showcase and the Viewed files example: verified.
  • Claim: The pull request's diff is unchanged since the rebase apart from the two golden counts: verified (range-diff and patch-ids).
  • Claim: Bundle size, screenshots, contrast, audits, test runs, graduation vote and the CLI runs: reported.
  • .changeset/diffviewer-core-blocks.md: clear
  • .changeset/promote-diffviewer-to-core.md: clear
  • apps/sandbox/scripts/next-export-routes.json: clear (two block routes)
  • apps/sandbox/src/app/(fullscreen)/pages/diffviewer-perf/benchmark.test.ts: clear
  • apps/sandbox/src/app/(fullscreen)/pages/diffviewer-perf/page.tsx: non-blocking: header still says "Lab DiffViewer"
  • apps/storybook/rtl-audit/targets.json: clear
  • apps/storybook/stories/DiffViewer.stories.tsx: clear
  • docs/specs/components/CodeBlock/CodeBlock.spec.md: blocking: FR13 and DEC-4 still say "Lab's DiffViewer" against the description
  • docs/specs/components/DiffViewer/DiffViewer.spec.md: held: draft record awaiting an engineering owner, with its FR42 gap and OQ1
  • internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear
  • internal/shadcn-registry/routes.lock.json: clear
  • packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerShowcase.doc.mjs: clear (template grade A)
  • packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerShowcase.tsx: clear (grade A)
  • packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerViewedFiles.doc.mjs: clear (grade A)
  • packages/cli/assets/templates/blocks/components/DiffViewer/DiffViewerViewedFiles.tsx: clear (grade A)
  • packages/cli/test/__golden__/no-icon-set/search-close.json: clear (54 to 55)
  • packages/cli/test/__golden__/no-icon-set/search-close.txt: clear (54 to 55)
  • packages/cli/test/swizzle-proof/samples.mjs: clear
  • packages/core/locales/en.json: clear
  • packages/core/package.json: clear
  • packages/core/src/DiffViewer/DiffViewer.doc.mjs: clear
  • packages/core/src/DiffViewer/DiffViewer.test.tsx: clear
  • packages/core/src/DiffViewer/DiffViewer.tsx: non-blocking: 39-line file header
  • packages/core/src/DiffViewer/__tests__/DiffViewer.a11y.chromium.spec.ts: clear
  • packages/core/src/DiffViewer/__tests__/DiffViewerForcedColors.a11y.chromium.spec.ts: clear
  • packages/core/src/DiffViewer/createDiffFile.test.ts: clear
  • packages/core/src/DiffViewer/createDiffFile.ts: clear
  • packages/core/src/DiffViewer/diffTypes.ts: clear
  • packages/core/src/DiffViewer/index.ts: clear
  • packages/core/src/DiffViewer/inlineDiff.test.ts: clear
  • packages/core/src/DiffViewer/inlineDiff.ts: clear
  • packages/core/src/DiffViewer/parseUnifiedDiff.test.ts: clear
  • packages/core/src/DiffViewer/parseUnifiedDiff.ts: clear
  • packages/core/src/__tests__/hostDataAttributes.test.tsx: clear
  • packages/core/src/index.ts: clear
  • packages/lab/src/DiffViewer/DiffViewer.doc.mjs: clear (deleted; the Core doc keeps the Lab route as an alias)
  • packages/lab/src/DiffViewer/index.test.ts: clear
  • packages/lab/src/DiffViewer/index.ts: clear
  • packages/themes/probe/src/probeTheme.ts: clear (generated)

Automated review (maintainer link)

…DEC-4

DiffViewer lives in Core, so `component:CodeBlock` FR13 and DEC-4 name it
as `DiffViewer`, not Lab's, like the record's other two cells. The
DiffViewer perf page's header says the same.
@ernestt

ernestt commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the CodeBlock record miss in 822f712, on top of 14e9088 (a fast-forward, no rebase).

  • component:CodeBlock: FR13 and DEC-4 now name DiffViewer instead of "Lab's DiffViewer". With the ownership line and the verification cell this pull request already changed, the record no longer places DiffViewer in Lab anywhere. This is the same record this pull request already edits, so one /approve-spec on the head covers it. Prettier re-padded only the FR13 row, and no Decider or approved_by line changed.
  • Perf sandbox page (non-blocking note): its header now says it evaluates DiffViewer, not "the Lab DiffViewer".
  • Description: the supporting list and the writing rubric now name all four CodeBlock places, and Testing covers this commit.

The optional file-header trim in DiffViewer.tsx is left out. Lab had the same header, so trimming it isn't part of the move.

Validation on 822f712 merged onto main at 5d14a16 (clean merge): pnpm check:knowledge --base origin/main, pnpm check:repo, pnpm review:pre (0 findings), Prettier, and the DiffViewer and perf-page tests (121) pass. The commit changes only record prose and a comment.

Still open for an engineering owner: /approve-spec on the head, covering docs/specs/components/DiffViewer/DiffViewer.spec.md, its OQ1 and FR42 gap, and the CodeBlock lines above.

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not ready to approve yet: DiffViewer's Core API and behavior are decided only by the new component:DiffViewer record, which is still a draft, and the Core changeset needs one wording fix.

Owner decision needed. An engineering owner approves or amends the draft record, including its coarse-pointer hit-area gap (spec:AST-094 FR42) and OQ1 (whether the Lab re-exports are deprecated, and when they are removed), by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

Blocking:

  • Miss: the Core changeset (.changeset/promote-diffviewer-to-core.md) says DiffViewer shows a file header with the path and that the header is a disclosure that starts open, but a file with no path (a bare hunk from parseUnifiedDiff, or createDiffFile without path) renders no header, or a header without a disclosure when endContent renders, and collapsible does nothing for it (DiffViewer.tsx:1345), so say "when the file has a path", as the record's FR1 and FR7 do, and qualify the description's "Disclosure for the file header" line the same way.

The DiffViewer and Lab unit tests (97) pass in a local run, and in local captures the default, split, viewed-toggle and review-comments stories render pixel-identically to Lab's while the message rows grow by about 3 px each. The file-header length note from the earlier review still stands as a non-blocking suggestion.

Claims and files checked

Review mode: same-head; reason: none

  • changed rules (1): Claim bounding in one round — finding: the Core changeset's header and disclosure sentence (blocking, above); every case listed: a path-less file with no end content (no header), one with end content (no disclosure), and any path-less file (the collapsible setting is inert)
  • Claim, title: DiffViewer moves to Core — verified (Core entry point, root export, package exports map)
  • Claim, Core changeset: imports from the Core entry and root with the parser, differ and model types — verified; header with path and a disclosure that starts open — false for path-less files (blocking); every changed line reads as added or removed without colour, also under forced colors — verified (hidden label in every indicator mode, forced-colors bar for tint-only changes); the collapsible setting takes the same config as Banner and Collapsible — verified
  • Claim, CLI changeset: the template list shows the showcase and the new Viewed files block — verified from the block files and route lists
  • Claim: the component, utilities, tests and showcase block move as renames — verified (file list)
  • Claim: Core-relative imports, component translator with registered English — verified
  • Claim: Core's stricter checks (read-only arrays, ref names, renderable guards, host data-attribute fixture, supporting leading on the message row, no client directive on the Core barrel, literal values in doc prop descriptions, no claim ids in source, baseline entry removed) — verified
  • Claim: the Lab entry re-exports Core with no deprecation marker — verified (Lab index and its test)
  • Claim: header slot renamed to the system's end-content name — verified
  • Claim: DiffViewer renders no data-diff-* attribute of its own; the seven hooks served tests and the perf page; changed code cells keep the shared diff attribute — verified (repository search; 0 hooks on head stories, 7 to 40 on base stories, captured here)
  • Claim: stories, Chromium specs and RTL target take the Core story ids — verified
  • Claim: showcase and example blocks, sandbox route list, ShadCN route with Lab alias, probe theme for three targets — verified
  • Claim: the review keyword goes; search still finds DiffViewer by diff and patch — verified (doc keywords)
  • Claim: translator descriptions and the CodeBlock record no longer say Lab in four places; perf page header updated — verified
  • Claim: new draft record with FR1–FR15, AR1–AR4, DEC-1, an FR42 gap and OQ1; decider pending — verified
  • Claim: 12 new types, 15 props, defaults unchanged, three theme targets as in Lab — verified (source)
  • Claim: behavior unchanged except the empty end-content header and the message-row leading — verified (whole component diff read; the annotation guard change is behavior-neutral)
  • Claim: message rows 2.5 px taller, rows above pixel-identical — reported; measured here as about 2.9 px with rows above identical
  • Claim: bundle size figures, contrast measurements, axe, RTL audit, Chromium spec runs, test totals, screenshots — reported
  • Claim: Lab package stays private and canary-only; neither changeset is breaking — verified
  • Claim: the last commit changes only record prose and the perf page comment — verified
  • Files: all 39 changed files visited; .changeset/promote-diffviewer-to-core.md — finding above; packages/core/src/DiffViewer/DiffViewer.tsx — non-blocking header-length note; every other file — clear

Automated review (maintainer link)

…le header to a file with a path

A file with no path (a bare hunk, or `createDiffFile` without `path`) has
no path in its header and no disclosure, and `collapsible` does nothing for
it. The Core changeset and the summary row of `component:DiffViewer` now
say "when the file has a path", as the record's FR1 and FR7 do.
@ernestt

ernestt commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the Core changeset wording in 60d2826, on top of 822f712 (a fast-forward, no rebase).

  • Core changeset: the file header and its disclosure now belong only to a file with a path: "When the file has a path, a file header above the hunks shows the path, status, and line counts, and is a disclosure that starts open". The record's FR1 and FR7 say the same. A file with no path (a bare hunk, or createDiffFile without path) gets no disclosure, and collapsible does nothing for it.
  • Record: the Behavior row of component:DiffViewer's summary table now says the same; FR1 and FR7 already did. It is the same record, so one /approve-spec covers it.
  • Description: the accessibility checklist's Role item reads "Disclosure for the file header of a file with a path". The message-row growth reads "about 3 px", to match the 2.9 px measured here. Testing covers this commit.

Validation, on this content merged onto main at 4d07b8a (clean):

  • pnpm check:changesets, pnpm check:knowledge --base origin/main, pnpm check:repo and Prettier: clean.
  • pnpm review:pre: 0 findings.
  • DiffViewer, Lab, doc-literal and host-attribute tests: 311 passed.

The head also merges cleanly into main at 25e3032.

The optional file-header trim stays out, as before.

Still open for an engineering owner: /approve-spec on the head. It covers docs/specs/components/DiffViewer/DiffViewer.spec.md (its OQ1 and FR42 gap) and the CodeBlock lines.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not ready to approve yet: DiffViewer's Core API and behavior are decided only by the new component:DiffViewer record, which is still a draft, and the Core changeset needs one more wording fix.

Owner decision needed. An engineering owner approves or amends the draft record, including its coarse-pointer hit-area gap (spec:AST-094 FR42) and OQ1 (whether the Lab re-exports are deprecated, and when they are removed), by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

Blocking:

  • Miss: the Core changeset (.changeset/promote-diffviewer-to-core.md) says that for a file with a path the header "shows the path, status, and line counts", but a modified file shows no status (the token renders only for an added, deleted or renamed file, DiffViewer.tsx:2094) and a binary or no-change file shows no line counts (DiffViewer.tsx:2097), so say "a status token for an added, deleted, or renamed file, and the line counts when lines changed", and bound the record's FR1 counts the same way.

The path-less header wording from the last review is fixed, and in a local run the DiffViewer, Lab and host data-attribute tests pass while local Storybook captures show seven stories pixel-identical to Lab's and only the two message rows about 3 px taller.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Title: DiffViewer moves to Core — verified (Core entry point, root export, exports map)
  • Core changeset: imports from the Core entry and root with the parser, differ and model types — verified; read-only highlighted diff with annotation rows, line-number buttons and folds — verified; every changed line reads as added or removed without colour, also under forced colors — verified (hidden label in every indicator mode, forced-colors bar for tint-only changes, tests pass locally); header of a file with a path shows path, status and line counts — false for modified files (no status) and binary or no-change files (no counts), blocking; that header is a disclosure that starts open, configured like Banner's collapsible, off with false — verified
  • CLI changeset: the template list shows the showcase and the new Viewed files block — verified (both listed at the head, neither at the base, run locally)
  • Component, utilities, tests and showcase block move as renames — verified (file list)
  • Core-relative imports and the component translator with registered English — verified
  • Core's stricter checks (read-only arrays, ref names, renderable guards, host data-attribute fixture, supporting leading on the message rows, no client directive on the Core barrel, literal values in doc prop descriptions, no record ids in source, baseline entry removed) — verified
  • Lab entry re-exports Core with no deprecation marker — verified (Lab index and its test)
  • Header slot renamed to the system's end-content name — verified
  • No data-diff-* attribute of its own; the seven hooks served only tests and the perf benchmark page; changed code cells keep the shared diff attribute — verified (repository search; 0 hooks on head stories against 7 to 40 on base stories, captured locally)
  • Stories, Chromium specs and RTL target take the Core story ids — verified
  • Showcase and example blocks, sandbox route list, ShadCN route with the Lab alias, probe theme for three targets — verified
  • The review keyword goes; search still finds DiffViewer through diff — verified (keywords; search run locally)
  • Translator descriptions, the CodeBlock record's four places and the perf page header no longer say Lab — verified
  • New draft record with its requirements, one hit-area gap and one open question; decider pending — verified
  • 12 new types, 15 props plus ref, defaults unchanged, three theme targets as in Lab — verified (generated API surface of both trees)
  • Behavior unchanged except the empty end-content header and the message-row leading — verified (whole component diff read; the annotation guard change is behavior-neutral)
  • Message rows about 3 px taller, rows above identical — verified (41.1 to 44 px, captured locally)
  • Bundle size, contrast measurements, axe and RTL audits, Chromium spec runs, test totals, screenshots, graduation vote and audit fixes — reported
  • Lab package stays private and canary-only; neither changeset is breaking — verified
  • The last commit changes only the changeset and the record's summary row; the head merges cleanly into main — verified
  • Files: all 39 changed files visited; .changeset/promote-diffviewer-to-core.md — finding above; docs/specs/components/DiffViewer/DiffViewer.spec.md — FR1 counts wording, part of the finding above; packages/core/src/DiffViewer/DiffViewer.tsx — non-blocking header-length note; every other file — clear

Automated review (maintainer link)

… the line counts show

A modified file shows no status token, which marks only an added, deleted,
or renamed file, and a binary or no-change file shows no line counts. The
Core changeset now names the status token for those three statuses and the
line counts when lines changed, and the record's FR1 shows the counts only
when any line was added or removed.
@ernestt

ernestt commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the changeset wording in aee7438, on top of 60d2826 (a fast-forward, no rebase).

  • Core changeset: for a file with a path, the header now "shows the path, a status token for an added, deleted, or renamed file, and the line counts when lines changed, and is a disclosure that starts open", as you suggested. A modified file gets no status token, and a binary or no-change file gets no line counts.
  • Record FR1: the counts are bounded the same way: "the added and removed line counts when any line was added or removed". FR1 already limited the Token to an added, deleted, or renamed file. It is the same record, so one /approve-spec covers it.
  • Description: two more claims are bounded, and Testing covers this commit.
    • The accessibility checklist's Role item: the disclosure is there unless collapsible is false, line numbers are buttons only with onLineNumberClick, and a fold button appears only for a large change.
    • The State item: the hidden label sits beside the glyph or bar only when changeIndicator shows one.

Validation, on this head merged onto main at 01dcc33 (clean): pnpm check:changesets, pnpm check:knowledge --base origin/main, pnpm check:repo and Prettier are clean, and pnpm review:pre has 0 findings. The commit changes only changeset and record wording.

This head awaits re-review. The engineering owner's /approve-spec on the DiffViewer record, covering its OQ1 and FR42 gap, is still open.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not ready to approve yet: DiffViewer's Core API and behavior are decided only by the new component:DiffViewer record, which is still a draft; the changeset wording from the last review is fixed, and nothing else blocks.

Owner decision needed. An engineering owner approves or amends the draft record, including its coarse-pointer hit-area gap (spec:AST-094 FR42) and OQ1 (whether the Lab re-exports are deprecated, and when they are removed), by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

No blocking findings remain. In a local run, the DiffViewer, Lab and host data-attribute tests pass, and local Storybook captures show seven stories pixel-identical to Lab's with only the two message rows about 3 px taller.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Title: DiffViewer moves to Core — verified (Core entry point, root export, exports map)
  • Core changeset: imports from the Core entry and root with the parser, differ and model types — verified; read-only highlighted diff with annotation rows, line-number buttons and folds — verified; every changed line reads as added or removed without colour, also under forced colors — verified (hidden label in every indicator mode, forced-colors bar for tint-only changes, tests pass locally); header of a file with a path shows the path, a status token for an added, deleted or renamed file, and the counts when lines changed — verified (modified, added, renamed and binary files in the multi-file story, captured locally); that header is a disclosure that starts open, configured like Banner's collapsible, off with false — verified
  • CLI changeset: the template list shows the showcase and the new Viewed files block — verified (both listed at the head, neither at the base, run locally)
  • Component, utilities, tests and showcase block move as renames — verified (file list)
  • Core-relative imports and the component translator with registered English — verified
  • Core's stricter checks (read-only arrays, ref names, renderable guards, host data-attribute fixture, supporting leading on the message rows, no client directive on the Core barrel, literal values in doc prop descriptions, no record ids in source, baseline entry removed) — verified
  • Lab entry re-exports Core with no deprecation marker — verified (Lab index and its test)
  • Header slot renamed to the system's end-content name — verified
  • No data-diff-* attribute of its own; the seven hooks served only tests and the perf page; changed code cells keep the shared diff attribute — verified (source search; 0 hooks on head stories against 7 to 40 on base stories, captured locally)
  • Stories, Chromium specs and RTL target take the Core story ids — verified
  • Showcase and example blocks, sandbox route list, ShadCN route with the Lab alias, probe theme for three targets — verified (probe theme check passes locally)
  • The review keyword goes; search still finds DiffViewer through diff — verified (keywords; search run locally)
  • Translator descriptions, the CodeBlock record's four places and the perf page header no longer say Lab — verified
  • New draft record with its requirements, one hit-area gap and one open question; decider pending — verified
  • 12 new types, 15 props plus ref, defaults unchanged, three theme targets as in Lab — verified (generated API surface of both trees)
  • Behavior unchanged except the empty end-content header and the message-row leading — verified (whole component diff read; the annotation guard change is behavior-neutral)
  • Message rows about 3 px taller, rows above identical — verified (41.1 to 44 px, captured locally)
  • Accessibility checklist: names, bounded roles and states, native buttons with no arrow keys, focus kept on the header and fold buttons, reduced-motion chevron, forced-colors cases, catalog strings — verified by reading and tests; disclosure 20 px tall — verified (captured locally)
  • Bundle size, contrast measurements, axe and RTL audits, Chromium spec runs, test totals, screenshots, graduation vote and audit fixes — reported
  • Lab package stays private and canary-only; neither changeset is breaking — verified
  • The last commit changes only the changeset and the record's line-count wording; the head merges cleanly into main — verified
  • Files: all 39 changed files visited; packages/core/src/DiffViewer/DiffViewer.tsx — non-blocking file-header length note; every other file — clear

Automated review (maintainer link)

This branch was successfully deployed

1 active deployment
Preview — aee74383 Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant