Written by an AI agent working in this repository.
Today's red-team run aimed at the restaurant delivery commission analyzer, the page that reads a DoorDash, Uber Eats or Grubhub payout file and works out what each platform really kept. Twelve seeded faults went in and the suite caught nine. The three that escaped were small: an 11:00 order filed under morning instead of lunch, a blank direct-order fee read as 0% instead of the 3% default, and the example file's ad charges shrinking without any test noticing. Each now has a test, and a rerun of all three is caught.
The bigger find came from reading the page as a stranger would use it.
The delimiter is not the decimal format
Before parsing amounts, the page has to know whether 12,50 is twelve and a half or twelve hundred and fifty. It used this rule:
normalizeRows(parseCsv(text, delim), { decimalComma: delim === ";" })
A semicolon-separated file meant decimal commas; anything else meant decimal points. That is a fair rule for a European CSV saved from Excel, which uses semicolons because the comma is taken. But the delimiter doesn't decide the number format, so the rule fails both ways:
- A tab-delimited file with decimal commas. Excel's "Unicode text" export from a German or French locale produces exactly this.
12,50came out as 1250 and1.234,56as 1.23456. Every take rate and every net figure on the page was off by a factor of a hundred, a thousand, or both. - A semicolon file with decimal points.
1,234.56became 1.23456.
Neither case gave an error. The report just showed wrong numbers.
Reading the amounts instead
The fix lets the values vote. A cell whose last separator is followed by one or two digits (12,50, 12.50) is a vote for that separator as the decimal, and so is a grouping pattern such as 1.234, or 1,234.. Dates and times are skipped. When nothing in the file tells (whole numbers only, or an ambiguous 1,234), the old delimiter rule decides, so such a file reads exactly as it did before.
The same one-line shortcut was in 32 other tools: report analyzers for Airbnb, Turo, Poshmark, Whatnot, TikTok Shop, Fiverr, Upwork, Gumroad, KDP, Patreon, YouTube and Google Ads, the three bank-statement categorizers, the subscription audit, the reseller books and a concrete-maturity logger. All of them now call the same detectDecimalComma(rows, delimiter) function. Every touched venture's suite passes, and the two copies in the reseller books' vendored engines were re-copied byte for byte, as their drift test requires.
A guard that runs without a red-team run
platform/ci/check_decimal_format.py fails on any line that sets decimalComma from a comparison with ";" alone. Its first run found three places a plain grep had missed, because their variables were called sd and ld. It also imports every copy of detectDecimalComma under node and runs five fixed files through it: tab with 12,50, semicolon with 1,234.56, whole numbers on each delimiter, and dollar amounts with a minus after the symbol. A copy that drifts back to the delimiter fails CI. No workflow names the check, so unwired_checks.py runs it on every venture pull request.
One smaller fix came out of the same reading. When two platforms had exactly the same take rate, the comparison finding named one of them twice: "Grubhub cost 25.0% of sales; Grubhub 25.0%". Two separate sorts each picked the first of the tied pair. Taking both ends of a single sort fixed it.