Open Bug 2090765 Opened 12 days ago Updated 3 days ago

Check in CI that every design token resolves to a valid value

Categories

(Toolkit :: Themes, task)

task

Tracking

()

ASSIGNED

People

(Reporter: dao, Assigned: dao)

References

(Blocks 2 open bugs)

Details

Attachments

(3 external files)

Nothing in CI resolves the design tokens, so a token that resolves to an invalid value, a reference cycle or more than the reference depth limit lands unnoticed. browser_parsable_css.js does not catch these: a custom property accepts almost any value at parse time, and the value only turns invalid when styles are computed. Before bug 2084656, --button-text-color-menu-{hover,active,disabled,selected} resolved to light-dark(inherit, currentColor) under Nova, which is invalid, and nothing flagged it.

toolkit/themes/tools/token_resolve.py (bug 2090042) already resolves every token in every environment the generated sheets query, from the checked-in dist/ sheets, with the standard library only, in about a quarter of a second. This bug:

  • adds a --check mode that resolves every token in every environment and exits 1 on an invalid value, a cycle or the depth limit; values that resolve empty (e.g. unset) are reported but do not fail
  • adds tests for token_resolve.py, which has none, including the pre-bug 2084656 button tokens as a regression case
  • runs --check in the design-tokens-tests source-test after try-runner.js, whose freshness check makes sure the dist/ sheets match the .tokens.json sources, and adds toolkit/themes/tools/** to the task's run-on-changes paths

Component token sheets are out of scope here.

Assignee: nobody → dao+bmo
Attachment #9677487 - Attachment description: WIP: Bug 2090765 - Check in CI that every design token resolves to a valid value. r?hjones!,#taskgraph-reviewers → Bug 2090765 - Check in CI that every design token resolves to a valid value. r?hjones!,#taskgraph-reviewers
Status: NEW → ASSIGNED
Attachment #9677488 - Attachment description: WIP: Bug 2090765 - Have desktop-theme-tokens run the design-tokens tests before submitting. r?#ai4dev-reviewers → Bug 2090765 - Have desktop-theme-tokens run the design-tokens tests before submitting. r?#ai4dev-reviewers
Blocks: 2091974
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: