Skip to content

test(rtl): make fixture applicability order-independent - #7489

Merged
nynexman4464 merged 2 commits into
mainfrom
nynexman4464/fix/rtl-audit-fixture-applicability
Oct 30, 2026
Merged

nynexman4464 merged 2 commits into
mainfrom
nynexman4464/fix/rtl-audit-fixture-applicability

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

D1 previously chose a component's representative story from generated index.json object order. If the raw SVG icon registry fixture appeared before the normal SVGIcon stories, the audit treated its caller-supplied left and right samples as directional controls and reported a false failure.

Intended invariant

Implements docs/architecture/rtl-audit-evidence.md INV12–INV16: D1 selection is deterministic; a reference fixture can be excluded only from D1 with a typed, colocated rationale; D5 and D6 still scan every story; and every declared D1 exclusion is visible in review-facing audit output.

Change

  • Order D1 candidates by story source path and export order, with a stable story-ID fallback.
  • Add typed rtlAudit.D1 applicability metadata and validate the resolved Storybook parameters at runtime.
  • Read and validate resolved metadata for every in-scope D1 candidate, not only until the representative is found.
  • Report declaredD1Exclusions (component, story id, dimension, rationale) in the audit JSON, including stories not selected as the representative, and render them in the scorecard summary.
  • Mark only the raw registry fixture as D1-inapplicable and file it under Lab/SVGIcon.
  • Preserve planned/completed D1 identities when an excluded fixture causes another story to be selected.

Human review requested (INV16)

INV16 requires a human reviewer to confirm the explicit exclusion below. A nonempty reason proves only valid metadata.

Component Story Dimension Rationale
lab/SVGIcon lab-svgicon--default-registry-icons D1 This reference fixture preserves caller-supplied left and right glyph geometry; the samples are data, not directional controls.

Evidence

  • Failure before the original change: with the registry story first in a copy of the built index, the runner selected it and failed D1 on two unmirrored glyphs (idx:0, idx:1).
  • Normal and reordered indexes: D1 selects lab-svgicon--default, has zero D1 failures, and lists the registry exclusion in both the JSON report and the Markdown scorecard.
  • Registry-only index: D1 returns rationale-backed N/A with a stable non-null identity, discloses the exclusion, and D5/D6 still scan the registry story.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Public text and artifacts contain no internal context.

Testing

Rebased on current main.

  • pnpm exec vitest run --project node .github/scripts/rtl-audit-coverage.test.mjs .github/scripts/rtl-scorecard-summary.test.mjs .github/scripts/rtl-audit-shards.test.mjs .github/scripts/rtl-join.test.mjs .github/scripts/rtl-report-completion.test.mjs — 81 passed.
  • pnpm build, pnpm -F @astryxdesign/storybook typecheck, pnpm -F @astryxdesign/storybook build — passed.
  • Focused normal, reordered-index, and registry-only browser audits — assertions above passed.
  • Full unfiltered RTL audit — planned/completed D1, D5, and D6 identity sets match; the registry exclusion is listed. Remaining behavior failures (lab/DiffViewer D1, two charttheming-recharts D5 tooltip stories) reproduce identically with main's audit code on the same build; one core/DrawerHeader D5 result (3px delta) did not reproduce on either rerun. The nonzero exit is from those pre-existing findings and the existing applicability backlog.
  • Prettier, node --check, and git diff --check — passed.

Supersedes #5858 and #5988.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 13, 2026
@vercel

vercel Bot commented Oct 13, 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 Oct 30, 2026 7:58pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 30, 2026, 9:17 PM UTC

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: The accessibility audit did not run on this pull request. It runs after merges to main and before each release; pull requests that touch components run it with the ci:heavy-lanes label.


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

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

Approval now waits on a maintainer to provide or identify the governing spec for the RTL-audit applicability policy this adds: the story-level rtlAudit.D1 opt-out (with its required reason) and its use to file the SVG icon registry fixture under Lab/SVGIcon. The deterministic D1 ordering keeps every existing component's representative story, and the registry fixture's exclusion works as described while D5 and D6 still scan it. Nothing else is required from you; dropping the formatting-only edits to untouched helpers in rtl-audit-coverage.mjs is optional.

[Automated review]

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

Changes requested: the ordering, rtlAudit.D1 metadata, D1-only scope and identity handling match the RTL audit evidence record on main (docs/architecture/rtl-audit-evidence.md, INV12–INV15), but the branch does not yet meet INV16's disclosure rule. INV16 requires review-facing audit output to list every declared D1 exclusion with its component, story id, dimension and reason, including stories not selected as the representative; today autoD1ForComponent stops at lab-svgicon--default, so the registry fixture's exclusion appears in neither the audit report nor the scorecard summary. Please read and validate the resolved rtlAudit metadata for every in-scope story, report the declared exclusions, render them in rtl-scorecard-summary.mjs, and add a test; INV16 also asks a human reviewer to confirm the registry exclusion.

[Automated review]

Comment thread apps/storybook/rtl-audit/rtl-audit.mjs Outdated
Comment on lines +804 to +813
const card = await autoD1(page, port, candidate.id, component, {
ltrReady: true,
});
card.skippedStories = skippedStories;
if (skippedStories.length > 0) {
card.notes.unshift(
`skipped ${skippedStories.length} fixture(s) explicitly not applicable to D1`,
);
}
return card;

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.

docs/architecture/rtl-audit-evidence.md INV16 requires review-facing audit output to list every declared D1 exclusion with its component, story id, dimension and reason, including stories not selected as the D1 representative. This loop returns at the first applicable candidate, so for lab/SVGIcon the registry story's rtlAudit.D1 exclusion is never read or reported (skippedStories: []), and rtl-scorecard-summary.mjs does not print skippedStories even in the all-excluded case. Reading and validating the resolved rtlAudit for every in-scope story (the D5/D6 pass already loads each one), emitting the declared exclusions in the report, and rendering them in the scorecard summary would satisfy INV16 and also validate metadata on non-representative stories.

nynexman4464 and others added 2 commits October 30, 2026 14:33
Read and validate resolved rtlAudit metadata for every D1 candidate, then
report each declared exclusion with its component, story id, dimension, and
rationale. The scorecard renders the same list, including exclusions that
were not selected as the D1 representative.
@nynexman4464
nynexman4464 force-pushed the nynexman4464/fix/rtl-audit-fixture-applicability branch from 5e2f95f to 546dc51 Compare October 30, 2026 19:48
@nynexman4464

Copy link
Copy Markdown
Contributor Author

INV16 human review: I reviewed the declared D1 exclusion for lab/SVGIcon › lab-svgicon--default-registry-icons. The story renders caller-supplied reference glyph geometry as data, not as a directional control or cue, so the D1 exclusion is confirmed. No other story inherits it.

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

Approval recommended: the D1 ordering, the typed rtlAudit.D1 opt-out, the D1-only scope, the stable identities and the declared-exclusion disclosure match the RTL audit evidence record on main (docs/architecture/rtl-audit-evidence.md, INV12–INV16), and the registry fixture's exclusion fits the raw-glyph reference case in docs/design/bidirectionality.md (DR5). With the registry story moved first in a built index, the audit on main reports a false D1 failure on its chevron samples, while this branch keeps measuring lab-svgicon--default and lists the exclusion in both the report and the scorecard. Nothing further is required from you.

[Automated review]

This branch was successfully deployed

1 active deployment
Preview — 546dc514 Deployed Oct 30, 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.

1 participant