Repository navigation
fix(core): a local token left undefined is not set; root localTokens: undefined is refused by name - #11802
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
This needs an owner decision and one wording fix before it can be approved.
Treating a local token left undefined as not set follows the current records: local values normalize like tokens, and the theme-authoring contract already covers adaptation rules. No current record says whether a root localTokens: undefined counts as omitting the field, since AST-006 speaks only of supplying the field or its absence, and the theme-authoring contract deliberately refuses extends: undefined. An engineering owner can settle that by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner), or the pull request can extend the theme-authoring contract's undefined sentence to cover root localTokens.
- Narrow the changeset sentence "as every other theme value left
undefinedalready is" (.changeset/core-theme-undefined-local-tokens.md:5) and the matching line in the description, becauseextends: undefinedthrows and aniconsorindicatorsentry leftundefinedreplaces the inherited entry; for example, write "as a token, or a value in a part, surface or adaptation rule, leftundefinedalready is".
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim:
localTokens: undefinedis not set and the theme loads: verified by the new test and an extended-theme check. - Claim: a local token left
undefined, in the theme or in an adaptation rule, is not set and writes no CSS: verified by the new test and an adaptation-rule check. - Claim: every other theme value or field left
undefinedis already not set: false forextends,iconsandindicators. - Claim: before, these inputs were refused with the quoted errors: verified; an unenrolled name in an adaptation rule was refused as "cannot enroll" instead.
- Claim: the two new tests fail on the old Core and pass with the fix: verified.
- Claim: Core theme tests pass: verified (31 files, 1,802 tests).
- File
.changeset/core-theme-undefined-local-tokens.md: finding on line 5. - File
packages/core/src/theme/defineTheme.test.ts: clear. - File
packages/core/src/theme/localTokens.ts: owner decision on line 266; optional comment rewrite on line 265.
…n rule that writes it still fails with its name
…: undefined is; a local token left undefined stays not set
|
/approve-spec 698b6c5 |
There was a problem hiding this comment.
Changes requested for one fix: the pull request title no longer matches what the code does.
- The title says a root
localTokens: undefinedis not set, but this head refuses it by name (packages/core/src/theme/localTokens.ts:267-271, and the new test expects that throw); retitle it, for example "fix(core): a local token left undefined is not set; root localTokens: undefined is refused by name".
The behaviour follows the current records and the contract sentences an engineering owner approved for this head, and the three new tests fail before the fix and pass with it. Three optional notes are inline: the contract's rule and var() clauses hold only for a name no theme in the lineage declares, the "failed import" rationale is wider than the two root fields it applies to, and the new source comment can lose its passive wording.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: a local token left undefined, in the theme or in an adaptation rule, is not set and writes no CSS: verified by the new test and a rule check.
- Claim: a token, or a value in a part, surface or adaptation rule, left undefined is already not set: verified.
- Claim: before, such an entry was refused as no CSS string: verified; an undeclared name in a rule was refused as "cannot enroll" instead.
- Claim: a rule that writes a token left undefined still fails with its name: verified for a name no theme in the lineage declares.
- Claim: a var() reference to such a token stays external: verified.
- Claim: root localTokens: undefined is refused by name, as extends: undefined is: verified by the new test.
- Claim (title): root localTokens: undefined is not set: false.
- Claim: the three new tests behave as described and Core theme tests pass: verified (31 files, 1,803 tests).
- Claim: the record states both readings in the contract's undefined rule: verified.
- File
.changeset/core-theme-undefined-local-tokens.md: clear; optional wording notes. - File
docs/architecture/theme-authoring-contract.md: clear; optional wording notes. - File
packages/core/src/theme/defineTheme.test.ts: clear. - File
packages/core/src/theme/localTokens.ts: clear; optional comment rewrite.
…ailed-import reason names its two root fields, and the comment is active
|
/approve-spec c4825d7 |
There was a problem hiding this comment.
Approved pending CI: required checks are still running on this head.
The retitle fixes the one earlier blocker, and the earlier wording notes on the contract, the changeset and the source comment are all addressed. The behaviour follows the current theme records and the contract sentences approved for this head; the three new tests fail before the fix and pass with it, and the published themes build unchanged.
- Optional: the adaptation-rule skip and a child theme that restates an inherited local token as
undefinedhave no committed test; one case each would pin them.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: a local token left undefined, in the theme or in an adaptation rule, is not set and writes no CSS: verified by the new test and a rule check.
- Claim: a token, or a value in a part, surface or adaptation rule, left undefined is already not set: verified.
- Claim: before, such a token was refused as not a CSS string: verified.
- Claim: a rule that writes a local token name no theme in the lineage declares still fails with its name: verified by the new test.
- Claim: a var() reference to such a name stays external: verified.
- Claim: root localTokens: undefined is refused by name with the stated message, as extends: undefined is: verified by the new test.
- Claim (title): a local token left undefined is not set, and root localTokens: undefined is refused by name: verified.
- Claim: the three new tests behave as described and the core theme tests pass: verified.
- Claim: the contract's undefined rule records both readings: verified (the record adds them as two sentences).
- File
.changeset/core-theme-undefined-local-tokens.md: clear. - File
docs/architecture/theme-authoring-contract.md: clear. - File
packages/core/src/theme/defineTheme.test.ts: clear. - File
packages/core/src/theme/localTokens.ts: clear.
Summary
defineThemerefused a local token leftundefinedas no CSS string, while a token, or a value in a part, surface or adaptation rule, leftundefinedis already not set (the theme-authoring contract's rule for undefined). A local token leftundefinednow reads as not set: nothing is declared for it and the theme loads. An adaptation rule that writes a local token name no theme in the lineage declares still fails with its name, and avar()reference to such a name stays external.Root
localTokens: undefinedis refused by name ("localTokens is undefined: omit the field or pass an object"), asextends: undefinedis: a rootlocalTokensorextendsleft undefined is almost always a failed import, so it never quietly drops the theme's local tokens.Tests
defineThemetests: rootlocalTokens: undefinedthrows with that message; a local token left undefined beside a set one is not set and is not written; an adaptation rule that writes a local token left undefined fails with the token's name. Core theme tests pass; changeset added.Record
One sentence in theme-authoring-contract's
undefinedrule: rootlocalTokens: undefinedis refused by name, asextends: undefinedis (a rootlocalTokensorextendsleft undefined is almost always a failed import); a local token leftundefineddeclares nothing, an adaptation rule that writes a name no theme in the lineage declares still fails with its name, and avar()reference to such a name stays external (INV8).Writing rubric results
@josephfarina