Skip to content

refactor: widget submit script switches on data-collect, not ftype (0.5.0 cleanup batch) - #36

Merged
silversurfer562 merged 1 commit into
mainfrom
claude/happy-chandrasekhar-54736a
Aug 17, 2026
Merged

refactor: widget submit script switches on data-collect, not ftype (0.5.0 cleanup batch)#36
silversurfer562 merged 1 commit into
mainfrom
claude/happy-chandrasekhar-54736a

Conversation

@silversurfer562

Copy link
Copy Markdown
Member

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-collect attribute (value | checked-one | checked-many | rulings | ranked | rulings-with-text), emitted at render time from the per-type _COLLECT_MODES map, 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.

  • The rulings readers and the required-row gate scope rows by [data-item] instead of construct CSS classes (.ae-triage-row / [data-assume-row])
  • Number coercion keys off el.type === 'number' (the control, not the construct)
  • list_style SINGLE_SELECT emits checked-one at render time — replaces the reader's runtime radio sniffing
  • Posted payloads are byte-identical — this is a reader-plumbing refactor only

Lockstep updates

  • Round-trip simulator (tests/test_widget_roundtrip.py): _submit mirrors the same data-collect switch; new list_style single-select round-trip regression
  • Drift catcher repinned: test_script_switch_covers_the_emitted_collect_modes asserts the emitted modes AND the script's literal cases 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 (confirm's "nothing pre-selected" pin tightened to the space-prefixed checked attribute so checked-one isn't a false hit)
  • widget-preview lane honors PORT (autoPort: true) so parallel sessions can each run their own preview

Verification

  • 622 passed (was 611 + the new regressions); ruff + black clean on touched files
  • Browser receipt: reference form (all 8 constructs + 7 base types) filled and submitted in the widget-preview lane with real clicks (including ranking remove/add and the assumption-review edit reveal); the captured sendPrompt payload carries the sentinel + all 15 answers and validates through collect_form_response end-to-end

After 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

….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>
@silversurfer562
silversurfer562 merged commit ac7f024 into main Aug 17, 2026
7 checks passed
@silversurfer562
silversurfer562 deleted the claude/happy-chandrasekhar-54736a branch August 17, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant