Skip to content

fix(core): a local token left undefined is not set; root localTokens: undefined is refused by name - #11802

Merged
josephfarina merged 5 commits into
mainfrom
core-localtokens-undefined
Nov 15, 2026
Merged

josephfarina merged 5 commits into
mainfrom
core-localtokens-undefined

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

defineTheme refused a local token left undefined as no CSS string, while a token, or a value in a part, surface or adaptation rule, left undefined is already not set (the theme-authoring contract's rule for undefined). A local token left undefined now 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 a var() reference to such a name stays external.

Root localTokens: undefined is refused by name ("localTokens is undefined: omit the field or pass an object"), as extends: undefined is: a root localTokens or extends left undefined is almost always a failed import, so it never quietly drops the theme's local tokens.

Tests

defineTheme tests: root localTokens: undefined throws 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 undefined rule: root localTokens: undefined is refused by name, as extends: undefined is (a root localTokens or extends left undefined is almost always a failed import); a local token left undefined declares nothing, an adaptation rule that writes a name no theme in the lineage declares still fails with its name, and a var() reference to such a name stays external (INV8).

Writing rubric results

  • R1 narration: none; present tense.
  • R2 research: none.
  • R3 evidence: none; cites INV8, a record claim.
  • R4 rejected alternatives: none.
  • R5 change references: none.
  • R6 open questions: none.
  • R7 project status: none.

@josephfarina

@vercel

vercel Bot commented Nov 15, 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 15, 2026 1:24am UTC

Request Review

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

astracat-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 15, 2026, 1:32 AM UTC

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · c4825d7

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/core 7.59 MB packed (+220 B); no new dependencies.

Wide change (shared styles: packages/core/src/theme/localTokens.ts): 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.

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 undefined already is" (.changeset/core-theme-undefined-local-tokens.md:5) and the matching line in the description, because extends: undefined throws and an icons or indicators entry left undefined replaces the inherited entry; for example, write "as a token, or a value in a part, surface or adaptation rule, left undefined already is".
Claims and files checked

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

  • Claim: localTokens: undefined is 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 undefined is already not set: false for extends, icons and indicators.
  • 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.

Automated review (maintainer link)

Comment thread packages/core/src/theme/localTokens.ts Resolved
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 15, 2026
…: undefined is; a local token left undefined stays not set
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 698b6c5

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 15, 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 for one fix: the pull request title no longer matches what the code does.

  • The title says a root localTokens: undefined is 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.

Automated review (maintainer link)

Comment thread packages/core/src/theme/localTokens.ts Resolved
@josephfarina josephfarina changed the title fix(core): a local token left undefined, or localTokens: undefined, is not set fix(core): a local token left undefined is not set; root localTokens: undefined is refused by name Nov 15, 2026
…ailed-import reason names its two root fields, and the comment is active
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 15, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec c4825d7

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

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 undefined have 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.

Automated review (maintainer link)

@josephfarina
josephfarina merged commit 2df3446 into main Nov 15, 2026
163 of 165 checks passed
@github-actions
github-actions Bot deleted the core-localtokens-undefined branch November 15, 2026 06:03

This branch was successfully deployed

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