refactor(ui): wire the dimension classes to their tokens, and guard the token files - #184
Draft
renefloor wants to merge 3 commits into
Draft
refactor(ui): wire the dimension classes to their tokens, and guard the token files#184renefloor wants to merge 3 commits into
renefloor wants to merge 3 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## chore/prune-unused-tokens #184 +/- ##
=============================================================
- Coverage 68.57% 68.57% -0.01%
=============================================================
Files 210 211 +1
Lines 8593 8594 +1
=============================================================
Hits 5893 5893
- Misses 2700 2701 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
renefloor
added this pull request to stack #185
September 10, 2026 12:29
renefloor
force-pushed
the
chore/wire-dimension-tokens
branch
from
September 10, 2026 12:43
8c4696c to
5a8684e
Compare
StreamSpacing, StreamRadius and StreamTokensTypography hard-coded the same numbers the vendored token files already held, so the design system's dimensions were mirrored twice with nothing tying the copies together — the swatch-versus-baked-hex hazard one layer up, where an upstream change can be applied to one and not the other in silence. The three classes now read the tokens. The type ramp gains from it: `height: 1.1111111111111112` becomes `typographyLineHeightNormal / typographyFontSizeLg`, which says what the number is instead of leaving a magic constant. Every ratio resolves bit-identically, so no golden moves. Adds internal/tokens/stream_tokens_dimensions.dart, beside the mode-independent typography file rather than under light/ and dark/, because the token repo publishes one set of dimensions for every mode — all 180 constants were byte-identical between the two files. Values come from the web flavor, the only one carrying the Geist family this package ships. They are typed `double` so they satisfy Radius, EdgeInsets and TextStyle directly. Two tokens are deliberately not carried, since nothing can read them: font weights, because TextStyle.fontWeight takes a FontWeight that cannot be built from a number in a const expression, and radiusNone, because the analyzer's use_named_constants prefers Radius.zero over circular(0). Also extends check_tokens.dart to hold the dimension file to the same rule, which is what caught radiusNone and a stale skip that hid the typography file's own reads. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The skill still said the dimension classes hard-code their values and that a change has to be applied to them by hand, which this branch makes false. It now says a dimension is a value edit in stream_tokens_dimensions.dart and the classes follow, records why font weights and radiusNone are absent, and names melos run check:tokens as what enforces the rule — so there is no judgment call about what belongs in a token file. Also brings three now-stale details in line: the file table gains the dimensions row, the reader list gains the three dimension classes, and After editing runs check:tokens next to analyze. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The skill gained this in the previous commit, but CLAUDE.md still described `StreamSpacing`, `StreamRadius` and `StreamTokensTypography` as hard-coding their values, which this PR is what changes. It now points at `stream_tokens_dimensions.dart` and at `check:tokens`, so the repo overview and the skill agree. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
renefloor
force-pushed
the
chore/wire-dimension-tokens
branch
from
September 10, 2026 14:39
5a8684e to
ad73473
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Third in the stack: #182 → #183 → this. Base is
chore/prune-unused-tokens, so the diff is only the wiring.Why this exists
StreamSpacing,StreamRadiusandStreamTokensTypographyhard-coded the same numbers the vendored token files already held. The design system's dimensions were mirrored twice, with nothing tying the copies together — the swatch-versus-baked-hex hazard one layer up, where an upstream change gets applied to one and not the other in silence.An earlier revision of #183 deleted those 180 unread constants instead. That removed the evidence of the gap rather than the gap, which is why they came back here and got wired.
What changed
The three classes now read their tokens. The type ramp gains most:
which says what the number is. All five ratios resolve bit-identically, so no golden moves —
flutter testis+397 -56, matching the baseline exactly.New
internal/tokens/stream_tokens_dimensions.dartsits beside the existing mode-independent typography file rather than underlight//dark/, because the token repo publishes one set of dimensions for every mode — all 180 constants were byte-identical between the two files. Values come from the web flavor, the only one carrying theGeistfamily this package ships. Typeddoubleso they satisfyRadius,EdgeInsetsandTextStyledirectly.Two tokens are deliberately not carried, because nothing can read them: font weights, since
TextStyle.fontWeighttakes aFontWeightthat cannot be built from a number in a const expression; andradiusNone, since the analyzer'suse_named_constantsprefersRadius.zeroovercircular(0). Both are noted where they would otherwise puzzle a reader.The guard
scripts/check_tokens.dart, wired asmelos run check:tokensnext tocheck:barrelsin the same CI step. It fails when a vendored constant is never referenced, and whenlight/anddark/disagree about which constants exist — the second because a field resolving from a constant in one mode but not the other silently falls back instead of failing.It earned its place while being written: it caught
radiusNonehaving no reader, and a stale directory-wide skip that was hiding the typography file's own reads. Both failure modes were also verified by introducing them deliberately and watching it exit 1.The allowlist is intentionally empty.
Verification
analyzeclean across all four packages;format:verify,check:barrelsandcheck:tokenspass;flutter test+397 -56, identical to baseline.