mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 20:27:15 +01:00
`tokens.md` freezes the palette as prose and three packages re-express it
as code -- `web_ui/src/tokens.css`, `design_system`'s `tokens.dart`, and
gatelock's `LockConfig`. Nothing compared them, so "one palette
everywhere" held only for as long as four hand-maintained copies happened
to agree. A hex edited in one stack drifted silently in the other three.
`palette_check.py` parses all four and runs two halves:
* agreement -- every mapped token carries the same hex in every
non-exempt stack
* completeness -- every colour parsed from any source must be mapped or
exempted with a stated reason
The second half is the load-bearing one. A pure agreement check passes
happily when someone adds a token to one stack and never touches the map,
which is the drift most likely to actually happen; an unmapped token is
therefore a failure, not a skip. Absences are declared per token per stack
with a reason (Tk has no light theme and no borders; the categorical ramp
is web-only) so "this stack doesn't have it" is on the record rather than
a silent pass.
It found one real gap on its first run: `tokens.css` sets `--surface-2` to
`paper-raised` in the light block -- the light theme collapses both
elevation steps onto one surface -- which `tokens.md` documented only in
prose and no map covered. Now an explicitly compared row, so if either
half of that pair moves, it fails.
Proven to fail, not just to pass: drift injected into each of the four
sources in turn, plus an unmapped token, was caught every time with the
offending stack named; re-proven after the 250-line-cap split into
`palette_map.py`. Runs from its own workflow with deliberately no `paths:`
filter -- drift is a disagreement *between* packages, so a path-scoped
trigger would skip exactly the edit that causes it. That was not
hypothetical: `ramp_check.py` was reachable only from the
`web_ui/**`-filtered workflow, so a ramp edit in `tokens.md` or
`design_system` never ran it. It moves here too.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U4Rj3s7K2qzrLNgJqqPhno
34 lines
1.1 KiB
YAML
34 lines
1.1 KiB
YAML
name: palette drift
|
|
|
|
# Deliberately NOT path-filtered. Every other workflow here scopes itself to
|
|
# one package, which is right for tests but wrong for this check: drift is a
|
|
# disagreement *between* packages, so editing design_system alone has to be
|
|
# able to fail it. A `paths:` filter would let exactly the edit that causes
|
|
# drift be the one that skips the check.
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
palette:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.13'
|
|
|
|
# Compares tokens.md (prose freeze), web_ui/src/tokens.css,
|
|
# design_system tokens.dart and gatelock's LockConfig. Fails on a hex
|
|
# that disagrees across stacks, and on a colour token that no stack's
|
|
# map accounts for.
|
|
- name: One palette across all four token sources
|
|
run: python3 unified-design-system/scripts/palette_check.py
|
|
|
|
- name: Categorical ramp still passes its constraints
|
|
run: python3 unified-design-system/scripts/ramp_check.py
|