Skip to content

test: widget gate parity pin — client gate ⇔ server validators (architecture review F2) - #51

Merged
silversurfer562 merged 3 commits into
mainfrom
claude/forms-gate-parity
Aug 20, 2026
Merged

test: widget gate parity pin — client gate ⇔ server validators (architecture review F2)#51
silversurfer562 merged 3 commits into
mainfrom
claude/forms-gate-parity

Conversation

@silversurfer562

Copy link
Copy Markdown
Member

Summary

Batch B of the 2026-08-20 dynamic-forms architecture review: the one finding with live user-facing drift risk (F2).

The widget submit script's client-side required-field gate (widget.py:865-923) re-implements the server validators' completeness rules — required rulings boards fully ruled, ranking all-or-nothing, blank edit text blocked, optional partial rankings blocked — and nothing in CI kept the two implementations in sync. A divergence would either let an invalid answer post after the widget is dead (nowhere to re-ask) or block a valid one.

What this adds (tests only, no behavior change)

  • Gate port: the gate's two passes ported rule-for-rule into tests/test_widget_roundtrip.py (_gate / _gate_allows), operating on the same _WidgetDOM simulator the reader pin uses. The simulator now also captures data-required and counts [data-item] rows — the anchors the JS gate queries.
  • Parity property test: 35 fixtures (every construct × empty/partial/valid fill states, plus optional-ranking and blank-edit edges) asserting gate blocks ⇔ collect_form_response rejects. No fixture hardcodes a verdict — the property is the assertion, so it fails whichever side drifts.
  • Reference-form parity: untouched (both block) and fully-filled (both pass) checks over the all-construct reference form.
  • Structural anchor drift catcher: the DOM attributes the gate JS queries (data-required, [data-item], data-rank-n, .ae-rank, ae-field-missing) must appear in the emitted script, and the renderer's data-required flags must match the form's required questions — same technique as the reader's collect-mode pin at test_script_switch_covers_the_emitted_collect_modes.

Verification

  • Full suite: 717 passed.
  • Mutation check: disabling the blank-edit rule in the port fails assume-blank-edit red.

Stated limitation (as in the review): this pins semantic agreement (Python gate model ⇔ server validators) plus script structure — not JS execution. A node/playwright CI runner for one script was rejected as disproportionate; a real human submit stays the gold receipt.

🤖 Generated with Claude Code

silversurfer562 and others added 3 commits August 20, 2026 07:43
…tecture review F2)

The submit script's required-field gate re-implements the server
validators' completeness rules (required boards fully ruled, ranking
all-or-nothing, blank edit text) with nothing keeping the two in sync.
Port the gate rule-for-rule into the roundtrip simulator and assert,
per construct × fill state (35 fixtures), that the gate blocks exactly
when collect_form_response would reject the posted payload. Add a
structural anchor pin (data-required / [data-item] / data-rank-n) in
the same style as the reader's collect-mode drift catcher.

Mutation-checked: disabling the blank-edit rule in the port fails
assume-blank-edit red.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@silversurfer562
silversurfer562 merged commit 5a490f4 into main Aug 20, 2026
7 checks passed
@silversurfer562
silversurfer562 deleted the claude/forms-gate-parity branch August 20, 2026 13:38
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