Repository navigation
Conversation
…can override them The texts a yes/no field reads as yes or no (yes, y, true, 1 / no, n, false, 0) are English vocabulary. They now ship as presets/words/true_tokens.json and false_tokens.json. FieldCodecSpec gains optional true_tokens and false_tokens, which replace the defaults for that codec when reading and supply the typed word when both are set; a text in both lists is refused as ambiguous. An unset override is not written when a codec is dumped, so existing packs dump and hash exactly as before. The default sets equal the old literals (a test reads them from history).
…empty list From review: with only true_tokens set, True was typed as "Yes", which that codec then refused on read-back. Each side now types its own first word when set. An empty override list is refused.
|
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 yes/no tokens into JSON presets and allows codecs to override them deterministically. The custom serializer correctly omits unset overrides to preserve pack digests, and the equivalence logic remains strictly fail-closed. There is one correctness bug where the engine can type a value that it immediately rejects during read-back. SHOULD-FIXIndependent overrides break text entry formatting if spec.true_tokens and spec.false_tokens:
# A codec with its own words types its own first word.
return spec.true_tokens[0] if yes else spec.false_tokens[0]
return "Yes" if yes else "No"If a user overrides only one side (e.g., The formatting should evaluate the overrides independently: if yes:
return spec.true_tokens[0] if spec.true_tokens else "Yes"
return spec.false_tokens[0] if spec.false_tokens else "No"NITEmpty tuple overrides true_tokens: Optional[tuple[str, ...]] = None
false_tokens: Optional[tuple[str, ...]] = NoneConsider adding REQUEST CHANGES |
|
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. Both earlier findings have been perfectly addressed. The independent evaluation in The equivalence logic remains strictly fail-closed, and the custom serializer correctly preserves pack digests for older packs. The tests are comprehensive and verify the new behavior well. APPROVE |
|
From: Claude Author declaration at the head above. Synthetic tests only; no real app was run.
|
What this does
Seventh form_tx preset move, stacked on the role-qualifier PR. The texts a yes/no field reads as yes (
yes,y,true,1) and as no (no,n,false,0) are English vocabulary. They now ship aspresets/words/true_tokens.jsonandfalse_tokens.json, andcodecs._TRUTHY_TOKENSandcodecs._FALSY_TOKENSload them.The pack override.
FieldCodecSpecgains optionaltrue_tokensandfalse_tokens.Where the override doesn't reach. It applies wherever a codec is passed:
normalize_with_codec,values_equivalentandformat_for_text_entry. The calls inreconciler.pythat pass no codec, such as checkbox state, keep the default words.No behaviour change by default
2f506d6c4.model_serializerleaves an unset override out of the dump. A codec without overrides therefore dumps, and a pack hashes, exactly as before. A test checks the dump, and checks that the dump loads back to an equal codec.Tests
test_form_tx_presets.py,test_form_tx_lease_and_compiler.pyandtest_form_tx_reconciler_and_receipts.py: 58 passed.ruff checkandruff formatare clean.