Repository navigation
Phase 32 slice B: one tree for render and every rule - #256
Merged
Merged
Conversation
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.
Phase 32 slice B (
docs/specs/PHASE-32-SPEC.md, FR-B1 to FR-B4, with the contracts pinned in the spec's K1 to K7 block and the as-built notes L1 to L3).The problem
A component instance used to be drawn without the design system. Variables were resolved first and instances were expanded afterwards, so a component's own nodes never got their
$tokens, their control defaults or their state styles. Adisabledbutton inside an instance rendered at full strength in the fallback blue. The checks were split three ways. Contrast, spacing, typography and cliché never looked inside instances at all, so faint text in a component raised nothing. The type rules and state checks did look inside, but at the unresolved tree. Icons and coverage used a third expander with a different id scheme.What changed
src/expand.tsexpandTreeexpands every instance (the instance's props and overrides applied) and then resolves tokens over the whole tree. The renderer, everycanvas_evaluatecategory,canvas_stress,snapshot_layout, structural drift, the CLI and the viewer read it. The three old expanders are gone.renderToHtmlstill accepts a raw tree: when the tree still holds an instance, it expands the tree through the helper with the canvas's tokens and a newthemerender option.<instanceId>/<childId>, so two instances of one component never share an id, and detailed-mode rects match the findings. The instance root keeps its own id. Stored ids never contain/.canvas_evaluatecovers every category. A finding on a node inside an instance reports the instance innodeId, the inner node in the newinnerNodeId, and the instance and component in its message. It carries nofix, socanvas_autofixnever emits an op for an idbatch_designcannot address. The old advice saying "the design system never reaches" a component is gone, because now it does.addFeedback, on a node inside an instance anchors on the instance.exportof a node inside an instance writes a flat file name. A component that holds an instance of itself now expands one level instead of overflowing the stack, which master also did.Verdicts that moved
No pattern gate moved:
test-patterns.ts,test-patterns-mobile.tsandtest-patterns-desktop.tspass at their existing bars. These pins moved, each to the behaviour this slice specifies:test-state-checks.tsR2#2563EBfallback and failed.$focus-ring. It fails when that token fails, with a twin that passes.test-state-checks.tsV4 and 3b$border-strongand passes. A failing instance root is reported on its own id, and an info names the instance.test-state-checks.tsgrouped findingtest-mobile-rules-detailed.ts$space-*spacer as unresolved, so its content sat in the top inset.test-components.ts<instance>/id prefix is removed: the look is unchanged and inner ids are expanded.test-unknown-icons.tstest-element-states.ts,test-overlays.tsTests
test/unit/test-one-tree.tsholds FR-B1's render clause and FR-B2. The render clause: adisabledbutton inside an instance renders with the same markup and style as one outside, with and without state tokens. FR-B2: faint text inside an instance is one error withnodeIdthe instance,innerNodeIdthe text, and no fix; no fix op names an expanded id; feedback lands on the instance. The file also covers the verify-round edges.test/browser/test-one-tree-layout.ts:snapshot_layoutgives the same child two ids in two instances, andcanvas_stressnames it the same way.test/unit/test-discoverability.tsnow checks thatinnerNodeIdand the expanded-id form are documented on all three agent-facing surfaces.Docs
The
canvas_evaluate,snapshot_layout,canvas_stress,get_feedbackand element-state docstrings, the INSTRUCTIONS, GUIDELINES (element states, components, the state rules, stress), README (the evaluate result,snapshot_layout, stress, feedback) and VISION (slice B ticked, plus the Phase 31 follow-up it closes).