procurement-ingest/lambdas/po/email_processor/tests/fixtures/expected/new-po-20.json

50 lines
1.4 KiB
JSON
Raw Normal View History

{
"email_type": "new_po",
"po_number": "2D-45085104",
"po_status": "Issued - Created",
"source_system": "coupa",
Scrub fixture-body PII and harden cancellation gate (sec review) /sh-security-review of PR #105 (5 fresh-context detectors + proof-or-kill verifier) confirmed two diff-introduced findings; both fixed here. F3 (medium, real PII in new fixtures): the harvest scrub replaced header tokens but left real third-party PII in message BODIES -- an Amazon contact's name/phone/personal email in non-coupa-02.eml and an internal t.corp.amazon.com ticket URL in comment-02.eml, plus real submitter/attn names recurring across the new_po corpus. Replaced every personal name, phone, personal email, and internal URL with synthetic placeholders (QP-soft-wrap aware) across both .eml bodies and expected goldens. Extended test_fixture_hygiene to scan BODIES (phone shapes, corp URLs, the leaked tokens), closing the header-only gap that let this through. F1 (medium, cancellation gate): _CANCELLATION_SUBJECT was unanchored and matched with .search(), unlike the anchored new_po pattern -- a subject merely ending with the cancellation phrase could be routed to the sticky- Cancelled write. Fully anchored it and switched to .match, and added a body-corroboration gate (the real Coupa body independently restates 'Purchase Order #<po> ... has been cancelled'); a near-miss/misrouted subject whose body does not corroborate now fails closed to the LLM (new reason code cancellation_body_unconfirmed). Pre-existing (advisory, not this PR): the LLM-fallback else->save_new_po dispatch and undelimited extraction prompt (issue #101 family) are byte-identical to main and unchanged here. 401 tests pass; ruff/format clean; cdk synth po-ingest clean.
2026-07-16 17:17:35 -04:00
"submitted_by": "Taylor Stubbsen",
"on_behalf_of": "Taylor Stubbsen",
"order_date": "04/21/26",
"revision_date": "04/21/26",
"last_opened": null,
"acknowledged_at": null,
"payment_terms": "90 NET",
"requisition_number": "46125203",
"department": null,
"view_order_url": "https://supplier.coupahost.com/orders/45085104?instance_url=https%3A%2F%2Famazon.coupahost.com%2F&supplier_id=239049&",
"supplier": {
"name": "SEA HAVEN INDUSTRIES:CORPORATE AP:SERVICES(OK6HE)"
},
"site_code": null,
"ship_to": {
"name": "Amazon.com Services LLC - SIN9 (SIN9)",
"address": "Amazon.com Services LLC - SIN9 (SIN9)\n305 Chaney Ave. STE. A\nGreenwood, IN 46143\nUnited States",
"street": "305 Chaney Ave. STE. A",
"city": "Greenwood",
"state": "IN",
"zip": "46143",
"location_code": "561142752",
Scrub fixture-body PII and harden cancellation gate (sec review) /sh-security-review of PR #105 (5 fresh-context detectors + proof-or-kill verifier) confirmed two diff-introduced findings; both fixed here. F3 (medium, real PII in new fixtures): the harvest scrub replaced header tokens but left real third-party PII in message BODIES -- an Amazon contact's name/phone/personal email in non-coupa-02.eml and an internal t.corp.amazon.com ticket URL in comment-02.eml, plus real submitter/attn names recurring across the new_po corpus. Replaced every personal name, phone, personal email, and internal URL with synthetic placeholders (QP-soft-wrap aware) across both .eml bodies and expected goldens. Extended test_fixture_hygiene to scan BODIES (phone shapes, corp URLs, the leaked tokens), closing the header-only gap that let this through. F1 (medium, cancellation gate): _CANCELLATION_SUBJECT was unanchored and matched with .search(), unlike the anchored new_po pattern -- a subject merely ending with the cancellation phrase could be routed to the sticky- Cancelled write. Fully anchored it and switched to .match, and added a body-corroboration gate (the real Coupa body independently restates 'Purchase Order #<po> ... has been cancelled'); a near-miss/misrouted subject whose body does not corroborate now fails closed to the LLM (new reason code cancellation_body_unconfirmed). Pre-existing (advisory, not this PR): the LLM-fallback else->save_new_po dispatch and undelimited extraction prompt (issue #101 family) are byte-identical to main and unchanged here. 401 tests pass; ruff/format clean; cdk synth po-ingest clean.
2026-07-16 17:17:35 -04:00
"attn": "Taylor Stubbsen"
},
"total_amount": 1357.0,
"currency": "USD",
"fiscal_year": null,
"trade": null,
"coupa_category": "Maintenance - Facilities",
"line_items": [
{
"description": "General Building - Parking Lot - Install/Repair/Removal - BBM",
"amount": 1357.0,
"currency": "USD",
"need_by": "04/20/26",
"category": "Maintenance - Facilities",
"account_code": "4D-9M09-5070-76571-0000-0000-4432-000045",
"period": "2D AMOC 2026",
"quantity": null,
"unit": null,
"price": null
}
]
}