Skip to content

perf(cli): theme build keeps the JavaScript it compiles from a theme's local modules - #11954

Merged
josephfarina merged 13 commits into
mainfrom
speed/theme-module-kept
Nov 16, 2026
Merged

josephfarina merged 13 commits into
mainfrom
speed/theme-module-kept

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Since a theme build writes a self-contained module, it compiles each local TypeScript or JSX module the theme imports (an icon registry, a slot value, their helpers) with Babel on every build. That loads @babel/core and the TypeScript and JSX plugins and warms them up: about 300 ms per build for a theme with an icon registry, even when nothing changed since the last build.

  • api/theme/build/self-contained.mjs: the compiled JavaScript is kept as a summary beside the kept gathers (persistedSummary) and read back while all of these are unchanged:
    • the source text;
    • the compile options: the file name, babelrc: false, configFile: false, the source type, the plugins' paths and options;
    • the imports it rewrites, and the code of the plugin that rewrites them;
    • the environment Babel reads for a config's env blocks (BABEL_ENV, else NODE_ENV);
    • the CLI's build id;
    • every file of the code that compiled it: the modules of @babel/core and of the plugins, and each module they required in turn, wherever they are installed, each by its full stamp;
    • every package folder Node's lookup took on the way (the node_modules/<name> nearest above a module that required another package's module, such as the folder @babel/core finds @babel/generator in), by the real path it resolves to. A reinstall that points a lookup at another copy of a package, and leaves the old copy on disk, compiles again.
    • A compile is kept only when every one of those files and folders last changed at least 2 s (the coarsest time step a file system keeps) before the process started, so the code that compiled it is the code they hold, however and whenever the process loaded Babel; a process that loaded Babel before a reinstall keeps nothing.
    • foundation/fs/loaded-files.mjs (shared with css-tree's kept answers) now stamps the lookup folders too: loadedCodeStamps(from, roots) replaces loadedFiles and loadedFileStamps, and css-tree's kept answers stamp the folders their modules and MDN data were found in the same way.
  • A build of an unchanged theme loads neither @babel/core nor its plugins (it still reads each module's imports with @babel/parser, as before). A module that fails to compile keeps nothing. A first build, and a build after an edit to the module, compile as before.
  • The compile reads no Babel config of the project (babelrc: false, configFile: false, as before), so a babel.config.* or .babelrc beside the theme has no effect either way.
  • The JavaScript is kept only where the per-user catalogs folder exists, as for the other kept gathers.
  • spec:AST-081 FR7, architecture:cli-surface INV10 and doctor's cache row name the new entry.

Evidence

A build of a theme with an icon registry (icons.tsx) beside it, in a project with one integration, a fresh process per call, warm, interleaved, n=11, median paired difference (95% CI):

Theme main → change Difference
First theme 675 → 456 ms −214 [−220, −208], −32%
Second theme 746 → 537 ms −208 [−214, −194], −28%
Second theme, --check 736 → 529 ms −204 [−216, −201], −28%
  • Identity: every run printed the same stdout and stderr, with the same exit code, as main, and the written output folders are byte-identical.
  • Read back, measured in a process: about 4 ms for 614 file stamps and the entry, against about 300 ms to compile. A compile splits into about 65 ms to load @babel/core and about 240 ms for the first transform, which loads and warms up the plugins; a second transform in the same process takes about 12 ms.

Tests

  • api/theme/build/self-contained.kept.test.mjs (new), on a registry that renders JSX, imports a compiled helper and imports a plain module:
    • a second build asks for Babel 0 times and writes the same bytes as a fresh compile;
    • a project babel.config.json and .babelrc beside the theme change nothing;
    • each of these compiles again, and the next build reads it back: an edit to one module's source (only that module compiles), other rewrites of the registry's imports, BABEL_ENV, a changed stamp of one of Babel's files, and a module renamed to another kind;
    • a module that fails to compile keeps nothing and fails again on the next build;
    • after a reinstall changes Babel's files while a process runs, the process keeps nothing it compiles and its next build compiles again, also when Babel was loaded another way before the first compile (both fail when a compile is kept whatever the files' times);
    • after a reinstall points @babel/core at another copy of @babel/generator, the next build compiles again; the same for css-tree and mdn-data in css-checks.kept.test.mjs (both fail when the lookup folders are not stamped);
    • the stamps include @babel/core, @babel/generator, @babel/traverse, @babel/parser and the TypeScript plugin.
    • The rows fail with no stamps kept, and with Babel's environment left out of the key.
  • test/packed-gather-cache.records.test.mjs: doctor's cache row names the entry.
  • api/theme, foundation/fs, the records tests and the lazy-dependency tests pass. The 14 api/theme-edit failures on the test machine fail the same way on main.

Spec changes

spec:AST-081 FR7, architecture:cli-surface INV10 and doctor's cache row add "the JavaScript theme build compiles from a theme's local TypeScript or JSX modules" to the per-user cache's entries. This needs an engineering owner's /approve-spec.

Writing rubric results

For the FR7 and INV10 additions:

  • R1 narration: none; the phrase states what the per-user cache holds.
  • R2 research: none in the records; the measurements stay in this description.
  • R3 evidence: none cited.
  • R4 rejected alternatives: none.
  • R5 change references: none.
  • R6 open questions: none.
  • R7 project status: none.

Scope

No theme build output, flag or JSON shape changes; doctor's cache row names the new entry.

@vercel

vercel Bot commented Nov 16, 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 16, 2026 6:10am UTC

Request Review

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

astracat-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

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

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 16, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec aa2a96c

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 16, 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.

Changes requested: the kept compile is a clear speed-up and its tests pass, but two things need fixing first.

  • self-contained.mjs stamps Babel's files after the compile (lines 379-387), so a process that loaded Babel and outlives a Babel reinstall keeps JavaScript from the old Babel under the new files' stamps and later builds read it back until the module changes; stamp the compiler files once when the process first loads them and keep a later compile only while its stamps still match those.
  • The changeset says a repeat build "loads no Babel", but every build still loads @babel/parser to read the module's imports, so say it loads neither @babel/core nor its TypeScript and JSX plugins.

The per-user cache additions to the global-mode and CLI-surface records are approved for this head. While you are in there, the header of self-contained.mjs still says it reads files only through the adapter's reader, and the gather-cache.mjs header does not list this new user of persistedSummary.

Claims and files checked

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

Claims:

  • A repeat build of an unchanged module is about 200 ms faster: consistent; a one-module probe read back in about 22 ms against about 143 ms for a first compile (the description's benchmark was not re-run).
  • The compiled JavaScript is read back while the source, options, rewritten imports and Babel's files are unchanged: verified in a fresh process (new tests; mutations); false in a process that loaded Babel before a reinstall (first finding).
  • Such a build loads no Babel: false; @babel/parser still loads (second finding).
  • A first build and a build after an edit compile as before: verified (the source is in the key; test).
  • The written files do not change: verified (tests compare with a fresh compile; the seven published themes build to identical theme.css on base and head).
  • The key holds the file name, babelrc: false, configFile: false, source type, plugin paths and options, the rewrites and the rewriting plugin's code: verified (compileOptions, compileModule).
  • Babel's environment (BABEL_ENV, else NODE_ENV) is in the key: verified; removing it fails the environment row.
  • The CLI build id is part of the entry: verified (summaryAt).
  • Every file of the compiling code is stamped and a reinstall compiles again: verified for a new process; false for a process that loaded Babel before the reinstall (first finding).
  • A module that fails to compile keeps nothing: verified (test).
  • A project Babel config or .babelrc has no effect: verified (test).
  • Kept only where the private per-user catalogs folder exists: verified (gatherCacheDir).
  • The two records and doctor's cache row name the new entry: verified (diff; doctor row test passes).
  • The tests' rows fail with no stamps kept and with the environment left out of the key: verified by mutation.
  • The stamps include @babel/core, @babel/generator, @babel/traverse, @babel/parser and the TypeScript plugin: verified (test passes).
  • The doc-loads registry lists the require.cache read: verified (test passes).
  • Read-back takes about 4 ms for 614 stamps: not reproduced exactly; 279 stamps per TSX-only entry here.
  • The theme-edit suite's 14 local failures also fail on main: not checked; two node test shards were still running at the last CI read.

Files:

  • .changeset/theme-build-compiled-modules-kept.md: second finding.
  • docs/architecture/cli-surface.md: clear.
  • docs/specs/AST-081-global-mode/spec.md: clear.
  • packages/cli/api/doctor/doctor.mjs: clear.
  • packages/cli/api/theme/build/self-contained.kept.test.mjs: clear; all five tests fail with the base module and pass on the head.
  • packages/cli/api/theme/build/self-contained.mjs: first finding; stale header line.
  • packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.
  • packages/cli/test/packed-gather-cache.records.test.mjs: clear.

Automated review (maintainer link)

# Conflicts:
#	docs/architecture/cli-surface.md
#	packages/cli/api/doctor/doctor.mjs
… while they match; headers; changeset wording
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 08c0112

@github-actions github-actions Bot added needs:spec-owner-review Current knowledge records await owner approval and removed needs:spec-owner-review Current knowledge records await owner approval labels Nov 16, 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.

Changes requested: the kept compile works, its tests pass, and the changeset wording is fixed, but one stamping gap remains.

  • self-contained.mjs (lines 397-401) takes each Babel file's stamp when a compile first finds it loaded, so a long-lived process that loaded Babel another way before a reinstall (the template source traversal, the example preview, or the import scan's @babel/parser) stores its first theme compile from the old Babel under the new files' stamps and later runs read it back; keep a compile only when no stamped file changed after the process started, or stamp Babel's modules when they are first required, and add a test that loads Babel, simulates the reinstall, and expects the first compile to keep nothing.

The per-user cache entries in the global-mode and CLI-surface records are approved for this head, and the case where an earlier theme compile loaded Babel is now covered by the new reinstall test.

Claims and files checked

Review mode: full; reason: spec-record

Claims:

  • A repeat build of an unchanged local module finishes about 200 ms sooner: consistent; in the test harness a two-module registry builds in about 180 ms with a compile and about 27 ms read back (the end-to-end benchmark was not re-run).
  • The compiled JavaScript is read back while the source, options, rewrites and Babel's files are unchanged: verified in a new process and when an earlier theme compile loaded Babel; false when Babel was loaded another way before a reinstall (finding above).
  • Such a build loads neither @babel/core nor its TypeScript and JSX plugins, and still uses @babel/parser: verified (no core or plugin module loaded on a read-back).
  • A first build and a build after an edit compile as before: verified (tests).
  • The written files do not change: verified (tests compare with a fresh compile; the seven published themes build identical theme.css on base and head).
  • The key holds the file name, babelrc: false, configFile: false, the source type, the plugins' paths and options, the rewrites and the rewriting plugin's code: verified (compileOptions, compileModule).
  • Babel's environment (BABEL_ENV, else NODE_ENV) is in the key: verified; removing it fails the environment row.
  • The CLI's build id is part of the entry: verified (entries are keyed on it).
  • Every file of the compiling code is stamped as the process first found it: verified as stated.
  • A process that loaded Babel before a reinstall keeps nothing: false when another path loaded Babel first (finding above); verified when an earlier theme compile loaded it.
  • A reinstall that resolves another version compiles again: verified for a new process (a changed stamp misses).
  • A module that fails to compile keeps nothing: verified (test).
  • A project Babel config or .babelrc has no effect: verified (test).
  • Kept only where the per-user catalogs folder exists: verified (the compile never creates the folder).
  • The two records and doctor's cache row name the entry: verified (diff; doctor row test passes).
  • The reinstall test fails when stamps are taken after each compile: verified (it fails with the previous head's code).
  • The rows fail with no stamps kept and with the environment left out of the key: verified (both mutations fail rows).
  • The stamps include @babel/core, @babel/generator, @babel/traverse, @babel/parser and the TypeScript plugin: verified (test passes).
  • The doc-loads registry lists the require.cache read: verified (test passes).
  • Read-back takes about 4 ms for 614 stamps: not reproduced as stated; two entries of 279 stamps read back in about 27 ms in the test harness.
  • The theme, file-system, records and lazy-dependency tests pass: the records, lazy-dependency, doc-loads and self-contained build tests pass here (163 passed, 1 skipped); the full theme and file-system suites were still running.
  • The 14 theme-edit failures on the author's machine also fail on main: not checked; the theme-edit suite was still running.
  • No output, flag or JSON shape changes: verified for theme build's files, flags and JSON; doctor's row gains the entry, as the description says.

Files:

  • .changeset/theme-build-compiled-modules-kept.md: the stamp sentence is false in the case of the finding; the rest clear.
  • docs/architecture/cli-surface.md: clear.
  • docs/specs/AST-081-global-mode/spec.md: clear.
  • packages/cli/api/doctor/doctor.mjs: clear.
  • packages/cli/api/theme/build/self-contained.kept.test.mjs: clear; five of six tests fail with the base module and all pass on this head; the reinstall test does not cover Babel loaded another way.
  • packages/cli/api/theme/build/self-contained.mjs: finding above.
  • packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.
  • packages/cli/foundation/fs/gather-cache.mjs: clear.
  • packages/cli/test/packed-gather-cache.records.test.mjs: clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec cef2cb3

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 93ad257

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 04fe094

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 931c3f9

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 4bf05c1

# Conflicts:
#	docs/architecture/cli-surface.md
#	docs/specs/AST-081-global-mode/spec.md
#	packages/cli/api/doctor/doctor.mjs
#	packages/cli/foundation/fs/gather-cache.mjs
#	packages/cli/test/packed-gather-cache.records.test.mjs
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 0b949ec

@github-actions github-actions Bot added needs:spec-owner-review Current knowledge records await owner approval and removed needs:spec-owner-review Current knowledge records await owner approval labels Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 35b671e

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.07 MB packed (+2.2 kB); no new dependencies.

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


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 reinstall gap from the last review is closed and the kept compile's tests pass, but two things remain.

  • Miss: the kept compile is checked against the files of Babel's code but not against where @babel/core resolves its modules, so after a reinstall that points core at another copy of @babel/generator, @babel/parser or @babel/types while the old copy stays on disk (as the CLI's exact 7.29.8 pins on parser and types leave it after a Babel patch release), the next theme build reads back JavaScript a fresh compile no longer writes; please record those resolutions too (for example real: stamps, which persistedSummary already checks) and add a test that moves one dependency link and expects a compile.
  • The description lists foundation/fs/loaded-files.mjs as new and a doc-loads.test.mjs change, but both are already on main (from #11961) and neither is part of this diff, so please update those two bullets.

The global-mode and CLI-surface record entries are approved for this head, the public API is unchanged, and the seven published themes build identical CSS.

Claims and files checked

Review mode: full; reason: spec-record

Claims (description):

  • Each local TypeScript or JSX module is compiled on every build, about 300 ms with an icon registry: consistent; a two-module registry compiles in about 230 ms in the test harness.
  • The compiled JavaScript is kept beside the kept gathers and read back while its inputs are unchanged: verified (new tests; a read-back in a fresh process).
  • The key covers the source text: verified (the edit row).
  • The key covers the compile options, including both plugins' paths and options and the switched-off config files: verified (compileOptions; the renamed-module row).
  • The key covers the rewritten imports and the rewriting plugin's code: verified (the rewrites row).
  • The key covers Babel's environment name: verified (leaving it out fails the environment row).
  • Entries are tied to the CLI's build id: verified (entries are keyed on it).
  • Every file of the compiling code is stamped, and a compile is kept only when all of them predate the process start by 2 s: verified (both reinstall tests; keeping regardless of times fails them).
  • A process that loaded Babel before a reinstall keeps nothing: verified (both reinstall tests).
  • A reinstall that resolves another version of any of those modules compiles again: false when the old copy stays on disk (first finding).
  • The stamping module is new in this change: false; it is already on main (second finding).
  • A build of an unchanged theme loads neither @babel/core nor its plugins and still parses imports with @babel/parser: verified (no core or plugin module loaded on a read-back; the parser loaded).
  • A module that fails to compile keeps nothing: verified (test).
  • A first build and a build after an edit compile as before: verified (tests).
  • A project Babel config or .babelrc beside the theme has no effect: verified (test).
  • Kept only where the per-user catalogs folder exists: verified (the store lookup answers nothing without a private folder, and the compile never creates it).
  • The two records and doctor's cache row name the new entry: verified (diff; the records test).
  • The measured runs print the same output and write byte-identical folders: consistent; a read-back equals a fresh compile in the tests, and the seven published themes build identical CSS (the end-to-end runs were not repeated).
  • A read-back costs about 4 ms for 614 stamps: not reproduced as stated; two entries of 279 stamps read back in about 35 ms in the test harness, import scan included.

Claims (tests in the description):

  • A second build asks for Babel 0 times and matches a fresh compile: verified.
  • A project Babel config beside the theme changes nothing: verified.
  • Each listed change compiles again and is read back next: verified.
  • A failed compile keeps nothing and fails again: verified.
  • After a reinstall during a run nothing compiled is kept, also when Babel was loaded another way first, and both tests fail when compiles are kept whatever the times: verified (mutation).
  • The stamps include core, generator, traverse, parser and the TypeScript plugin: verified.
  • The rows fail with no stamps kept and with the environment left out of the key: verified (mutations).
  • Doctor's cache row names the entry: verified (the records test).
  • The doc-loads test lists the module's require-cache read: false for this change; that row came with the module on main (second finding).
  • The theme, file-system, records and lazy-dependency tests pass: verified, apart from one temp-folder test that fails the same way on the base in this environment; the theme-edit tests pass here.
  • No theme build output, flag or JSON shape changes beyond doctor's row: verified.

Claims (changeset):

  • A repeat build of an unchanged module finishes about 200 ms sooner: consistent (about 230 ms to about 35 ms in the test harness).
  • The JavaScript is read back while the source, options, rewritten imports and every file of the Babel that compiled it are unchanged: verified as written; a moved module is the first finding.
  • Such a build loads neither @babel/core nor its TypeScript and JSX plugins: verified.
  • A first build and a build after an edit compile as before, and the written files do not change: verified.

Files:

  • .changeset/theme-build-compiled-modules-kept.md: clear.
  • docs/architecture/cli-surface.md: clear.
  • docs/specs/AST-081-global-mode/spec.md: clear.
  • packages/cli/api/doctor/doctor.mjs: clear.
  • packages/cli/api/theme/build/self-contained.kept.test.mjs: clear; five of seven tests fail against the base module; no test moves a dependency link.
  • packages/cli/api/theme/build/self-contained.mjs: first finding.
  • packages/cli/foundation/fs/gather-cache.mjs: clear.
  • packages/cli/test/packed-gather-cache.records.test.mjs: clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 3059e3f

@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: this head changes no file, so both findings below still apply.

  • Miss: the kept compile is checked against the files of Babel's code but not against where @babel/core resolves its modules, so after a reinstall that points core at another copy of @babel/generator, @babel/parser or @babel/types while the old copy stays on disk (as the CLI's exact 7.29.8 pins on parser and types leave it after a Babel patch release), the next theme build reads back JavaScript a fresh compile no longer writes; please record those resolutions too (for example real: stamps, which persistedSummary already checks) and add a test that moves one dependency link and expects a compile.
  • The description lists foundation/fs/loaded-files.mjs as new and a doc-loads.test.mjs change, but both are already on main (from #11961) and neither is part of this diff, so please update those two bullets.

The global-mode and CLI-surface record entries are approved for this head, CI passes, the public API is unchanged, and the seven published themes build identical CSS.

Claims and files checked

Review mode: incremental; reason: none

changed rules (0): none

Claims (description):

  • Each local TypeScript or JSX module is compiled on every build, about 300 ms with an icon registry: consistent with the code; the end-to-end timing was not re-run.
  • The compiled JavaScript is kept beside the kept gathers and read back while its inputs are unchanged: verified (new tests; a read-back in a fresh process).
  • The key covers the source text: verified (the edit row).
  • The key covers the compile options, including both plugins' paths and options and the switched-off config files: verified (compileOptions; the renamed-module row).
  • The key covers the rewritten imports and the rewriting plugin's code: verified (the rewrites row).
  • The key covers Babel's environment name: verified (leaving it out fails the environment row).
  • Entries are tied to the CLI's build id: verified (entries are keyed on it).
  • Every file of the compiling code is stamped, and a compile is kept only when all of them predate the process start by 2 s: verified (both reinstall tests; keeping regardless of times fails them).
  • A process that loaded Babel before a reinstall keeps nothing: verified (both reinstall tests).
  • A reinstall that resolves another version of any of those modules compiles again: false when the old copy stays on disk (first finding).
  • The stamping module is new in this change: false; it is already on main (second finding).
  • A build of an unchanged theme loads neither @babel/core nor its plugins and still parses imports with @babel/parser: verified (no Babel request on a read-back; the plugins are passed as paths Babel loads only during a compile).
  • A module that fails to compile keeps nothing: verified (test).
  • A first build and a build after an edit compile as before: verified (tests).
  • A project Babel config or .babelrc beside the theme has no effect: verified (test).
  • Kept only where the per-user catalogs folder exists: verified (the store lookup answers nothing without a private folder, and the compile never creates it).
  • The two records and doctor's cache row name the new entry: verified (diff; the records test).
  • The measured runs print the same output and write byte-identical folders: consistent; a read-back equals a fresh compile in the tests, and the seven published themes build identical CSS.
  • A read-back costs about 4 ms for 614 stamps: not re-measured; each kept entry here holds 279 stamps.

Claims (tests in the description):

  • A second build asks for Babel 0 times and matches a fresh compile: verified.
  • A project Babel config beside the theme changes nothing: verified.
  • Each listed change compiles again and is read back next: verified.
  • A failed compile keeps nothing and fails again: verified.
  • After a reinstall during a run nothing compiled is kept, also when Babel was loaded another way first, and both tests fail when compiles are kept whatever the times: verified (mutation).
  • The stamps include core, generator, traverse, parser and the TypeScript plugin: verified.
  • The rows fail with no stamps kept and with the environment left out of the key: verified (mutations).
  • Doctor's cache row names the entry: verified (the records test).
  • The doc-loads test lists the module's require-cache read: false for this change; that row came with the module on main (second finding).
  • The theme, file-system, records and lazy-dependency tests pass: verified for the theme build folder and the records test; CI's test jobs pass at this head.
  • No theme build output, flag or JSON shape changes beyond doctor's row: verified.

Claims (changeset):

  • A repeat build of an unchanged module finishes about 200 ms sooner: consistent with the skipped compile; not re-timed.
  • The JavaScript is read back while the source, options, rewritten imports and every file of the Babel that compiled it are unchanged: verified as written; a moved module is the first finding.
  • Such a build loads neither @babel/core nor its TypeScript and JSX plugins: verified.
  • A first build and a build after an edit compile as before, and the written files do not change: verified.

Files:

  • .changeset/theme-build-compiled-modules-kept.md: clear.
  • docs/architecture/cli-surface.md: clear.
  • docs/specs/AST-081-global-mode/spec.md: clear.
  • packages/cli/api/doctor/doctor.mjs: clear.
  • packages/cli/api/theme/build/self-contained.kept.test.mjs: clear; no test moves a dependency link.
  • packages/cli/api/theme/build/self-contained.mjs: first finding.
  • packages/cli/foundation/fs/gather-cache.mjs: clear.
  • packages/cli/test/packed-gather-cache.records.test.mjs: clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec c01bb2b

@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 required checks have not finished on this head yet.

Both findings from the last review are fixed: a reinstall that points @babel/core at another copy of one of its packages now compiles again (the new relink tests fail without the folder stamps, and a real relink of @babel/generator recompiles and writes what the installed Babel writes), and the description no longer credits this change with files already on main. The global-mode and CLI-surface record entries are approved for this head, the public API is unchanged, and the seven published themes build identical CSS.

Claims and files checked

Review mode: incremental; reason: none

changed rules (0): none

Claims (description):

  • Each local TypeScript or JSX module is compiled with Babel on every build, about 300 ms with an icon registry: consistent with the code on main; the timing was not re-run.
  • The compiled JavaScript is kept beside the kept gathers and read back while its inputs are unchanged: verified (kept test; a read-back in a fresh process).
  • The key covers the source text, the compile options (file name, both config switches, source type, plugin paths and options), the rewritten imports with the rewriting plugin's code, and Babel's environment name: verified (the compile key; the compiles-again rows).
  • Entries are tied to the CLI's build id: verified (entries are keyed on it).
  • Every file of the compiling code, wherever it is installed, is stamped by its full stamp: verified (stamps test; dropping the stamps fails four tests).
  • Every package folder Node's lookup took is stamped by the real path it resolves to, so a reinstall that points a lookup at another copy and leaves the old one compiles again: verified (relink tests; leaving the folders out fails both; a real relink of core's @babel/generator recompiles).
  • A compile is kept only when every stamped file and folder last changed at least 2 s before the process started, so a process that loaded Babel before a reinstall keeps nothing: verified for files (both reinstall tests; keeping regardless of times fails them); the folder half is in the code, with no test.
  • The shared stamping helper now also stamps lookup folders, replacing its two old functions, and css-tree's kept answers stamp their folders the same way: verified (diff; the css-tree relink test).
  • A build of an unchanged theme loads neither @babel/core nor its plugins and still parses imports with @babel/parser: verified (no Babel request on a read-back).
  • A module that fails to compile keeps nothing, and a first build or a build after an edit compiles as before: verified (tests).
  • A project Babel config or .babelrc beside the theme has no effect: verified (test).
  • Entries are kept only where the per-user catalogs folder exists: verified (the store lookup answers nothing without a private folder).
  • The two records and doctor's cache row name the new entry: verified (diff; records test).
  • The measured runs print the same output and write byte-identical folders: consistent (a read-back equals a fresh compile; the seven published themes build identical CSS); timings not re-run.
  • A read-back costs about 4 ms for 614 stamps: not re-measured; each kept entry here holds about 360 stamps.

Claims (tests in the description):

  • A second build asks for Babel 0 times and matches a fresh compile: verified.
  • A project Babel config beside the theme changes nothing: verified.
  • Each listed change compiles again and is read back next: verified.
  • A failed compile keeps nothing and fails again: verified.
  • A reinstall during a run keeps nothing, also when Babel was loaded another way first, and both tests fail when compiles are kept whatever the times: verified (mutation).
  • Relinking core's @babel/generator, or css-tree's mdn-data, compiles again, and both tests fail without the folder stamps: verified (mutation).
  • The stamps include core, generator, traverse, parser and the TypeScript plugin: verified.
  • The rows fail with no stamps kept and with the environment left out of the key: verified (mutations).
  • Doctor's cache row names the entry: verified (records test).
  • The theme, file-system, records and lazy-dependency tests pass: verified for the theme build folder, the file-system and runtime folders, the records and lazy-dependency tests (one temp-folder test in an unchanged file fails only in the review sandbox); the theme-edit failures on the author's machine were not checked.
  • No theme build output, flag or JSON shape changes beyond doctor's row: verified (no public API rows; identical theme CSS).

Claims (changeset):

  • A repeat build of an unchanged module finishes about 200 ms sooner: consistent with the skipped compile; not re-timed.
  • The JavaScript is read back while the source, options, rewritten imports and every file of the Babel that compiled it are unchanged: verified.
  • Such a build loads neither @babel/core nor its TypeScript and JSX plugins: verified.
  • A first build and a build after an edit compile as before, and the written files do not change: verified.

Files:

  • .changeset/theme-build-compiled-modules-kept.md: clear.
  • docs/architecture/cli-surface.md: clear.
  • docs/specs/AST-081-global-mode/spec.md: clear.
  • packages/cli/api/doctor/doctor.mjs: clear.
  • packages/cli/api/theme/build/css-checks.kept.test.mjs: clear.
  • packages/cli/api/theme/build/self-contained.kept.test.mjs: clear.
  • packages/cli/api/theme/build/self-contained.mjs: clear.
  • packages/cli/foundation/fs/gather-cache.mjs: clear.
  • packages/cli/foundation/fs/loaded-files.mjs: clear.
  • packages/cli/foundation/runtime/css-tree.mjs: clear.
  • packages/cli/test/packed-gather-cache.records.test.mjs: clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 35b671e

@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 CI run on this head was refused for lack of room under the CI ceiling and ran no tests, so the required checks still need a re-run of all jobs.

The new commit changes no file, so the kept compile is the code reviewed before, and each of its guards is still pinned by a test that fails without it: the compile key, Babel's file stamps, the process-start rule and the stamped lookup folders. The global-mode and CLI-surface record entries are approved for this head, the public API is unchanged, and the seven published themes build identical CSS.

Claims and files checked

Review mode: incremental; reason: none

changed rules (0): none

Claims (description):

  • Each local TypeScript or JSX module was compiled with Babel on every build, about 300 ms with an icon registry: consistent with the code on main, where the compile is unconditional; the timing was not re-run.
  • The compiled JavaScript is kept beside the kept gathers and read back while its inputs are unchanged: verified (kept test).
  • The key covers the source text, the compile options (file name, both config switches, source type, plugin paths and options), the rewritten imports with the rewriting plugin's code, and Babel's environment name: verified (the compile key; the compiles-again test; leaving the environment out fails it).
  • Entries are tied to the CLI's build id: verified (entries are keyed on it).
  • Every file of the compiling code, wherever it is installed, is stamped by its full stamp: verified (stamps test; dropping the stamps fails four tests).
  • Every package folder Node's lookup took is stamped by the real path it resolves to, so a reinstall that points a lookup at another copy and leaves the old one compiles again: verified (both relink tests; leaving the folders out fails both).
  • A compile is kept only when every stamped file and folder last changed at least 2 s before the process started, so a process that loaded Babel before a reinstall keeps nothing: verified for files (both reinstall tests; keeping regardless of times fails both); the folder half is in the code, with no test.
  • The shared stamping helper now also stamps lookup folders, replacing its two old functions, and css-tree's kept answers stamp their module and data folders the same way: verified (no caller of the old functions remains; the css-tree relink test).
  • A build of an unchanged theme loads neither @babel/core nor its plugins and still parses imports with @babel/parser: verified (no Babel request on a read-back; a whole build with nothing to compile loads no Babel core or plugin module).
  • A module that fails to compile keeps nothing, and a first build or a build after an edit compiles as before: verified (tests).
  • A project Babel config or .babelrc beside the theme has no effect: verified (test; the compile options are those of main).
  • Entries are kept only where the per-user catalogs folder exists: verified (no private folder, no entry; the compile never creates it).
  • The two records and doctor's cache row name the new entry: verified (diff; records test).
  • The measured runs print the same output and write byte-identical folders: consistent (a read-back equals a fresh compile; the seven published themes build identical CSS); timings not re-run.
  • A read-back costs about 4 ms for 614 stamps: not re-measured.

Claims (tests in the description):

  • A second build asks for Babel 0 times and matches a fresh compile: verified.
  • A project Babel config beside the theme changes nothing: verified.
  • Each listed change compiles again and is read back next: verified.
  • A failed compile keeps nothing and fails again: verified.
  • A reinstall during a run keeps nothing, also when Babel was loaded another way first, and both tests fail when compiles are kept whatever the times: verified (mutation).
  • Relinking core's @babel/generator, or css-tree's mdn-data, compiles again, and both tests fail without the folder stamps: verified (mutation).
  • The stamps include core, generator, traverse, parser and the TypeScript plugin: verified.
  • The rows fail with no stamps kept and with the environment left out of the key: verified (mutations).
  • Doctor's cache row names the entry: verified (records test).
  • The theme, file-system, records and lazy-dependency tests pass: verified for the theme, file-system and runtime folders and the records and lazy-dependency tests (one temp-folder test in an unchanged file fails the same way on main in the review sandbox); the theme-edit failures on the author's machine were not checked.

Claims (spec changes, rubric, scope):

  • FR7, INV10 and doctor's row add the entry and need an engineering owner's approval: verified (diff; owner approval for this head).
  • The added record phrase carries no narration, research, evidence, alternatives, references, open questions or status: verified (diff).
  • No theme build output, flag or JSON shape changes beyond doctor's row: verified (no public API rows; identical theme CSS; no command doc change).

Claims (changeset):

  • A repeat build of an unchanged module finishes about 200 ms sooner: consistent with the skipped compile; not re-timed.
  • The JavaScript is read back while the source, options, rewritten imports and every file of the Babel that compiled it are unchanged: verified.
  • Such a build loads neither @babel/core nor its TypeScript and JSX plugins: verified.
  • A first build and a build after an edit compile as before, and the written files do not change: verified.

Files:

  • .changeset/theme-build-compiled-modules-kept.md: clear.
  • docs/architecture/cli-surface.md: clear.
  • docs/specs/AST-081-global-mode/spec.md: clear.
  • packages/cli/api/doctor/doctor.mjs: clear.
  • packages/cli/api/theme/build/css-checks.kept.test.mjs: clear.
  • packages/cli/api/theme/build/self-contained.kept.test.mjs: clear.
  • packages/cli/api/theme/build/self-contained.mjs: clear.
  • packages/cli/foundation/fs/gather-cache.mjs: clear.
  • packages/cli/foundation/fs/loaded-files.mjs: clear.
  • packages/cli/foundation/runtime/css-tree.mjs: clear.
  • packages/cli/test/packed-gather-cache.records.test.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina merged commit dd94472 into main Nov 16, 2026
248 of 297 checks passed
@github-actions
github-actions Bot deleted the speed/theme-module-kept branch November 17, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 35b671e6 Deployed Nov 16, 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