test(sdk): spike proving CTR resolver handles two-axis mode combinations - #1437
Merged
Conversation
Spike for bead spectrum-design-data-cn3v (Nate Baldwin's mode-group / modeless Figma variables model, Slack C0BUQU7JDA7 p1788988579332039). Adds a synthetic-fixture test proving the existing CTR resolver, with no changes, already resolves every point of a colorScheme x contrast cross-product correctly via best_relationship_candidate's existing "most matched requested keys wins" scoring over N-key scope.options maps. Also adds a small read-only helper that derives whether a concept's value actually diverges on a given mode axis (holding others at their ModeSetRecord default) -- the primitive Nate's "mode-group collection membership" needs, built entirely on the existing context-aware resolver. Confirms the resolver is not the blocker for combinatorial modes; the remaining gaps (no multi-axis token data today, single-axis-only token/set schemas, and the Figma exporter's one-collection-per-axis model with no modeless/alias-chain layer) live below the resolver and are tracked on cn3v. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Contributor
🎨 Token Changes ReportTokens Changed (0)Original Branch: This comment was automatically generated by the token diff tool. 🤖 |
Contributor
🧩 Component Schema Changes ReportNo component schema changes detected.This comment was automatically generated by the component schema diff tool. 🤖 |
Contributor
Run report for a1d682cbTotal time: 2m 15s | Comparison time: 4m | Estimated savings: 1m 44s (43.5% faster)
Changed files |
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.
Description
Test-only spike proving the existing CTR resolver can already express and resolve combinatorial modes (e.g. a token varying by both color theme AND contrast), with no code changes to the resolver itself. Adds
ctr_resolution_handles_two_axis_cross_producttosdk/core/src/graph.rs:scope.optionscover a full colorScheme × contrast cross-product, assertingresolve_relationship_ref_in_contextresolves every one of the 6 combinations to its distinct expected value — via the existingbest_relationship_candidate"most matched requested keys wins" scoring, unmodified.concept_diverges_on_axis, built on top of the existing context-aware resolver, that derives whether a token's value actually diverges on a given mode axis (holding other axes at theirModeSetRecorddefault). Asserted against both a two-axis token (diverges on both) and a single-axis control (diverges on only one).No production code changed — this is a proof/discovery artifact for design discussion, not a fix.
Related Issue
Bead
spectrum-design-data-cn3v("Model Figma exporter collections as mode-groups + modeless alias layer"), filed following up on DNA-1953 / PR #1435 and Nate Baldwin's Slack feedback (threadC0BUQU7JDA7/p1788883017424349, commentp1788988579332039) about the Figma library's real collection/mode architecture.Motivation and Context
Nate described the S2 Figma library's real structure: hidden "mode-group" collections (one per axis: color theme, contrast, etc.) that only contain a token if its value actually diverges on that axis, plus a single public "modeless" collection that daisy-chains aliases through whichever mode-group collections a token belongs to — supporting combinatorial modes (e.g. two independent dropdowns for a token varying by both color theme and contrast).
Before committing to an exporter redesign for that model, this spike answers the open question: can the existing CTR resolution logic (which already does specificity-based sibling matching over an N-key
scope.optionsmap) serve as the derivation engine for it? Result: yes — the resolver already proves the hard part (correct multi-axis resolution and divergence detection). The real remaining gaps are below the resolver: no token varies on two axes in real data today (token/set schemas are single-axis;contrasthas a declared mode set but zero token usage), and the exporter itself still maps one collection to one axis with no modeless/alias-chain layer. Findings and recommendation recorded as a comment oncn3v.How Has This Been Tested?
cargo test -p design-data-core ctr_resolution_handles_two_axis_cross_product --lib— new test passes.moon run sdk:test— full workspace suite: 1419 tests run, 1419 passed, 1 skipped (unchanged from before this change).cargo fmt --manifest-path sdk/Cargo.toml --allvia pre-commit hook.Screenshots (if appropriate):
N/A
Types of changes
Checklist:
🤖 Generated with Claude Code