Skip to content

refactor(form-tx): judge the review page's text through an effect location - #2508

Draft
abrichr wants to merge 2 commits into
claude/form-tx-reworkfrom
claude/effect-location-review-port
Draft

abrichr wants to merge 2 commits into
claude/form-tx-reworkfrom
claude/effect-location-review-port

Conversation

@abrichr

@abrichr abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member

What this does

This is step 2a: it moves form_tx's review-page check onto the effect-location record (#2500). It is based on #2461.

Before submit, form_tx reads the review screen and stops when a value there differs from the intake (_review_mismatch_halt). One case of that comparison now goes through an openadapt.effect-location/v1 record (start same_screen), judged by the shared evaluator: a value the review page shows as page text, under the whitespace_collapse or casefold codec. The new adapter is form_tx/review_location.py; reconciler.py changes by 15 lines.

These cases keep form_tx's own comparison, because the record can't yet express their rules:

  • every other codec: exact, iso_date, currency_cents, integer, phone_digits, title_case, upper, boolean_yes_no and enum_map;
  • checkbox and radio bindings, whose page text falls back to yes or no;
  • a value held in a form control, which may match by its option label.

Includes a carried commit. The first commit carries the effect_location package unchanged from #2500. Review only the second commit.

No behaviour change

tests/test_form_tx_review_location.py vendors the pre-port _text_pair_matches and _is_placeholder_or_empty from 1ddd69712 (judge.py, lines 129 to 184). It compares them with the port over a grid:

  • 29 intake values (text, case and whitespace variants, Unicode, ß, placeholders, 5, True, None, 1.5);
  • 23 shown texts;
  • both ported codecs;
  • 4 control kinds.

Every decision matches. An intake value the codec can't read isn't ported; the old comparison runs for it, and the test checks that the old comparison doesn't match it either.

Which way the gate fails. A value that is found but doesn't hold, refuted or unreadable, still stops the run. Only "not shown" and "shown more than once" are skips, and the old code still decides those before the adapter is called. A placeholder is never the value, even when the intake reads the same.

This port found no fail-open to fix. For these two codecs the old and new comparisons agree.

Tests

All synthetic.

  • tests/test_form_tx_review_location.py: 20 passed.
  • tests/test_effect_location.py: 48 passed, 8 skipped.
  • The form_tx suite (tests/test_form_tx*.py, headless) on this branch: see the comment below.
  • ruff check is clean.

Next

  • 2b, the combined summary row ("Name (DOB)"). Today those fields end not_checked (set4v2, larkspan). A template location would give name and date of birth their own verdicts. That is a stated behaviour change, not a fail-open fix, so it gets its own PR.
  • 2c, the lookup-table row.

Copied unchanged from claude/effect-location-record at 52a0a7b so this branch can use it. Drops out of the diff when #2500 merges.
…ation

Before submit, form_tx reads the review screen and stops when a value
differs from the intake. For a value shown as page text under the
whitespace_collapse or casefold codec, that comparison is now an
openadapt.effect-location/v1 record (start same_screen) judged by the
shared evaluator. Every other codec, checkbox and radio bindings (which
fall back to yes or no), and values held in form controls keep form_tx's
own comparison.

No decision changes: a differential test runs the old comparison (vendored
from 1ddd697) and the port over a corpus of intake values and shown texts
for every ported binding. A value found but not held still stops the run;
only "not shown" and "shown more than once" are skips, as before.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Gemini (gemini-3.1-pro-preview), round 1
Reviewed-Head: 59e757a

Sent the full diff of this PR's own files, those files in full, and any earlier findings.

The PR successfully ports the review-page text comparison for WHITESPACE_COLLAPSE and CASEFOLD to the shared effect_location evaluator. The fallback mechanism ensures that non-ported codecs and yes/no bindings continue to use the old comparison, preserving the exact behavior. The exhaustive tests provide high confidence that no decisions are changed and no fail-open paths are introduced.

NIT

  • packages/flow/openadapt_flow/form_tx/review_location.py line 88: The type hint for placeholders is tuple[str, ...]. Depending on how FieldBindingSpec.placeholder_values is typed (often Sequence[str]), this might cause a strict type checker to complain if a list is passed. Consider changing it to Sequence[str] (and importing Sequence from typing or collections.abc).

APPROVE WITH NITS

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 59e757a

Author declaration. I wrote this change and checked it at the head above. Everything here is synthetic; no real app was run.

  • tests/test_form_tx_review_location.py: 20 passed. That is the differential against the vendored pre-port comparison, plus the not-ported cases.
  • The form_tx suite, all 25 tests/test_form_tx*.py files, headless, single process through the CPU slots: 409 passed in 8 min 44 s.
  • Gemini round 1 approved with one typing nit, which I left as is. The caller always passes FieldBindingSpec.placeholder_values, which is typed as a tuple.

This branch has not been deployed

No deployments
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