Repository navigation
test: constrain registry entries to the canonical shape - #88
Merged
AdamMusa merged 3 commits intoNov 2, 2026
Merged
Conversation
Add the shared control kernel every control will migrate onto: a pure-data ControlSpec, PropReader as the only reader of wire keys, ControlEvents as the only event dispatcher, ControlCore/FocusableCore for client state and focus, and CoreHost as the single owner of a control's invoke listener and layout keywords (re-bound when Ruby replaces the control in place). ToggleLabel, TileToggleCore, CoreSemantics, RawProp and TextOrWidget are the neutral pieces the first migrations share. The control-core contract test checks every migrated control against rules C1-C8 (skin isolation, core purity, spec equals Ruby KEYWORDS, skin consumption, lifecycle, completeness, event and semantics parity, and a report-only legacy ratchet). The manifest starts empty; the runtime rules run against a test-only probe core and the static rules against adversarial fixtures. The JSON snapshot harness and the Ruby control surface copy (with tool/sync_ruby_surface.rb) support the migration PRs.
Registry entries map several wire types to one host (the five Button types all build AdaptiveButtonControl), and the entry-shape rule keeps entries from reading the Control. Give ControlCore protected, read-only accessors for its canonical wire type, its parent's, and the parent property that holds it, so a core can choose its spec and rendering itself (a Button inside an AlertDialog, an IconButton in an AppBar's leading slot) while its constructor stays a plain super.control.
Add contract rule C1e for the registry entry, the one place outside the kernel that holds the Control: CoreHost(create:) must be a constructor tear-off, each PlatformControlRenderer closure builds its skin with only core: (the builder's core) and key:, choosing between skins only on the core, and control appears only as CoreHost(control:), inside the host key and in debugPrint. C2b now also bans public mutable fields and setters on cores, and C1 covers helper skin libraries. QA's evasions N1 (an entry injects wire data into a core field) and N4 (an entry passes a raw wire value to a skin) are negative fixtures; the three approved entries (Switch, Checkbox, Radio) are positive fixtures, verbatim.
AdamMusa
force-pushed
the
test/control-core-entry-shape-rule
branch
from
October 29, 2026 01:47
700ed9c to
ba72191
Compare
This was referenced Oct 29, 2026
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.
Depends on #81 (control core foundation). Until #81 merges, this PR's diff also shows #81's commit; review the last two commits.
Why
QA's re-review of #81 found a gap: the registry entry (
adaptive_*.dart) is the only place outside the kernel that legitimately holds the Control, and no rule constrained it. Two evasions passed the contract test:create: (c) => SwitchCore(c)..qaLeak = c.properties.MaterialSwitchSkin(core: core, qaExtra: control.properties['tooltip']).What
Two commits:
feat: let shared cores read their wire type and placement:ControlCore.wireType,parentWireTypeandparentSlot(protected, read-only;parentSlotis the parent property that holds the control, e.g.leading, which the IconButton family uses for the iOS back chevron of an AppBar's leading button). Under the new rule an entry may no longer branch oncontrol.canonicalType/control.parent. A registry entry that serves several wire types still needs to pick a spec: the five Button types all buildAdaptiveButtonControl, and the registry is not edited by migrations. Core constructors may only forwardsuper.control(C2b). So the core now picks its own spec and variant from its wire type, and the entry stayscreate: ButtonCore.new. Unit tests: an alias (ElevatedButton) reads as its canonical type; the parent's type and slot are visible, for list slots (controls) and single-child slots (content).test: constrain registry entries to the canonical shape, which adds:CoreHost(create:)is a plain constructor tear-off (XCore.new).(context, core) => PlatformControlRenderer(...). Each design closure builds its skin with onlycore:(the builder's core, nothing else) andkey:, and may choose between skins only on the core (core.inAlertDialog ? A(core: core) : B(core: core)).controlappears only asCoreHost(control:), inside the host'skey:and insidedebugPrint(...).Tests
controloutside the allowed places), choosing a skin oncontrol.parent, readingcontrol.typeinto a local, passing something other than the builder's core, and passing an extra skin argument.test/control-core-entry-shape-rulewith refactor: move Switch onto the shared control core #84, refactor: move Checkbox onto the shared control core #86 and refactor: move Radio onto the shared control core #87 merged (keep-both on the manifest and the independence test).contract_mutations_v2.shrun on that tree: M1–M12, N1, N3 and N4 all fail the contract test. N1 is caught by C1e and C2b, N4 by C1e. N2 (a visual prop declared core-consumed with a trivial reference) still passes; QA accepted it as a declared, reviewable limitation.team/verify_pr.shon head ba72191 (with rufletorigin/main43928509): PASS: engineflutter test+956 all passed,flutter analyze lib testno issues, ruflet_core 157/157 files (718 runs), wire-key audit 0 new findings.Stack
Migrations from the Button family onward stack on this PR; the Button family PR follows. #84/#86/#87 are approved and unchanged. Once this PR and they are merged, C1e runs on their entries automatically, and they already comply.