Repository navigation
Conversation
The entity kinds that name the person a form is about (applicant, insured, self, ...) are domain words. They now ship as form_tx/presets/words/primary_entity_kinds.json (openadapt.form-word-list/v1), and reconciler._PRIMARY_ENTITY_KINDS loads them. The frozenset is equal to the old one; a test reads the old constant from history and compares.
From review: a JSON list or string raised AttributeError instead of ValueError. load_words is now cached like the preset loader, and a test feeds it six malformed files.
|
From: Gemini (gemini-3.1-pro-preview), round 1 Sent the full diff of this PR's own files, those files in full, and any earlier findings. This PR successfully extracts the hardcoded I have a few minor findings regarding the JSON validation logic in the loader. SHOULD-FIX1. You can fix this by adding a data = json.loads((_WORDS / f"{name}.json").read_text(encoding="utf-8"))
words = data.get("words") if isinstance(data, dict) else None
if (
not isinstance(data, dict) # <-- Add this to short-circuit
or data.get("schema") != WORD_LIST_SCHEMA
or data.get("name") != name
or not isinstance(words, list)
or not all(isinstance(w, str) for w in words)
):
raise ValueError(f"word list {name!r} is not {WORD_LIST_SCHEMA}")NIT2. Missing 3. Test gap for malformed word lists Verdict: APPROVE WITH NITS |
|
From: Gemini (gemini-3.1-pro-preview), round 2 Sent the full diff of this PR's own files, those files in full, and any earlier findings. This round looks great. You have successfully addressed all the findings from the previous review:
There are no gate-direction regressions, fail-open paths, or generality violations. The engine's behavior remains identical while successfully extracting domain-specific vocabulary into pack data. I have no further findings. Verdict: APPROVE |
|
From: Claude Author declaration. I wrote this change and checked it at the head above. Everything here is synthetic; no real app was run.
|
FormPack.primary_entity_kinds (optional) replaces the engine's default list for that pack; None keeps the default from presets/words. An unset override is left out of the pack digest, so existing packs keep their digests. A test runs one dossier against a pack with the default, the same list and an empty list, and checks the empty list makes the applicant's row a conflict.
|
From: Gemini (gemini-3.1-pro-preview), round 3 (delta since 7b52681) Sent the full diff of this PR's own files, those files in full, and any earlier findings. This round looks great. The addition of the I have reviewed the delta for gate-direction regressions, fail-open paths, and generality violations.
I have no further findings. Verdict: APPROVE |
|
From: Claude Author declaration at the head above. Synthetic tests only; no real app was run.
|
What this does
Third of the form_tx preset moves (stacked on the insurance preset PR).
reconciler._PRIMARY_ENTITY_KINDSnames the people a form is about: applicant, insured, self and so on. Those are domain words. The list now ships asform_tx/presets/words/primary_entity_kinds.json, under a new word-list formatopenadapt.form-word-list/v1, with a name, an "about" line and the words. The constant loads it, and the name stays the same.presets.load_words(name)refuses an unknown list, a mismatched name and anything other than a list of strings.No behaviour change
tests/test_form_tx_presets.pyreads the oldfrozensetliteral fromreconciler.pyat2f506d6c4withastand checks that the new constant is equal and of the same type.Follow-up, not done here. The general fix is a per-pack field, for example on
EntityTableSpec, that names which entity kinds a table also accepts. This PR only takes the words out of the code.Tests
tests/test_form_tx_presets.py: 8 passed.ruffis clean.Since opening
FormPack.primary_entity_kindsis optional. When set, it replaces the default list for that pack;Nonekeeps the default.FormPack.digest(), so existing packs keep their digests.FormPack.digest()the same way, so the second of the two to merge needs a small merge.