Skip to content

ci: a visual gate a test runs builds no theme into the checkout - #11355

Merged
cixzhang merged 3 commits into
mainfrom
ci/visual-gate-read-only
Nov 12, 2026
Merged

cixzhang merged 3 commits into
mainfrom
ci/visual-gate-read-only

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Who this helps

Anyone whose pull request runs the Node test legs. packages/cli/host/door-conformance.test.mjs failed on unrelated pull requests (#10592, #11283): its bin and host runs of astryx experimental theme editor new brand --like neutral disagreed. The bin run said "The neutral theme is not installed"; the host run said "Cannot find module packages/themes/neutral/dist/icons.mjs imported from dist/neutral.js".

Root cause

The visual gate's loadThemeOverrides (.github/scripts/visual-gate/lib/sources.mjs) reads every theme's built dist/source.mjs, and builds any theme it can't read with pnpm -F <theme> build in the repository. That's right for the visual-gate job.

But gate-context.test.mjs runs the gate as an ordinary Node test, and the Node legs build no themes. So that test rebuilt all eight theme packages in place, mid-leg. Neutral's build deletes dist, writes neutral.js, then has tsup write icons.mjs. A CLI run that resolved Neutral during that build found it missing or half written.

Caught live: a process watcher on packages/themes/neutral/dist, running the files that shared #11283's leg, saw pnpm -F @astryxdesign/theme-neutral build, started by gate.mjs check from gate-context.test.mjs, produce dist/neutral.js with no icons.mjs.

What changes

  • Switch: ASTRYX_VISUAL_GATE_READ_ONLY=1 makes the gate build nothing. It reads the themes that are built and names the rest in the verdict as context.themesNotBuilt, a typed field, so a run with missing themes is never a silent pass.
  • Where it's set: only by the Node test project (vitest.config.ts), so every gate a test runs inherits it. The visual-gate job runs the gate directly and never sets it, so there the gate keeps building what it can't read.
  • Unchanged: a built theme that fails to load still fails, as a broken build. No timeout, retry or door-conformance assertion changes.

Size

gate.mjs changes 13 lines: one import, one themesNotBuilt list, that list passed at the two existing loadThemeOverrides calls, and the field on the two verdicts it writes. lib/sources.mjs changes 28: the switch and the read-only branch. The files keep their own formatting.

Tests

  • lib/sources.test.mjs:
    • the real path still builds a missing theme, and Core first when Core's theme entry is missing;
    • read-only builds nothing, neither the theme nor Core, and names the theme;
    • read-only still reads a built theme and still fails on a broken one;
    • the switch is on in the Node test project and no workflow sets it.
  • gate-context.test.mjs: a gate run on the component-scope path, with a stub pnpm first on its PATH:
    • never calls pnpm;
    • leaves every theme's dist as it was;
    • its verdict names exactly the themes without a built source.
  • Red on main: with theme dists absent (the normal state in a Node leg), the new cases fail on main's code: it calls pnpm to build. Main's run also rebuilds the real theme dists through the other component-scope cases, which is the bug itself. With this change and theme dists absent, all 20 cases pass and no dist is created.
  • Under load (partial): with the change and theme dists absent, the 13 files that shared chore(core): the internal touch entry exposes group press tracking to Lab #11283's leg ran on 4 workers for about 10 minutes under the same process watcher, and no theme dist appeared. On main, the same run had the gate build Neutral mid-run. The run was stopped early to get this change out.

CI impact

+0 jobs, +0 workflows. The Node legs stop building eight theme packages inside a test (several minutes of CPU on a loaded runner). The visual-gate job is unchanged.

The gate's loadThemeOverrides builds any theme whose dist/source.mjs is missing
(pnpm -F <theme> build in the repository). gate-context.test.mjs runs the gate
as a Node test, and Node legs build no themes, so that test rebuilt all eight
theme packages in place mid-leg. Neutral's build deletes dist, writes
neutral.js, then icons.mjs, so a CLI run resolving Neutral at the same time saw
it missing or half written: door-conformance's bin and host runs of
'theme editor new --like neutral' diverged.

ASTRYX_VISUAL_GATE_READ_ONLY=1, set only by the Node test project
(vitest.config.ts), makes the gate build nothing: it reads the themes that are
built and names the rest in the verdict (context.themesNotBuilt). The
visual-gate job never sets it and keeps building what it cannot read.
Prettier formats gate.mjs and sources.mjs, which Lint checks once changed.
@vercel

vercel Bot commented Nov 12, 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 12, 2026 5:45am UTC

Request Review

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

astracat-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 12, 2026, 6:00 AM UTC

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · c7c186d

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.

CI impact: 0 job-min per update · pool 0% · time to green −7 min · standard runners · 4 CI action or script files changed (not measured)
Before After Change
Job-minutes per PR update 118.9 118.9 0
Runner pool, runner-minutes a day 54,138 54,138 0 (0%)
Average concurrent jobs 37.6 37.6 0
Time to green (median → this run) 25.2 min 18.2 min −7 min
Runs a day 455 455 0

Not measured (the jobs that use these keep their recent minutes above): .github/scripts/visual-gate/gate-context.test.mjs, .github/scripts/visual-gate/gate.mjs, .github/scripts/visual-gate/lib/sources.mjs, .github/scripts/visual-gate/lib/sources.test.mjs.

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.

Approved pending CI: CI has not run on this draft yet, and marking it ready for review starts it.

The read-only switch is scoped the way the description says. Only the node Vitest project sets ASTRYX_VISUAL_GATE_READ_ONLY, and no workflow does, so the visual-gate job still builds the themes it cannot read. A built theme that fails to load still fails. There are no blocking findings.

Claims and files checked
  • Door-conformance failed on two unrelated pull requests because its bin and host runs of the --like neutral theme example disagreed: not reproduced here; the mechanism matches the code, because door-conformance runs every command example, and that example needs Neutral's built package.
  • The gate's theme loader builds any theme it cannot read with pnpm in the repository: verified (lib/sources.mjs, build path).
  • gate-context.test.mjs runs the gate as a Node test in legs that build no themes, so it rebuilt the theme packages in place: verified by reading the test and the node project configuration.
  • Neutral's build deletes dist, writes the theme files, then has tsup write icons.mjs: verified (packages/themes/neutral/package.json build script, tsup.config.ts).
  • A process watcher caught the gate's Neutral build mid-leg: a runtime observation, not reproducible from the repository.
  • The switch makes the gate build nothing and list unbuilt themes in context.themesNotBuilt: verified (lib/sources.mjs:150-166, gate.mjs:555-557 and :670-672).
  • Only the Node test project sets the switch, and the visual-gate job never does: verified (vitest.config.ts:207; no workflow mentions it; ci.yml runs gate.mjs directly).
  • A built theme that fails to load still fails as a broken build: verified (lib/sources.mjs:152-163, lib/sources.test.mjs:168-185).
  • No timeout, retry or door-conformance assertion changes: verified (only these five files change).
  • Prettier formats gate.mjs and lib/sources.mjs, which were not Prettier-clean on main, and Lint checks changed files: verified (Lint's changed-file Prettier step; the base files had lines past Prettier's 80-column width). Formatting is most of those two files' change and about half of the whole diff.
  • The listed lib/sources.test.mjs and gate-context.test.mjs cases exist and assert what the description says: verified by reading (lib/sources.test.mjs:62-185, gate-context.test.mjs:247-292).
  • The new cases fail on main's code because main calls pnpm: verified by reading, not run.
  • All 20 cases pass with theme dists absent: the count is verified (12 and 8); the run was not reproduced here.
  • No new jobs or workflows, and the visual-gate job is unchanged: verified (no workflow file changes).
  • .github/scripts/visual-gate/gate.mjs: clear.
  • .github/scripts/visual-gate/lib/sources.mjs: clear.
  • .github/scripts/visual-gate/gate-context.test.mjs: clear.
  • .github/scripts/visual-gate/lib/sources.test.mjs: clear.
  • vitest.config.ts: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 05:11

@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: one claim in the description is false.

  • Miss: the description and commit message say Lint's changed-file formatting check requires reformatting gate.mjs and lib/sources.mjs, but that check, like the pre-commit hook, only covers .ts, .tsx and .md files (.github/workflows/lint.yml:336), so either drop the formatting-only hunks or reword the claim to call them optional cleanup.

The read-only switch itself works as described: only the node Vitest project sets it, no workflow does, a built theme that fails to load still fails, and both changed test files pass in CI. Optional: the CI impact section could give before and after minutes for the Node legs, as AST-030 FR19 lists.

Claims and files checked
  • Door-conformance failed on two unrelated pull requests because its bin and host runs of the Neutral theme example disagreed: a runtime report, not reproduced; the mechanism matches the code, since that example needs Neutral's built package.
  • The gate's theme loader builds any theme it cannot read with pnpm in the repository: verified (lib/sources.mjs, build path).
  • The gate-context test runs the gate in Node legs, which build no themes, so it rebuilt all eight theme packages in place: verified (the node project's global setup builds Core only; eight folders under packages/themes).
  • Neutral's build deletes dist, writes the theme files, then has tsup write icons.mjs: verified (Neutral's build script and tsup.config.ts).
  • A process watcher caught the gate's Neutral build mid-leg: a runtime observation, not reproducible from the repository.
  • The switch makes the gate build nothing and name unbuilt themes in context.themesNotBuilt: verified (lib/sources.mjs:151-166, gate.mjs:555-557 and :670-672); the markdown summary does not name them and the run still exits 0.
  • Only the Node test project sets the switch, and the visual-gate job never does: verified (vitest.config.ts:207; no workflow mentions it; ci.yml runs gate.mjs directly).
  • A built theme that fails to load still fails as a broken build: verified (lib/sources.mjs:152-163, lib/sources.test.mjs:168-185).
  • No timeout, retry or door-conformance assertion changes: verified (only these five files change).
  • gate.mjs and sources.mjs were not Prettier-clean on main: verified by line width (57 and 18 lines past Prettier's 80 columns); Prettier was not run.
  • Lint's changed-file formatting check requires the reformatting: false (.github/workflows/lint.yml:336 checks .ts, .tsx and .md only).
  • Prettier alone changes 192 and 45 lines of those files, and the change itself is 20 and 31 lines: not verified by running Prettier; formatting-only blocks come to 177 and 39 lines by comparison.
  • Formatting is most of the diff: true for those two files (about three quarters); about half of the whole diff.
  • The listed lib/sources.test.mjs and gate-context.test.mjs cases exist and assert what the description says: verified (lib/sources.test.mjs:62-185, gate-context.test.mjs:247-292).
  • The new cases fail on main's code: verified by reading (main exports no readOnlyGate, and its gate calls pnpm); not run.
  • All 20 cases pass with this change: verified in CI (12 and 8 cases passed).
  • No new jobs or workflows, and the visual-gate job is unchanged: verified (no workflow file changes).
  • .github/scripts/visual-gate/gate.mjs: the read-only wiring is clear; its formatting-only hunks rest on the false claim above.
  • .github/scripts/visual-gate/lib/sources.mjs: the read-only branch is clear; same formatting finding.
  • .github/scripts/visual-gate/gate-context.test.mjs: clear.
  • .github/scripts/visual-gate/lib/sources.test.mjs: clear.
  • vitest.config.ts: clear.

Automated review (maintainer link)

Comment thread .github/scripts/visual-gate/gate.mjs Resolved
The earlier commit reformatted gate.mjs, lib/sources.mjs and
lib/sources.test.mjs with Prettier and said Lint required it. That was
wrong: Lint's changed-file formatting step and the pre-commit hook cover .ts,
.tsx and .md only. These files now keep main's formatting, and the change is
only the read-only switch, the themesNotBuilt verdict field and their tests.
@cixzhang
cixzhang marked this pull request as draft November 12, 2026 05:52
@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 05:52

@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: the first CI run on this head was cancelled because CI was full, and the re-run has not finished, so the required checks have not reported here yet.

The earlier blocking finding is fixed: gate.mjs and lib/sources.mjs now keep main's formatting, and the description no longer says Lint requires reformatting them. The read-only switch works as described, and both changed test files passed in CI on the previous revision, whose code differs from this head only in formatting. Optional: the CI impact section could give before and after minutes for the Node legs, as AST-030 FR19 lists.

Claims and files checked
  • Door-conformance failed on two unrelated pull requests because its bin and host runs of the Neutral theme example disagreed: a runtime report, not reproduced; the mechanism matches the code, since that example resolves Neutral's built package.
  • The gate's theme loader reads each theme's built source and builds any it cannot read with pnpm in the repository: verified (lib/sources.mjs:152-166).
  • The gate-context test runs the gate as an ordinary Node test and Node legs build no themes, so it rebuilt all eight theme packages in place: verified (the node project's global setup builds Core only; eight folders under packages/themes).
  • Neutral's build deletes dist, writes the theme files, then has tsup write icons.mjs: verified (Neutral's build script and tsup.config.ts).
  • A process watcher caught the gate's Neutral build mid-leg: a runtime observation, not reproducible from the repository.
  • The switch makes the gate build nothing, read the built themes and name the rest in context.themesNotBuilt, a typed field: verified (lib/sources.mjs:113, :145-151; gate.mjs:210, :509, :604); the verdict's status, the exit code and the markdown summary do not change.
  • Only the Node test project sets the switch, and the visual-gate job runs the gate directly and never sets it: verified (vitest.config.ts:207; no workflow names it; ci.yml runs gate.mjs directly).
  • A built theme that fails to load still fails as a broken build: verified (lib/sources.mjs:146-147, lib/sources.test.mjs:135-146).
  • No timeout, retry or door-conformance assertion changes: verified (only these five files change).
  • gate.mjs changes 13 lines and lib/sources.mjs 28, and the files keep their own formatting: verified (+10/−3 and +27/−1; the import line stays as on main).
  • The listed lib/sources.test.mjs and gate-context.test.mjs cases exist and assert what the description says: verified (lib/sources.test.mjs:59-146, gate-context.test.mjs:247-292).
  • The new cases fail on main's code: verified by reading (main exports no readOnlyGate, and its gate calls pnpm, which the stub fails); not run.
  • With the change and theme dists absent, all 20 cases pass and no dist is created: verified in CI on the previous revision, whose code differs from this head only in formatting (12 and 8 cases passed).
  • The partial run under load saw no theme dist appear: a runtime observation, not reproduced.
  • No new jobs or workflows, and the visual-gate job is unchanged: verified (no workflow file changes).
  • The latest commit message says Lint's changed-file formatting step and the pre-commit hook cover only .ts, .tsx and .md: verified (.github/workflows/lint.yml:336; lint-staged in package.json).
  • .github/scripts/visual-gate/lib/sources.mjs: clear.
  • .github/scripts/visual-gate/gate.mjs: clear.
  • .github/scripts/visual-gate/lib/sources.test.mjs: clear.
  • .github/scripts/visual-gate/gate-context.test.mjs: clear.
  • vitest.config.ts: clear.

Automated review (maintainer link)

@cixzhang
cixzhang merged commit 2025dc7 into main Nov 12, 2026
117 of 122 checks passed
@github-actions
github-actions Bot deleted the ci/visual-gate-read-only branch November 13, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — c7c186d2 Deployed Nov 12, 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