Two parse bugs that between them made 218 of 776 captured messages
unreadable. Neither was the "old template" they were filed as.
Uber writes the currency three ways and only two were handled. "Total
A$54.87" is what it sends for ordinary Australian orders — A$ misses
[A-Z]{3} by one character — so 98 of 275 Uber Eats mails and 78 of 275
trip mails failed with "no Total found" while the amount sat in plain
sight. Most were 2024-2025, i.e. current mail. NZ$, US$, S$, HK$, C$ and
a bare rupee/euro/pound symbol are handled the same way. A bare "$" is
still left unresolved on purpose: a dozen currencies use it, and the
body-wide scan that reads the receipt's own stated code should win.
A DoorDash order paid from credits states "Total Charged $0.00"
truthfully, above a real subtotal. Read literally that is a $0 order, and
validateOrderTotals rejected 88 of them as non-positive — discarding
exactly the credit-funded spend this pipeline exists to surface. The
order's value is its subtotal; recording zero would show the order and
hide what it cost. Guarded on the receipt actually saying credits, so an
empty mail still fails rather than inheriting a stray subtotal, and the
header cross-check stands down for these or it rejects the figure the
parser deliberately overrode.
Measured A/B over all 776 captures: 254 parsed by both parsers with zero
change to any amount or currency, 0 lost, 214 newly readable. Both fixes
mutation-tested — reverting the regex fails 4 tests, removing the credits
branch fails 3.
Fixtures are real captured receipts, per the 2026-07-26 rewrite: the
earlier synthetic suite passed while the parser could not read a real
email.
No history replay — I7 idempotency refuses re-reads and that needs an
explicit update mode. This fixes ingest from here on.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
[
|
||||
{
|
||||
"file": "dd-credits-zero.html",
|
||||
"id": "19b692bdf1ea7a08",
|
||||
"subject": "Order Confirmation for Siddharth from Chilli India",
|
||||
"receivedAt": "2025-12-29T08:14:00.000Z",
|
||||
"sender": "DoorDash <no-reply@doordash.com>",
|
||||
"why": "DoorDash credits-funded, Total Charged $0.00",
|
||||
"stated": null
|
||||
},
|
||||
{
|
||||
"file": "ue-aud-prefix.html",
|
||||
"id": "AQMkADAwATM0MDAAMS1hYzQyLTVjZDktMDACLTAwCgBGAAADS6kDcxBxKkKwbCK1wU1QlwcA7Ex_hlaTTU0AgHQ16optl_AAAAIBDAAAAOxMfoZWk01NAIB0NeqKbZfgAAhmyVi0AAAA",
|
||||
"subject": "Your Friday evening order with Uber Eats",
|
||||
"receivedAt": "2025-10-17T09:50:39Z",
|
||||
"sender": "noreply@uber.com",
|
||||
"why": "Uber total written as Total A\\$",
|
||||
"stated": "Total A$54.87"
|
||||
},
|
||||
{
|
||||
"file": "ue-nzd-prefix.html",
|
||||
"id": "AQMkADAwATM0MDAAMS1hYzQyLTVjZDktMDACLTAwCgBGAAADS6kDcxBxKkKwbCK1wU1QlwcA7Ex_hlaTTU0AgHQ16optl_AAAAIBDAAAAOxMfoZWk01NAIB0NeqKbZfgAAf4nGLUAAAA",
|
||||
"subject": "Your Saturday evening order with Uber Eats",
|
||||
"receivedAt": "2025-05-03T19:26:05Z",
|
||||
"sender": "noreply@uber.com",
|
||||
"why": "Uber total written as Total NZ\\$",
|
||||
"stated": "Total NZ$22.83"
|
||||
},
|
||||
{
|
||||
"file": "ut-aud-prefix.html",
|
||||
"id": "AQMkADAwATM0MDAAMS1hYzQyLTVjZDktMDACLTAwCgBGAAADS6kDcxBxKkKwbCK1wU1QlwcA7Ex_hlaTTU0AgHQ16optl_AAAAIBDAAAAOxMfoZWk01NAIB0NeqKbZfgAAhLnaIfAAAA",
|
||||
"subject": "Your Saturday morning trip with Uber",
|
||||
"receivedAt": "2025-09-05T23:17:58Z",
|
||||
"sender": "noreply@uber.com",
|
||||
"why": "Uber total written as Total A\\$",
|
||||
"stated": "Total A$14.19"
|
||||
},
|
||||
{
|
||||
"file": "ut-nzd-prefix.html",
|
||||
"id": "AQMkADAwATM0MDAAMS1hYzQyLTVjZDktMDACLTAwCgBGAAADS6kDcxBxKkKwbCK1wU1QlwcA7Ex_hlaTTU0AgHQ16optl_AAAAIBDAAAAOxMfoZWk01NAIB0NeqKbZfgAAf1poEUAAAA",
|
||||
"subject": "Your Sunday afternoon trip with Uber",
|
||||
"receivedAt": "2025-04-27T13:27:16Z",
|
||||
"sender": "noreply@uber.com",
|
||||
"why": "Uber total written as Total NZ\\$",
|
||||
"stated": "Total NZ$10.83"
|
||||
},
|
||||
{
|
||||
"file": "ut-inr-symbol.html",
|
||||
"id": "AQMkADAwATM0MDAAMS1hYzQyLTVjZDktMDACLTAwCgBGAAADS6kDcxBxKkKwbCK1wU1QlwcA7Ex_hlaTTU0AgHQ16optl_AAAAIBDAAAAOxMfoZWk01NAIB0NeqKbZfgAAgPBHtAAAAA",
|
||||
"subject": "Your Friday evening trip with Uber",
|
||||
"receivedAt": "2025-06-06T18:00:51Z",
|
||||
"sender": "noreply@uber.com",
|
||||
"why": "Uber total written as Total \u20b9",
|
||||
"stated": "Total \u20b9622.74"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user