Repository navigation
test(ci): theme var guard accepts an inherited seam like --link-hover-color - #12616
Conversation
…-color Re-cut of #12611 by astracat-bot, byte-identical. Co-authored-by: astracat-bot[bot] <astracat-bot[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 7c17ac1 |
PR Analysis Report🔎 Preview ·
|
| 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
There was a problem hiding this comment.
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 theci:run-a11ylabel (.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-a11ylabel, 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.
| // A cross-origin sheet hides its rules; Core's CSS is same-origin. | ||
| } | ||
| } | ||
| if (!rules.some(text => text.includes(`var(${name}`))) return null; |
There was a problem hiding this comment.
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;There was a problem hiding this comment.
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.
Who this helps
Every component pull request and the release-check. Since #12081 (main 3b4c199) documented Link's
--link-hover-coloras 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 thepr-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:LinkFR11 and DEC-1 (current): an accent link's hover readsvar(--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.jsrecognises an inherited seam, only after every story of the component came back undeclared:var(<name>(a var nothing reads still fails, Theme docs teach--button-press-scale, a CSS variable no component defines #5012);<name>:(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);@layer astryx-themerule on the component's documented target class must arrive on a rendered target element, or the guard fails as before.Tests
pr-a11y (audit and guards):✗ Link --link-hover-color: nothing declares itand nothing else.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 carriesci:run-a11y, so its ownpr-a11y (audit and guards)job runs the changed guard on its built Storybook.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.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.