procurement-ingest/lambdas/po/email_processor/tests
Adam Moussa 3dfe15b4b1
Converge quantity/price to Decimal on both paths
EXTRACTION_PROMPT declares quantity and price as JSON strings, so a
prompt-obedient Bedrock response stores DynamoDB Strings where the
template parser stores Numbers -- divergent attribute types for the
same email on the purchase-orders stream. Coerce numeric strings to
Decimal in the shared enrich_parsed post-stage (thousands-separator
safe; non-numeric strings kept verbatim) so both paths converge;
prompt rewording itself remains PR #2 scope.

The two-path parity test was circular -- it replayed the parser-
derived golden as 'the LLM output', so it could never see the type
divergence. It now feeds a prompt-shaped payload (string quantity/
price, LLM-filled site_code) through enrich_parsed and save_new_po,
and the fixture-hygiene test now asserts the scrubbed transport-token
header classes so fixture regressions are caught.
2026-07-16 16:03:43 -04:00
..
fixtures Scrub residual transport tokens from PO fixtures 2026-07-16 16:03:16 -04:00
_po_parser_support.py Add offline PO parser suite with scrubbed fixture corpus 2026-07-16 15:15:49 -04:00
conftest.py Add offline PO parser suite with scrubbed fixture corpus 2026-07-16 15:15:49 -04:00
test_po_bedrock_fallback.py Converge quantity/price to Decimal on both paths 2026-07-16 16:03:43 -04:00
test_po_parser.py Add offline PO parser suite with scrubbed fixture corpus 2026-07-16 15:15:49 -04:00
test_po_validation_gate.py Pin line-item currency to USD in the PO gate 2026-07-16 16:02:46 -04:00