Skip to content

feat(spec): string-name escape hatch for tokens (Proposal 012)#820

Merged
GarthDB merged 2 commits into
betafrom
feat/proposal-012-string-name-escape-hatch
Apr 29, 2026
Merged

feat(spec): string-name escape hatch for tokens (Proposal 012)#820
GarthDB merged 2 commits into
betafrom
feat/proposal-012-string-name-escape-hatch

Conversation

@GarthDB
Copy link
Copy Markdown
Member

@GarthDB GarthDB commented Apr 28, 2026

Description

Implements Proposal 012: a formal escape hatch for tokens whose names cannot
be expressed using the structured name-object taxonomy.

Allows a token's name field to be a plain string (e.g.
"focus-ring-color-key-focus") instead of a name object. String-named tokens
are schema-valid but trigger SPEC-017 (severity: warning, category:
tech-debt), making the debt visible and trackable in conformance reports —
analogous to CSS !important.

Changes:

  • token.schema.jsonname field in both tokenWithValue and
    tokenWithRef becomes a oneOf [nameObject, string] union
  • token-format.md — new "String-name escape hatch" section with NORMATIVE
    statements
  • rules.yaml — SPEC-017 (string-name-tech-debt, severity: warning)
  • sdk/core/src/validate/rules/spec017.rs — Rust validator with 3 unit tests
  • Conformance fixtures: valid string-name token and invalid/SPEC-017/

Related Issue

Closes the formal gap for the 730+ tokens tracked in naming-exceptions.json.
Follows Proposals 009, 010 from the token spec gap analysis.

Motivation and Context

naming-exceptions.json already tracks 730+ tokens that don't roundtrip
through the name-object taxonomy. This proposal gives those tokens a formal,
spec-blessed path: they can be written with "name": "raw-string" and tooling
will surface them as tech debt rather than silently accepting them.

How Has This Been Tested?

  • Rust SDK: 164 unit tests pass, 0 fail (cargo test in sdk/)
    — includes 3 new SPEC-017-specific tests
  • cargo clippy -- -D warnings passes clean
  • Conformance fixtures cover both the warning case and the no-warning case

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

GarthDB and others added 2 commits April 28, 2026 17:55
Allow a token's name field to be a plain string when the structured
name-object taxonomy cannot express the token's identity. String-named
tokens are schema-valid but trigger SPEC-017 (severity: warning,
category: tech-debt), surfacing them in conformance reports for
remediation tracking — analogous to CSS !important.

Adds the oneOf union to tokenWithValue and tokenWithRef in token.schema.json,
a new spec section in token-format.md, SPEC-017 in rules.yaml, a Rust
validator (spec017.rs) with three unit tests, and conformance fixtures for
both the valid and warning cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…design-data-spec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 28, 2026

🦋 Changeset detected

Latest commit: acb6cd2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@adobe/design-data-spec Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@GarthDB
Copy link
Copy Markdown
Member Author

GarthDB commented Apr 28, 2026

Run report for acb6cd28

Total time: 1m 54s | Comparison time: 5m 13s | Estimated savings: 3m 18s (63.3% faster)

Action Time Status Info
🟩 SyncWorkspace 7.6ms Passed
🟩 SyncProject(designDataSpec) 0.3ms Passed
🟩 SyncProject(sdk) 0.4ms Passed
🟩 SyncProject(tokens) 0.3ms Passed
🟩 SetupProto(0.51.4) 1.8s Passed
⬛️ SetupToolchain(node:20.17.0) 2.4s Skipped
🟩 SetupToolchain(rust:1.85.0) 17s Passed
🟩 InstallWorkspaceDeps(rust:1.85.0, sdk) 1s Passed
🟩 InstallProjectDeps(node:20.17.0, sdk) 17.1s Passed
🟩 RunTask(sdk:codegen-check) 156.6ms Passed
🟩 InstallWorkspaceDeps(node:20.17.0) 18.1s Passed
🟩 RunTask(sdk:lint) 36.6s Passed
🟩 RunTask(designDataSpec:check) 277ms Passed
🟩 RunTask(sdk:build) 1m 22s Passed
🟩 RunTask(tokens:verifyLegacyRoundtrip) 887.3ms Passed
🟩 RunTask(tokens:verifyDesignDataSnapshot) 1.6s Passed
🟩 RunTask(tokens:validateDesignData) 1.6s Passed
🟩 RunTask(sdk:test) 1m 26s Passed
🟩 RunTask(tokens:buildTokens) 1m 29s Passed
🟩 RunTask(tokens:test) 3.4s Passed
Touched files
.changeset/proposal-012-string-name-escape-hatch.md
docs/proposals/012-string-name-escape-hatch.md
packages/design-data-spec/conformance/invalid/SPEC-017/expected-errors.json
packages/design-data-spec/conformance/invalid/SPEC-017/tokens.tokens.json
packages/design-data-spec/conformance/valid/string-name-escape-hatch.json
packages/design-data-spec/rules/rules.yaml
packages/design-data-spec/schemas/token.schema.json
packages/design-data-spec/spec/token-format.md
sdk/core/src/validate/rules/mod.rs
sdk/core/src/validate/rules/spec017.rs

@GarthDB GarthDB merged commit ea25053 into beta Apr 29, 2026
4 checks passed
@GarthDB GarthDB deleted the feat/proposal-012-string-name-escape-hatch branch April 29, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant