Skip to content

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

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

abrichr wants to merge 2 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

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