test: widget gate parity pin — client gate ⇔ server validators (architecture review F2) - #51
Merged
Merged
Conversation
…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>
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
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
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
edittext 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)
tests/test_widget_roundtrip.py(_gate/_gate_allows), operating on the same_WidgetDOMsimulator the reader pin uses. The simulator now also capturesdata-requiredand counts[data-item]rows — the anchors the JS gate queries.gate blocks ⇔ collect_form_response rejects. No fixture hardcodes a verdict — the property is the assertion, so it fails whichever side drifts.data-required,[data-item],data-rank-n,.ae-rank,ae-field-missing) must appear in the emitted script, and the renderer'sdata-requiredflags must match the form's required questions — same technique as the reader's collect-mode pin attest_script_switch_covers_the_emitted_collect_modes.Verification
assume-blank-editred.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