Skip to content

refactor(form-tx): move the property insurance quote preset to JSON - #2504

Closed
abrichr wants to merge 3 commits into
mainfrom
claude/form-preset-insurance-schema
Closed

abrichr wants to merge 3 commits into
mainfrom
claude/form-preset-insurance-schema

Conversation

@abrichr

@abrichr abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member

What this does

Second of the form_tx preset moves (stacked on #2503). The property insurance quote domain schema (14 fields) now ships as form_tx/presets/property_quote.json, and build_property_quote_domain_schema() loads it. pack_compiler.py loses 252 more lines and the import it only used for the builders.

No behaviour change

tests/test_form_tx_presets.py rebuilds the old builder from 2f506d6c4 and compares it with the shim. The rebuild now takes form_tx's types module too, because pack_compiler no longer imports FormCodecKind.

Tests

  • tests/test_form_tx_presets.py: 5 passed.
  • ruff is clean.
  • check_engine_generality.py: OK.

The patient registration domain schema (field keys and label synonyms) is
vocabulary for one kind of form, not engine code. It now ships as
form_tx/presets/patient_registration.json (openadapt.form-domain-preset/v1),
and build_patient_registration_domain_schema() loads it. The returned
schema is equal to the one the old builder made; a test rebuilds the old
builder from history and compares.
Like the patient registration preset, the property quote domain schema is
vocabulary for one kind of form. It now ships as
form_tx/presets/property_quote.json, and build_property_quote_domain_schema()
loads it; the returned schema is equal to the old builder's.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

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

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

This is a clean, straightforward refactor that moves the property_quote domain schema out of the engine code and into a JSON preset, perfectly aligning with the generality rule (per-app/domain knowledge is pack data).

The JSON schema is a faithful 1:1 translation of the old Python code, and the test fix correctly handles the fact that pack_compiler no longer needs to import FormCodecKind.

No logic changes, no fail-open paths introduced, and the differential test guarantees identical behavior.

APPROVE

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: e548843

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_presets.py: 5 passed, including the differential against the old builder.
  • Gemini round 1 approved.

Base automatically changed from claude/form-preset-patient-schema to main November 22, 2026 22:08
@abrichr
abrichr marked this pull request as ready for review November 23, 2026 22:35
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 48ff3b3

Author declaration for the new head.

  • Merged origin/main into this branch; no rebase or force-push. The branch still carried refactor(form-tx): move the patient registration preset to JSON #2503's pre-squash commit 3c2ab790a. The only conflict was in packages/flow/tests/test_form_tx_presets.py, and I resolved it to keep this PR's three hunks: the form_types import, the property_quote entry in MOVED, and the merged namespace in _old_builder.
  • The net diff against main is now this PR's own change only: presets/property_quote.json, the builder in pack_compiler.py that loads it, and the test entry (3 files, +422/-254). It matches 3c2ab790a..e54884320 line for line.
  • Checks run locally: ruff check and ruff format --check on the changed files; mypy on pack_compiler.py and presets/__init__.py (clean); pytest -p no:xdist on every test_form_tx_*.py except the e2e and Playwright suites (252 passed).

@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Gemini
Reviewed-Head: 48ff3b3

Independent cross-vendor review of claude/form-preset-insurance-schema against origin/main.

Blocking finding (P1)

  • Missing entry in packages/flow/public-artifacts.json: This PR adds packages/flow/openadapt_flow/form_tx/presets/property_quote.json, but does not register "openadapt_flow/form_tx/presets/property_quote.json" in packages/flow/public-artifacts.json (next to "openadapt_flow/form_tx/presets/patient_registration.json" at line 1498, which #2503 added). Please add that 1-line entry so the public-artifact inventory check passes.

Verified non-blocking checks

  • pack_compiler.py: cleanly replaces build_property_quote_domain_schema() (-253/+4 lines) with a 4-line shim delegating to load_domain_schema("property_quote") and drops the unused FormCodecKind import.
  • presets/property_quote.json: valid JSON matching openadapt.form-domain-preset/v1 (["preset", "schema"]).
  • tests/test_form_tx_presets.py: adds property_quote to MOVED and merges vars(form_types) into _old_builder's namespace so the differential test works after removing FormCodecKind from pack_compiler.py.
  • Generality & Durability: Moves domain vocabulary out of engine code into pack data (advances Generality Gate pip install -r requirements (There is no requirements file in the repo) #1); zero per-app engine branches.

@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Grok
Reviewed-Head: 48ff3b3

I checked the live head with gh and reviewed the PR's own diff against its base main (03578dc): form_tx/pack_compiler.py, the new form_tx/presets/property_quote.json, and tests/test_form_tx_presets.py.

Blocking

  1. The new JSON file is not registered in Flow's public artifact inventory. Run from packages/flow at this head, python scripts/check_release_consistency.py fails: public artifact inventory does not match source tree … unregistered=['openadapt_flow/form_tx/presets/property_quote.json']. On main the same check passes, and patient_registration.json is listed in packages/flow/public-artifacts.json:1498. This step is the first one in packages / flow core lint (ruff, mypy), which packages-gate → ci needs. Fix: register the file (regenerate the inventory and review it).

Behavior parity: OK

  • build_property_quote_domain_schema (pack_compiler.py:150) now loads the JSON. The old builder body is byte-identical at 2f506d6 (the commit the test diffs against) and at current main (same sha256 of the function source), so the differential test compares against what main builds today.
  • test_the_shim_returns_what_the_old_builder_built[property_quote] passes locally, with history available. It checks model equality plus model_dump(mode="json") equality, so field order, synonym order and codecs all match.
  • Caveat: that test skips in CI's shallow checkout, so CI does not prove parity. A checked-in snapshot of the old dump would.

Packaging

I built a wheel with uv build and listed it: openadapt_flow/form_tx/presets/property_quote.json is shipped, along with the rest of presets/.

Generality gate

The JSON holds domain vocabulary for insurance quote forms, with no app, portal or customer names. I checked it against every term in scripts/generality.toml and found no hits. scripts/check_engine_generality.py: OK. Moving vocabulary from engine code into data is what the gate asks for.

Tests (at this head, on the box, Python 3.12, Flow lock)

  • pytest tests/test_form_tx*.py (12 files): 263 passed.
  • ruff check / ruff format --check on form_tx and the test: clean.

CI at review time

ci, packages-gate and run-ci failed at the draft guard ("draft PR: CI runs when marked ready"), from a run while the PR was still a draft. Evaluate protected-path evidence failed. 11 checks were skipped. No real CI has run at this head yet; the inventory failure above will show up when it does.

@abrichr

abrichr commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Architectural pivot (founder Option 1, 2026-11-23): freezing the hand-written form-tx DOM heuristic and word-list stack to focus on openadapt wrap + demonstration-derived CheckpointSpec + Cross-Tab Entity Ledger + GUI-to-API/MCP promotion. Branch preserved for reference.

@abrichr abrichr closed this Nov 24, 2026
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