30 February, spelled a third way. Red-teaming the on-call and delivery-commission analyzers

16 faults seeded into two analyzers, 8 caught. The on-call parser read 2026-02-30 as 2 March, in a spelling our date lint missed. A Mailchimp check had it too.

Today's red-team run seeded 16 faults, 8 each, into two calculators people paste exports into: the on-call load analyzer and the delivery-commission analyzer. redteam.py campaign applied each fault, ran the suite and restored the file. The suites caught 8 of the 16: 6 of 8 for the delivery tool, 2 of 8 for on-call.

The escapes were the usual boundary misses:

FileFaultWhy it got through
on-callhumanMin: m < 60 to m < 61no test at exactly 60 minutes
on-callGini sort a - b to a + bGini only tested on already-sorted input
on-callGini n * sum to n / sumthe test said > 0.7, not 0.75
on-calldefault timezone 0 to 1no test pinned UTC as the default
on-callhigh-urgency count starts at 1nothing read people[i].high
on-callresolved column read only from index 1no file put resolved_at first
deliveryweekday filter >= 5 orders to >the test used 6 orders, not 5
deliveryexample dates slice(0, 16) to 17nothing checked the example's date shape

Each now has a test that fails with the fault and passes without it (redteam.py rerun: 8 of 8).

The real bug was next to the faults

The on-call parser checked its timestamp like this:

if (Number.isNaN(t) || +mo > 12 || +d > 31 || +h > 23 || +mi > 59) return null;

Date.UTC(2026, 1, 30) is not NaN. It is 2 March. So a row stamped 2026-02-30 10:00 was counted as a Monday page on 2 March instead of being skipped as unreadable. The same line let 10:00:60 through as 10:01 and an offset of +25:00 or +05:99 shift the page by a day. The fix round-trips the calendar day, and checks seconds and the offset's range.

This class is not new here. On 12 November a lint, platform/ci/check_calendar_dates.py, began flagging day checks that give every month 31 days. It knew two spellings, d >= 1 && d <= 31 and d < 1 || d > 31. The on-call line has a third: a one-sided || d > 31 in a chain, with no < 1. Teaching the lint that spelling found one more copy, in the Mailchimp audience CSV checker, whose birthday check called 02/30, 31/04 and 11/31 real month and day pairs. Mailchimp would refuse them, and the report said nothing. It now uses a month-length table, with 29 February allowed since a birthday has no year.

The lint also found the sales agent's 2/30 rewrite, which is safe because the parser round-trips the date a few lines later. So the new spelling covers only the reject form, and b > 12 && b <= 31 is not flagged. The lint now catches both originals on the pre-fix code and is clean on main, so the next copy of this line fails CI instead of waiting for a red-team run.

Catch rate on today's targets: 50% before, 100% after. Real defects: 3 found, 3 fixed, counting the lint's blind spot.

All writing · More in Testing and red team · All tools and research