layout: narrow keyed field parts.control by widget (#176) - #177
Merged
Merged
Conversation
`layout`'s FormShape-keyed field handles returned a plain `EField`, so
`<Default of={root.children.username} parts={{ control }} />` still forced
a `c.kind` guard even though the brand already knew the widget.
`LayoutNode`'s field branch is now `LayoutField`, an `EField` whose
`parts.control` is `Extract`ed to `ControlForWidget<TS['fields'][Path]['widget']>`
— the same archetype the typed-rules door hands `FieldProps`. The floor keeps
the union (a function intercept fires for every node and cannot know more,
ADR 029 §5); unbranded trees keep `AnyKindNode`. Widget overrides re-narrow
for free through the brand `useFormTree` already threads.
Co-authored-by: Cursor <cursoragent@cursor.com>
The narrowing had no consumer — every guard left in the repo is on a door
that correctly keeps the union (function intercept, unbranded runtime tree,
renderer adapters). So move the one test that can use the keyed door.
`a9a4b24` had extracted `KitControl: ControlOverride<'input'>` to get the
`c.kind` branch out of this test, because it reached the node through a
function intercept — `node.path === 'username'` is a runtime check the
compiler cannot lift into the brand. Reached through `layout`'s keyed child
instead, the brand already knows the widget, so the override goes back inline
with no guard and no annotation.
Coverage is unchanged: intercept + `parts={{ control }}` is still pinned by
renderer.test.tsx, and `ControlOverride<'input'>` on the intercept door by
intercept.test.tsx, App_16, and App_17.
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Reaching a field through
layout's keyed door still made you write ac.kindguard, even though the brand already knew the widget. Found this while reviewing #174.LayoutNode's field branch is a newLayoutField— anEFieldwithparts.controlExtracted down toControlForWidget<TS['fields'][Path]['widget']>ControlOverrideOfalready preferred a handle's liveparts.controlover Core's widePartsOverrides, so nothing else needed wiringuseFormTreealready re-brandsformthroughApplyWidgetOverridesfield-root-pieces.test.tsxmoves its control override back inline:a9a4b24had extractedKitControl: ControlOverride<'input'>purely to dodge the guard, and reaching the node through the keyed door instead drops both the annotation and the branchThe function intercept door keeps the full union on purpose — it fires for every node so it genuinely can't know more (ADR 029 §5). Unbranded trees keep
AnyKindNode. Intercept coverage ofparts={{ control }}is unchanged (renderer.test.tsx), as is theControlOverride<'input'>lesson (intercept.test.tsx, App_16, App_17).One thing I hadn't noticed until reviewing this: the path-map intercept is a fourth door with the same gap, and its keys don't typo-check either. Filed as #178, not fixed here.
npm run gategreen.Closes #176