Repository navigation
fix(cli): --check reads a theme family's committed compiled registries - #13388
josephfarina wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, and it runs once the pull request targets main and is out of draft.
theme build --family … --check now passes on an up-to-date family with a .tsx or .jsx registry and names a stale or missing compiled copy, and the two new tests fail without the change. There are no blocking findings.
- Optional: the new up-to-date test at
packages/cli/api/theme/build/build.mjs:2721repeatsstaleBuildOutputs's per-file comparison; deriving it fromstaleBuildOutputswould keep the registry skip and the stale report from drifting apart.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: With the parent change, a family whose member has a local TypeScript or JSX registry builds, but its family check failed right after the build with an unknown-extension import error: verified (the new up-to-date test fails on the base with that error).
- Claim: A single build check of the same member reports it up to date: verified (probe exits 0 on the base and the head).
- Claim: Under the check, when every compiled module matches its committed copy, each compiled registry is checked by importing that copy, and nothing is written: verified (
build.mjs:2718-2722; the read-only folder test and probe). - Claim: When a compiled copy is stale or missing, those registries are not imported and the output comparison reports the file: verified (
build.mjs:2722; the stale test; the missing-copy probe). - Claim: Registries that are not compiled are still checked from their source: verified (
build.mjs:2716-2717,:2722). - Claim: New test, a
.tsxfamily is up to date right after its build, fails on the parent: verified (fails on the base, passes on the head). - Claim: New test, an edited registry is reported stale as
ocean-family.modules/icons.tsx.js, fails on the parent: verified (fails on the base, passes on the head). - Claim: New test, a
.tsregistry whose installed dependency drops an export still fails the check with the import error: verified (passes on the head). - Claim: The new tests run the CLI in its own process: verified (
build.self-contained.test.mjs:102-107spawns Node with the CLI bin). - Claim: The named test run gives 816 passed and 2 skipped: consistent (815 passed and 2 skipped here; the one other test lists files with git and finds none in a tree copy without a repository).
- Claim: Release note: the family check reports a family with a local TypeScript or JSX registry up to date right after its build, imports the committed copies, writes nothing, and leaves a stale or missing copy to the output comparison: verified (
.tsxtest,.jsxprobe,.tsread-only test, stale test, missing probe). - Claim: Release note edit: the parent's note no longer says the check reads registries as before, which this change makes untrue: verified (
build.mjs:2718-2722); the rest of that note passes the head's build tests. - File:
packages/cli/api/theme/build/build.mjs: non-blocking note (the up-to-date test repeats the stale comparison's per-file test). - File:
packages/cli/api/theme/build/build.self-contained.test.mjs: clear. - File:
.changeset/family-check-committed-modules.md: clear. - File:
.changeset/family-build-compiled-registry-check.md: clear.
| if (check) { | ||
| // The committed copies are imported only when every module this build | ||
| // compiles matches its committed copy: a copy imports the others. | ||
| const current = writes.every(write => path.relative(modulesDir, write.dest).startsWith('..') || (fs.existsSync(write.dest) && normalizeThemeBuildForCompare(fs.readFileSync(write.dest, 'utf8')) === normalizeThemeBuildForCompare(write.content))); |
There was a problem hiding this comment.
Non-blocking: this repeats the per-file test in staleBuildOutputs (lines 975-987). Skipping compiled registries is safe only while the two agree. They already differ for a missing write marked warnWhenMissing, which no module write has today. Deriving current from staleBuildOutputs over the module writes keeps one predicate for both.
A family whose member has a local TypeScript or JSX registry builds, but --check checked that registry from its source, so it failed right after a successful build. When every module the build compiles matches its committed copy in <family-key>.modules/, --check now imports each compiled registry from that committed copy, as the family module does, and writes nothing; when a copy is stale or missing, the comparison of the outputs reports it. Tests run the CLI in its own process: a .tsx family is up to date right after its build; a changed registry is reported stale, not as a registry it cannot import (both fail on the parent); a dependency that drops an export the registry imports still fails --check.
93a4f13 to
d901f60
Compare
c99a2d5 to
23a79ca
Compare
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet; the CI workflow runs for pull requests to main, so it runs once this pull request targets main.
theme build --family … --check now passes on an up-to-date family with a .tsx or .jsx registry and names a stale or missing compiled copy, and the two new tests fail without the change. There are no blocking findings.
- Optional: the new up-to-date test at
packages/cli/api/theme/build/build.mjs:2721repeatsstaleBuildOutputs's per-file comparison; deriving it fromstaleBuildOutputswould keep the registry skip and the stale report from drifting apart.
Claims and files checked
Review mode: carry-forward; reason: none
- Claim: With the parent change, a family whose member has a local TypeScript or JSX registry builds, but its family check failed right after the build with an unknown-extension import error: verified (the new up-to-date test fails on the parent with that error).
- Claim: A single build check of the same member reports it up to date: verified (probe exits 0 on the base and the head).
- Claim: Under the check, when every compiled module matches its committed copy, each compiled registry is checked by importing that copy, and nothing is written: verified (
build.mjs:2718-2722; the read-only folder test and probe). - Claim: When a compiled copy is stale or missing, those registries are not imported and the output comparison reports the file: verified (
build.mjs:2722; the stale test; the missing-copy probe). - Claim: Registries that are not compiled are still checked from their source: verified (
build.mjs:2716-2717,:2722). - Claim: New test, a
.tsxfamily is up to date right after its build, fails on the parent: verified (fails on the parent, passes with the change). - Claim: New test, an edited registry is reported stale as
ocean-family.modules/icons.tsx.js, fails on the parent: verified (fails on the parent, passes with the change). - Claim: New test, a
.tsregistry whose installed dependency drops an export still fails the check with the import error: verified (passes on the head). - Claim: The new tests run the CLI in its own process: verified (
build.self-contained.test.mjs:102-107spawns Node with the CLI bin). - Claim: The named test run gives 816 passed and 2 skipped: consistent (a run of the same patch gave 815 passed and 2 skipped; the one other test lists files with git and finds none in a tree copy without a repository).
- Claim: Release note: the family check reports a family with a local TypeScript or JSX registry up to date right after its build, imports the committed copies, writes nothing, and leaves a stale or missing copy to the output comparison: verified (
.tsxtest,.jsxprobe,.tsread-only test, stale test, missing probe). - Claim: Release note edit: the parent's note no longer says the check reads registries as before, which this change makes untrue: verified (
build.mjs:2718-2722); the rest of that note passes the head's build tests. - File:
packages/cli/api/theme/build/build.mjs: non-blocking note (the up-to-date test repeats the stale comparison's per-file test). - File:
packages/cli/api/theme/build/build.self-contained.test.mjs: clear. - File:
.changeset/family-check-committed-modules.md: clear. - File:
.changeset/family-build-compiled-registry-check.md: clear.
- #13358 fix(cli): a theme family checks its compiled registries as plain Node loads them Author: @josephfarina - #13388 fix(cli): --check reads a theme family's committed compiled registries Author: @josephfarina - #13464 experimental theme: a resting background color, outline or shadow keeps a part's hover and keyboard focus visible Author: @josephfarina - #13433 cli(icons): icon response types say "icon meaning" and "variant" Author: @josephfarina - #13456 feat(templates): dashboard-scorecard shows two headline numbers per row on a phone when they fit Author: @josephfarina - #13473 docs(icons): icon-set guide's relatives line; template icons say icon component Author: @josephfarina
|
Landed in #13542. |
fix(cli): --check reads a theme family's committed compiled registries
What changes
With #13358 a family whose member has a local TypeScript or JSX registry builds, but
theme build --family … --checkstill checked that registry from its source with Node, so it failed (Cannot import family registry … Unknown file extension ".tsx") right after a successful build — while a singletheme build --checkof the same member reports it up to date.Now, under
--check, when every module the build compiles matches its committed copy in<family-key>.modules/(the same comparison--checkalready makes), each compiled registry is checked by importing that committed copy with Node — exactly what the family module imports — and nothing is written (spec:AST-034FR8). When any compiled copy is stale or missing, those registries are not imported; the comparison of the outputs reports the stale or missing file, as for every other output. Registries that are not compiled are checked from source, as before.Testing
New tests in
build.self-contained.test.mjsrun the CLI in its own process (plain Node):.tsxfamily is reported up to date by--checkright after its build (fails on the parent);--checkreportsocean-family.modules/icons.tsx.jsstale instead of failing to import it (fails on the parent);.tsregistry whose installed dependency drops the export it imports still fails--checkwithCannot import family registry(the committed copy is imported).vitest run packages/cli/api/theme/build packages/cli/foundation/doc-compiler/doc-loads.test.mjs packages/cli/test/experimental-isolation.test.mjs: 816 pass, 2 skipped.Stack: #13358 → #13388
preflight: pass 23a79ca