From 4bd426daf29d67110b23d1afde3ab9a21af73dd0 Mon Sep 17 00:00:00 2001 From: Adam Moussa Date: Thu, 16 Jul 2026 16:16:58 -0400 Subject: [PATCH] Coerce bare-int quantity/price to Decimal in enrich_parsed GPT-4.1 cross-family review of the final PR diff (no BLOCK) flagged residual type drift: parse_float=Decimal rules out floats on the LLM path, but a bare JSON int survived as Python int. Coerce it so both parse paths emit one canonical Decimal type. --- lambdas/po/email_processor/handler.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lambdas/po/email_processor/handler.py b/lambdas/po/email_processor/handler.py index 58d8fda..9e7a45e 100644 --- a/lambdas/po/email_processor/handler.py +++ b/lambdas/po/email_processor/handler.py @@ -373,6 +373,11 @@ def enrich_parsed(parsed: dict, s3_key: str, email_subject: str): item[field] = Decimal(value.replace(",", "").strip()) except InvalidOperation: pass + elif isinstance(value, (int, float)) and not isinstance(value, bool): + # parse_float=Decimal means floats can't occur on the LLM path, + # but a bare JSON int would slip through as Python int; coerce + # so both paths emit one canonical Decimal type (cross-review FIX). + item[field] = Decimal(str(value)) return parsed