Skip to content

ci(visual): bound component screenshot scope - #5840

Merged
nynexman4464 merged 1 commit into
mainfrom
nynexman4464/fix/visual-component-scope
Sep 2, 2026
Merged

nynexman4464 merged 1 commit into
mainfrom
nynexman4464/fix/visual-component-scope

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A changed Core component currently expands visual review to every Storybook story across every accepted theme and both color modes. Behavioral and audit fixtures therefore multiply the screenshot baseline even when they do not represent distinct visual contracts.

On #5365, that produced 252 frames: 18 Breadcrumbs stories × 7 themes × 2 modes. Only two frames already existed, leaving 250 new screenshots to approve.

Change

  • Keep each touched component's representative story across accepted baseline themes and both modes.
  • Add visual-baseline for additional default-theme visual contracts.
  • Add visual-theme-matrix for visually dense stories that need all accepted themes, such as a component variant sheet.
  • Use the same component story selection and accepted-theme derivation in both the ordinary PR planner and trusted visual-acceptance planner.
  • Fail closed when any touched stable component has no representative story.
  • Render every current accepted story contract under a changed theme in both planners, including components the theme begins overriding in this PR.
  • Keep the focused component review ceiling in visual-gate config and apply it identically in both planners.
  • Exclude theme-only matrices from the component ceiling; broad shared-infrastructure plans still use the same configured review limit.
  • Apply one configured 5,000-shot safety ceiling to ordinary planning and capture, trusted planning, evidence publication, and baseline validation.
  • Document and test the bounded, component-sensitive scope.

This preserves broad theme coverage where it carries signal while leaving behavioral and audit-only fixtures to their dedicated checks.

Story-local configuration

Visual scope lives directly on the Storybook story object, next to the example it controls—not in a separate registry:

export const CustomSeparator: Story = {
  tags: ['visual-baseline'],
  render: () => /* ... */,
};
  • The representative story (Default, Primary, and similar conventional names) is selected automatically and needs no tag.
  • visual-baseline adds that story in the default theme, light and dark.
  • visual-theme-matrix adds that story in every accepted theme, light and dark.
  • No visual tag leaves behavioral and audit fixtures to their dedicated checks.
  • Existing no-visual excludes an unstable story from visual capture entirely.

For #5365, Default is the automatic Breadcrumbs representative and CustomSeparator is explicitly tagged visual-baseline; the remaining Breadcrumbs stories receive no screenshot baseline but continue to run through RTL and accessibility audits.

Test plan

  • Mutation proof: collapsing visual-theme-matrix into visual-baseline fails both planner-path tests because the opted-in variant story loses its non-default theme frames.
  • Budget mutation proof: restoring the old combined 240-shot cap makes the new 242-shot theme-only regression fail; the fixed planner emits all 242 shots.
  • Trusted evidence regression publishes 242 PNGs and records 242 added-frame decisions for a theme-only scope.
  • Existing-theme regression starts with Button accepted only under Neutral and Card under Y2K, then verifies a changed Y2K plan includes both stories.
  • Exact 240 component shots remain allowed; 241 fail closed. Explicit total limits are validated and cannot exceed the 5,000-shot safety ceiling.
  • Full visual-gate suite — 284 passed.
  • pnpm lint:strict — passed with existing warnings only.
  • Planned test(rtl): detect contextual decorations and coverage gaps #5365 against the live accepted baseline and its built Storybook: 16 frames total, 2 existing and 14 added. The representative Breadcrumbs story contributes 14 theme/mode frames; the focused separator story contributes 2 neutral frames.
  • Captured all 16 planned frames successfully.

@vercel

vercel Bot commented Sep 1, 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 Sep 2, 2026 4:46pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 1, 2026
github-actions Bot added a commit that referenced this pull request Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@nynexman4464
nynexman4464 force-pushed the nynexman4464/fix/visual-component-scope branch from 644be92 to 8efaa4d Compare September 1, 2026 20:01
github-actions Bot added a commit that referenced this pull request Sep 1, 2026
@nynexman4464
nynexman4464 force-pushed the nynexman4464/fix/visual-component-scope branch from 8efaa4d to eb48f11 Compare September 1, 2026 21:26
@nynexman4464
nynexman4464 force-pushed the nynexman4464/fix/visual-component-scope branch from eb48f11 to 51ad081 Compare September 1, 2026 21:31
@nynexman4464
nynexman4464 marked this pull request as ready for review September 1, 2026 21:53
github-actions Bot added a commit that referenced this pull request Sep 1, 2026
github-actions Bot added a commit that referenced this pull request Sep 2, 2026
@cixzhang

cixzhang commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Non-blocking: we may not need all themes to be checked. I think default and neutral should be okay to reduce further. We should also include the probe theme which we’re using to debug and validate theme infra.

@cixzhang cixzhang 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.

REQUEST_CHANGES

Thanks for aligning the two component planners. The new 240-shot check runs after component and theme scopes are combined, so it rejects every stable-theme-only plan. Against the current accepted baseline, neutral is 782 shots: the parent produces the plan, while this head exits before capture. A theme author therefore gets no trusted visual evidence from the PR workflow. Please keep theme-only plans out of the focused component budget, derive both planner limits from one source, and add a >240 theme-only regression that still produces or explicitly defers evidence.

[Reviewed by Robohands]

INLINE
.github/scripts/visual-gate/visual-acceptance.mjs:788 — This also caps theme-only plans; current neutral reaches 782 shots and exits before capture.

@nynexman4464
nynexman4464 force-pushed the nynexman4464/fix/visual-component-scope branch from 51ad081 to e41c44d Compare September 2, 2026 04:37
@github-actions
github-actions Bot requested a review from cixzhang September 2, 2026 04:38
github-actions Bot added a commit that referenced this pull request Sep 2, 2026
@nynexman4464
nynexman4464 force-pushed the nynexman4464/fix/visual-component-scope branch from e41c44d to ce2aa46 Compare September 2, 2026 16:41
github-actions Bot added a commit that referenced this pull request Sep 2, 2026
@nynexman4464
nynexman4464 dismissed cixzhang’s stale review September 2, 2026 21:25

Addressed on ce2aa46: theme-only plans no longer use the focused component budget; ordinary and trusted limits share config; >240 trusted evidence, changed-theme coverage, and safety-bound regressions were added.

@nynexman4464
nynexman4464 merged commit 74490c6 into main Sep 2, 2026
25 checks passed
@github-actions
github-actions Bot deleted the nynexman4464/fix/visual-component-scope branch September 3, 2026 06:22

This branch was successfully deployed

1 active deployment
Preview — ce2aa465 Deployed Sep 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants