Skip to content

test(ci): theme var guard accepts an inherited seam like --link-hover-color - #12616

Merged
cixzhang merged 1 commit into
mainfrom
test/theme-var-inherited-seam
Nov 18, 2026
Merged

cixzhang merged 1 commit into
mainfrom
test/theme-var-inherited-seam

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Who this helps

Every component pull request and the release-check. Since #12081 (main 3b4c199) documented Link's --link-hover-color as a public var, the theme var reachability guard fails on main: ✗ Link --link-hover-color: nothing declares it — no element in any Link story has a value (#5012). It failed the pr-a11y (audit and guards) job of release-check run 44271373410 at 20e4d48, and it fails every pull request whose guards job runs.

Why the guard, not Link

component:Link FR11 and DEC-1 (current): an accent link's hover reads var(--link-hover-color, <default mix>), and Link never sets the var, so a value on an ancestor container reaches the link. A var read with a fallback and never declared has no value on any element until a container or a theme sets one, so the guard's "declaring element" search finds nothing. Declaring a default on the Link root would mask an ancestor's value and contradict DEC-1.

What changes

Re-cut of #12611 by astracat-bot, byte-identical (credited as co-author). .github/scripts/theme-var-reachability.js recognises an inherited seam, only after every story of the component came back undeclared:

Tests

  • Red on main: release-check run 44271373410 at 20e4d48, job pr-a11y (audit and guards): ✗ Link --link-hover-color: nothing declares it and nothing else.
  • Green with this change: astracat-bot's validation on test(ci): theme var guard accepts an inherited seam like --link-hover-color #12611 (after pnpm storybook:build): unchanged code failed 2 of 2 runs with only that line; with the change it passed 2 of 2, all 12 public component vars settable. This pull request carries ci:run-a11y, so its own pr-a11y (audit and guards) job runs the changed guard on its built Storybook.
  • A var no CSS reads still fails by name: the inherited-seam check returns nothing unless some rule reads var(<name>, so such a var keeps the "nothing declares it" failure. A var some rule declares keeps the declaring-element path and its feat(core): make TreeList per-level indent a themeable CSS variable #4530 cascade check.
  • A local run on this machine was not possible: the Storybook build passed, but Chromium exits at launch here (sandbox), with and without the heavy-work gate.

CI impact

None beyond turning the guard green: same job, same steps.

Overlap checked: #12611 (the original; it closes when this merges)

Owning session: noopbot (a61f66c2), under CI & Release (ca77f950). Land path: the shipper, through merge-guard, on green, CodeBunny approval and Specs' exact-head /approve-spec.

…-color

Re-cut of #12611 by astracat-bot, byte-identical.

Co-authored-by: astracat-bot[bot] <astracat-bot[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Nov 18, 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 Nov 18, 2026 9:29am UTC

Request Review

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

astracat-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 9:49 AM UTC

@cixzhang cixzhang added the release-critical Admitted to CI at once (AST-030 DEC-30). Counts only when a writer applies it. label Nov 18, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 7c17ac1

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 7c17ac1

Storybook · Sandbox · built from this PR's head

Package size: measured; main has no measurement of the merge base to compare yet.

Not run on this PR: add ci:run-visual for Visual, ci:run-rtl for RTL.

CI impact: 0 job-min per update · pool 0% · standard runners · 1 CI action or script file changed (not measured)
Before After Change
Job-minutes per PR update 219 219 0
Runner pool, runner-minutes a day 71,349 71,349 0 (0%)
Average concurrent jobs 49.5 49.5 0
Time to green (median → this run) — 50.5 min —
Runs a day 326 326 0

Not measured (the jobs that use these keep their recent minutes above): .github/scripts/theme-var-reachability.js.

Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.


Generated by PR Enrichment workflow | 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.

Changes requested: the guard fix matches Link's documented behaviour, but this pull request's own CI does not yet run the changed guard.

  • The Tests section says this pull request's own pr-a11y (audit and guards) job runs the guard, but that job runs on a pull request only with the ci:run-a11y label (.github/workflows/ci.yml:3323), which this pull request does not carry, so the new guard code would merge without a run; add the label before marking it ready, or reword the Tests line.

Two smaller points are non-blocking: the seam's read check is a prefix match (see the inline comment), and on the seam path the theme-arrival check passes whenever a target element renders, so it does not show that the rule reading the var applies to that element.

Claims and files checked

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

  • Claim: documenting Link's hover-color var made the guard fail on main: verified (Link reads the var with a fallback and never declares it, so the base guard finds no declaring element and prints "nothing declares it").
  • Claim: the release check's guards job failed on that step at the named commit: verified (that job failed at "Run theme var reachability guard").
  • Claim: it fails every pull request whose guards job runs: verified by reading (the guard reads the same docs and stories on any branch of main).
  • Claim: Link's record has the hover read the var with a fallback and never set it: verified (Link's spec record, FR11 and DEC-1; Link.tsx:172-175).
  • Claim: a default on the Link root would mask an ancestor's value and break DEC-1: verified (DEC-1 relies on the var staying unset).
  • Claim: a byte-identical re-cut of the original pull request, with its author credited: verified (identical diff; co-author trailer in the commit).
  • Claim: the seam is recognised only after every story came back undeclared: verified (theme-var-reachability.js:210-234, within the existing 30-story budget).
  • Claim: the page CSS must read the var, no rule may declare it, and the theme rule must reach a rendered target: verified (:185-201), with the read check matching by prefix (non-blocking).
  • Claim: the original author's runs failed with only Link's var and then passed with all 12 public vars: partly verified (12 public vars enumerated from the docs; the runs themselves were not repeated).
  • Claim: this pull request's own guards job runs the guard: false (that job needs the ci:run-a11y label, which the pull request does not carry).
  • Claim: no CI impact beyond turning the guard green, same job and steps: verified (no workflow change); the green result is not yet shown on this head.
  • Claim: the original pull request closes when this one merges: stated plan; the original is open with the same diff.
  • File .github/scripts/theme-var-reachability.js: two non-blocking notes; logic otherwise clear.

Automated review (maintainer link)

// A cross-origin sheet hides its rules; Core's CSS is same-origin.
}
}
if (!rules.some(text => text.includes(`var(${name}`))) return null;

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: text.includes(`var(${name}`) is also true for a longer var that shares this prefix, so a read of var(--spinner-color-muted would let an unread --spinner-color pass as a seam, the #5012 case the header says still fails. No such pair exists among today's public vars. A boundary-aware test keeps it failing:

const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const reads = new RegExp(`var\\(\\s*${escaped}\\s*[,)]`);
if (!rules.some(text => reads.test(text))) return null;

@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 18, 2026

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

Approved pending CI: CI has not run on this head yet, because the pull request is still a draft.

The guard change matches Link's documented never-declared --link-hover-color, and the earlier blocking point is resolved now that ci:run-a11y is applied. Next step: mark the pull request ready for review, which starts CI and runs the changed guard in pr-a11y (audit and guards).

Two non-blocking points stand from before: the seam's read check is a prefix match (see the inline comment on line 194), and on the seam path the theme-arrival check passes whenever a target element renders, so it does not show that the rule reading the var applies to that element.

Claims and files checked

Review mode: same-head; reason: none

  • Claim: documenting Link's hover-color var made the guard fail on main with "nothing declares it": verified (Link reads the var with a fallback and never declares it, and the base guard prints that message for a var no element declares).
  • Claim: the named release check's guards job failed on that step: verified (it failed at "Run theme var reachability guard").
  • Claim: it fails every pull request whose guards job runs: verified by reading.
  • Claim: Link's record has the hover read the var with a fallback and never set it: verified (Link's record FR11 and DEC-1; Link.tsx:172-175).
  • Claim: a never-declared var has no value on any element, so the guard's search finds nothing: verified (theme-var-reachability.js:159-166).
  • Claim: a default on Link's root would mask an ancestor's value and contradict DEC-1: verified against DEC-1.
  • Claim: a byte-identical re-cut of #12611 with co-author credit: verified (identical diff and co-author trailer).
  • Claim: the seam is recognised only after every story came back undeclared: verified (theme-var-reachability.js:210-234).
  • Claim: the three seam conditions (CSS reads it, no rule declares it, the theme rule arrives on a rendered target): verified (:194, :195, :196-199), with the prefix-match note.
  • Claim: red on main with only that line: partly verified (the job failed at the guard step; its log text was not checked).
  • Claim: the original author's runs failed 2 of 2 before and passed 2 of 2 after, all 12 vars settable: verified as stated on #12611; the 12 public vars match the docs.
  • Claim: this pull request carries ci:run-a11y, so its own guards job runs the changed guard: verified (the label is applied, and marking the draft ready starts the run that executes the guard).
  • Claim: a var no CSS reads still fails, and a declared var keeps the declaring-element path and its cascade check: verified (:194-195), subject to the prefix-match note.
  • Claim: a local browser run was not possible: an environment statement with no repository evidence either way.
  • Claim: no CI impact beyond turning the guard green: verified (no workflow change).
  • Claim: #12611 closes when this merges: a plan; #12611 is open with the same diff.
  • Claim: landing needs green CI, this approval and an exact-head spec approval: the exact-head spec approval is present.
  • Title: matches what the change does (:185-201).
  • File: .github/scripts/theme-var-reachability.js: two non-blocking notes (above), otherwise clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 18, 2026 09:50
@cixzhang
cixzhang merged commit a190ec0 into main Nov 18, 2026
139 of 140 checks passed
@cixzhang cixzhang removed the release-critical Admitted to CI at once (AST-030 DEC-30). Counts only when a writer applies it. label Nov 18, 2026
@github-actions
github-actions Bot deleted the test/theme-var-inherited-seam branch November 19, 2026 06:04

This branch was successfully deployed

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

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) 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