Skip to content

ci: a changed knowledge record alone runs no browser accessibility spec - #8674

Merged
cixzhang merged 3 commits into
mainfrom
ci/a11y-contracts-skip-records
Oct 27, 2026
Merged

cixzhang merged 3 commits into
mainfrom
ci/a11y-contracts-skip-records

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

A pull request that edits components' knowledge records (<Name>.spec.md) runs the browser accessibility specs for every one of those components in pr-a11y, even when it changes no rendering code. #8467 stopped records from counting in the trusted audit-scope classifier and the PR analysis. But a11y-pr-contracts.mjs, which picks the Playwright specs, still matches raw changed paths: a changed Collapsible/Collapsible.spec.md selects the accordion pattern spec through its folder and path token, and so on. On the 147-record schema migration that was 73 specs (568 tests), and pr-a11y hit its 15-minute timeout three times with no violation.

Intended invariant

A changed knowledge record selects no browser accessibility spec, by folder or by path token. Code changed beside it still selects the spec as before, and always-on specs still run.

Change

  • .github/scripts/a11y-pr-contracts.mjs: selectSpecs matches a spec's folder and its ^… path tokens against the changed paths minus knowledge records. isKnowledgeRecord is a *.spec.md outside hidden, fixture, test, generated, build-output, coverage and dependency folders, and not *.generated.spec.md: exactly what knowledge-paths.cjs discovers. The runner uses only Node built-ins, so it keeps its own copy of the folder list, and a test keeps that copy equal to knowledge-paths.cjs. A changed spec file, component-scope tokens, unknown scope, audit titles, and always-on specs are unchanged. The header documents the rule.
  • .github/scripts/a11y-pr-contracts.test.mjs:
    • a record alone selects only always-on specs, both by folder and by a pattern spec's path token;
    • a record plus code beside it still selects the scoped spec;
    • a fixture, test, or generated .spec.md still selects its folder's spec;
    • the folder list matches knowledge-paths.cjs.
  • CONTRIBUTING.md: the browser-spec routing paragraph says a changed record selects no spec.

Evidence

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm vitest run --project node .github/scripts/a11y-pr-contracts.test.mjs (44 passed).

@vercel

vercel Bot commented Oct 27, 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 27, 2026 3:27pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 27, 2026, 3:50 PM UTC

@github-actions

github-actions Bot commented Oct 27, 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: No accessibility violations detected.

Visual Regression

55 of 502 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
RichTextEditor Markdown parity: side by side probe dark 558,840
RichTextEditor Markdown parity: side by side probe light 540,756
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
AppShell With Mobile Nav probe light 217,010
AppShell With Mobile Nav probe dark 216,960
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
AppShell Playground neutral dark 65,198
AppShell Playground neutral light 63,788
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232

and 35 more.


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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for closing the record gap in the browser-spec runner: a knowledge-record change no longer pulls in browser specs, and code beside a record still selects its folder's specs. One fix is needed first: isKnowledgeRecord treats every *.spec.md as a record, including the fixture, test, and *.generated.spec.md paths that docs/architecture/knowledge-contracts.md (INV27 and Owning code) says are not records and that the trusted audit-scope classifier counts as component source, so such a file would start pr-a11y yet skip its folder's pattern specs. Excluding those paths the way knowledge-paths.cjs does, with a test that a fixture .spec.md still selects its folder's spec, resolves it, and a matching clause in the routing paragraph of CONTRIBUTING.md would keep the guide accurate.

[Automated review]

Comment thread .github/scripts/a11y-pr-contracts.mjs Outdated
* @param {string} file
*/
export function isKnowledgeRecord(file) {
return file.endsWith('.spec.md');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This accepts every *.spec.md, including paths that docs/architecture/knowledge-contracts.md says are not records: INV27, "the paths discovery already ignores are not candidates", and Owning code, fixture, test, generated, and *.generated.spec.md paths "are ignored consistently by discovery and PR routing". component-audit-scope.cjs reads that rule from knowledge-paths.cjs, so a file such as packages/core/src/Collapsible/__fixtures__/Collapsible.spec.md starts pr-a11y as Collapsible source, and this predicate then drops it, so accordion.chromium.spec.ts no longer runs. A local copy of the ignored segments keeps the runner self-contained, for example:

// Mirrors knowledge-paths.cjs: paths discovery ignores are not records.
const IGNORED_RECORD_SEGMENTS = new Set([
  '__fixtures__',
  '__generated__',
  '__snapshots__',
  '__tests__',
  'build',
  'coverage',
  'dist',
  'fixtures',
  'generated',
  'node_modules',
  'test',
  'test-utils',
  'tests',
]);

export function isKnowledgeRecord(file) {
  if (!file.endsWith('.spec.md') || file.endsWith('.generated.spec.md')) {
    return false;
  }
  return !file
    .split('/')
    .some(segment => segment.startsWith('.') || IGNORED_RECORD_SEGMENTS.has(segment));
}

A test that such a fixture still selects its folder's pattern spec would pin it.

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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the follow-up: fixture, test, and generated .spec.md paths now keep selecting their specs, the contributor guide states the rule, and #8288's changed paths now select only the 21 always-on browser specs instead of 73. One small change remains before this can be approved: isKnowledgeRecord checks only directory segments (.slice(0, -1)), so a dot-named file such as packages/core/src/Collapsible/.Collapsible.spec.md, which knowledge-paths.cjs and the audit-scope classifier ignore, still counts as a record, contrary to the Owning code rule in docs/architecture/knowledge-contracts.md that discovery and PR routing ignore hidden paths consistently. Checking every segment, the file name included, plus one test for a dot-named record would close it.

[Automated review]

Comment thread .github/scripts/a11y-pr-contracts.mjs Outdated
}
return !file
.split('/')
.slice(0, -1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This checks directory segments only, so packages/core/src/Collapsible/.Collapsible.spec.md counts as a record here, while knowledge-paths.cjs (which also checks the file name) and the audit-scope classifier treat it as Collapsible source; docs/architecture/knowledge-contracts.md (Owning code) has discovery and PR routing ignore hidden paths consistently. Dropping .slice(0, -1) closes it: no ignored folder name ends in .spec.md, so only the leading-. rule can match the file name. A test such as expect(isKnowledgeRecord('packages/core/src/Chat/.ChatLayout.spec.md')).toBe(false) would pin it.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Recommended for approval: a changed knowledge record no longer pulls browser accessibility specs into pr-a11y through its folder or a ^ path token, while code beside a record, fixture, test, generated, and hidden .spec.md paths (dot-named files now included), unknown scope, and release checks select exactly as before. With this change, #8288's changed paths select the 21 always-on browser specs instead of 73, and the new tests fail against both the base runner and the previous revision of this pull request. Nothing further is needed from this review.

[Automated review]

@cixzhang

Copy link
Copy Markdown
Contributor Author

Posted by Cindy's agent on her behalf.

Decision: approved under Cindy's standing rule for CodeBunny-approved pull requests. CodeBunny recommends approval at this exact head with no remaining items.

What this PR needs: nothing further; it merges when checks are green. After it lands, the knowledge-record migration (#8288) picks up the narrower accessibility-spec selection on its next run.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 7cfb0a7

@cixzhang
cixzhang merged commit 683320c into main Oct 27, 2026
74 checks passed
@github-actions
github-actions Bot deleted the ci/a11y-contracts-skip-records branch October 28, 2026 06:17

This branch was successfully deployed

1 active deployment
Preview — 7cfb0a7c Deployed Oct 27, 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