refactor: widget submit script switches on data-collect, not ftype (0.5.0 cleanup batch) - #36
Merged
Merged
Conversation
….5.0 cleanup batch) Fourth 0.5.0 cleanup item, chair-ruled into its own PR (2026-08-16). Each rendered field now carries data-collect (value | checked-one | checked-many | rulings | ranked | rulings-with-text), emitted at render time from the per-type _COLLECT_MODES map, and the submit script's reader switches on that attribute instead of enumerating construct types — a new construct that answers like an existing one registers its mode at render time and needs no script edit. The rulings readers and the required-row gate scope rows by [data-item] rather than construct CSS classes; number coercion keys off el.type. Posted payloads are byte-identical. In lockstep: - round-trip simulator (tests/test_widget_roundtrip.py) mirrors the same data-collect switch, plus a list_style single_select regression (the render-time mode switch replaced the reader's radio sniffing) - drift catcher repinned: emitted modes and script cases must both equal the pinned vocabulary (was: ftype special-case coverage) - nine construct tests repinned from "ftype === '<type>'" script text to data-collect emission / mode cases - widget-preview lane honors PORT (autoPort) so parallel sessions can each run their own preview Browser-verified: reference form (all eight constructs + seven base types) filled and submitted in the widget-preview lane; the captured sendPrompt payload validates through collect_form_response with all 15 answers intact. Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
Summary
Fourth 0.5.0 cleanup item, chair-ruled into its own PR (2026-08-16): the widget submit script's reader is no longer a per-ftype if/else — each rendered field carries a
data-collectattribute (value | checked-one | checked-many | rulings | ranked | rulings-with-text), emitted at render time from the per-type_COLLECT_MODESmap, and the script switches on that attribute. A new construct type that answers like an existing one (one checked radio, per-row rulings, a ranked list…) registers its mode at render time and needs no script edit.[data-item]instead of construct CSS classes (.ae-triage-row/[data-assume-row])el.type === 'number'(the control, not the construct)list_styleSINGLE_SELECT emitschecked-oneat render time — replaces the reader's runtime radio sniffingLockstep updates
tests/test_widget_roundtrip.py):_submitmirrors the samedata-collectswitch; newlist_stylesingle-select round-trip regressiontest_script_switch_covers_the_emitted_collect_modesasserts the emitted modes AND the script's literal cases both equal the pinned vocabulary (was: ftype special-case coverage)"ftype === '<type>'"script text todata-collectemission /mode === '…'cases (confirm's "nothing pre-selected" pin tightened to the space-prefixedcheckedattribute sochecked-oneisn't a false hit)PORT(autoPort: true) so parallel sessions can each run their own previewVerification
sendPromptpayload carries the sentinel + all 15 answers and validates throughcollect_form_responseend-to-endAfter merge
Re-sync the attune-ai mirror copy of
test_widget_roundtrip.py(import-block swap only, per the attune-ai #2073 pattern).🤖 Generated with Claude Code