ALFMOB-264: Adopt latest design tokens + future-proof TokenLoader for multi-mode collections#91
Conversation
… figma-plugin export
There was a problem hiding this comment.
Pull request overview
This PR completes the remaining Phase-1 work for ALFMOB-264 by re-adopting the latest upstream design-token JSON and updating the token generator’s TokenLoader to be resilient to collections that add additional modes (like theme gaining selfridges).
Changes:
- Hardened
TokenLoader.selectedFilesto pinthemetoalfie-themeand to fail fast (with an actionable error) when an unpinned collection becomes multi-mode. - Refreshed committed token JSON and regenerated Swift token surfaces to preserve primitive references (not inline literals), including properly typed
fontWeightprimitives. - Added
DESIGN_TOKENS_REFtopull-design-tokens.shto support pre-merge token testing against non-mainrefs.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Tools/DesignTokenGen/Tests/DesignTokenGenCoreTests/GeneratorTests.swift | Adds regression coverage for multi-mode theme pinning and unpinned multi-mode fail-fast behavior. |
| Tools/DesignTokenGen/Tests/DesignTokenGenCoreTests/Fixtures/mini/manifest.json | Extends test fixture manifest with a second theme mode (selfridges) to exercise pinning. |
| Tools/DesignTokenGen/Sources/DesignTokenGenCore/TokenLoader.swift | Pins theme mode and introduces explicit fail-fast behavior for unpinned multi-mode collections. |
| Alfie/scripts/pull-design-tokens.sh | Adds DESIGN_TOKENS_REF override and clones that ref for reproducible token pulls. |
| Alfie/AlfieKit/Sources/SharedUI/GeneratedTokens/Typography+Generated.swift | Regenerated typography styles to reference typed font-weight primitives instead of inlined numeric literals. |
| Alfie/AlfieKit/Sources/SharedUI/GeneratedTokens/Theme+Generated.swift | Regenerated theme surface to reflect updated upstream theme tokens (new/expanded mappings). |
| Alfie/AlfieKit/Sources/SharedUI/GeneratedTokens/Primitives+Generated.swift | Regenerated primitives (adds typed font-weight primitives, border style, and normalizes numeric literals). |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/typography.styles.tokens.json | Updates composite typography style definitions to reference per-style font-weight variables. |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/typography.alfie-theme.tokens.json | Updates typography token set including correct fontWeight typing and fixed bindings for strikethrough. |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/theme.alfie-theme.tokens.json | Updates theme tokens to the latest upstream structure and adds new button/border/content tokens. |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/system.ios.tokens.json | Refreshes system/iOS token definitions and ordering to match upstream export. |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/sizing.alfie-theme.tokens.json | Refreshes sizing tokens to match upstream export (including ordering/structure updates). |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/screen-size.small-(s).tokens.json | Refreshes screen-size small mode tokens and ordering to match upstream export. |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/manifest.json | Updates manifest collections/modes (including multi-mode theme) to match upstream export. |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/.primitives.alfie-theme.tokens.json | Refreshes primitives export (now includes font-weight primitives and normalized component formats). |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/.broken-ref-allowlist.json | Clears previously-allowlisted missing font-weight targets now present in the upstream export. |
…ted unpinned-multi-mode error
|
Nice, tightly-scoped hardening — the fail-fast cascade with actionable messages is a clear improvement over the opaque downstream One thing worth calling out explicitly before merge: the regeneration flips |
ALFMOB-264 — Adopt latest design tokens + future-proof TokenLoader
Ticket (Epic): ALFMOB-264 · ADR: ALFMOB-293 · Token repo: Alfie-Mobile-Design-Tokens
What & why
The token codegen pipeline (ALFMOB-272) and the color/typography/spacing integrations (ALFMOB-274/266/270) already landed. Two gaps remained: (1) the token JSON needed re-pulling from the in-house
figma-pluginexport once it merged upstream, which surfaced (2) a latentTokenLoadercrash risk now that thethemecollection ships a second brand mode (selfridges) iOS doesn't use.Changes
TokenLoadermulti-mode hardening (Tools/DesignTokenGen):theme→alfie-theme(iOS doesn't ship the newselfridgesmode).add a pin to modeForCollection) instead of a downstream opaquefileNotFound.main(SharedUI/DesignTokens/). Font-weight primitives are now correctly typedfontWeight(previously filtered out) and font-family primitivesfontFamily, so generated Swift references symbols (Primitives.Typography.fontWeightRegular) instead of inlining literals (400).body-medium-strikethroughfont-weight (was mis-bound to a font-family variable, previously flattened to a silent400).pull-design-tokens.shgains aDESIGN_TOKENS_REFoverride (defaults tomain) for pre-merge testing.Reproducibility
Re-ran
pull-design-tokens.sh+generate-design-tokens.shagainst upstreammain: pulled JSON and generated Swift are byte-identical to what's committed here. The work stands entirely on merged upstream sources.Acceptance-criteria coverage (epic-wide)
display.large…)Verification
./Alfie/scripts/verify.sh --skip-integration→ ✅ build + unit tests pass (integration skipped — no local BFF).Notes
claude/affectionate-hodgkin-b608a2), re-homed onto thisfeat/ALFMOB-264-*branch — PR Adopt latest design tokens + future-proof TokenLoader for multi-mode collections #89 can be closed as superseded.GeneratedTokens/orproject.pbxproj(both regenerated).