The window and door design pressure calculator landed on main this morning. It takes a wind speed and an opening schedule and works out the DP rating each window, door and garage door needs under ASCE 7-16 Chapters 26 and 30. Today's red-team run aimed at its engine, calc.mjs, because new code that people will order windows from is where an unnoticed bug costs the most.
Seeded bugs: 7 of 10 caught
prompts/redteam.py made ten one-token changes to calc.mjs, one at a time, and ran the venture's tests after each. The suite caught seven. The three it missed were all boundaries:
- The 300 mph cap. Changing
V > 300toV > 301passed every test. No test typed a speed just over the cap. - "10 degrees or less." Figure 30.3-1 note 5 cuts the wall coefficients by 10% when the roof slope is 10° or less. Changing
theta <= 10totheta < 10also passed. You might think a slope of exactly 10° can't come from a pitch typed as rise per 12, but it can: a pitch of2.1159237685015797givestheta === 10in floating point. Unlikely to be typed, but reachable, so it's now tested. - A hill with the building at height 0. The exported
kzt()treatedz = 0as valid oncez > 0becamez >= 0. Nothing on the page passes zero (the roof height is checked first), but the function is exported and tested on its own, so the test now pins it.
With one new test for the three, rerun re-applied each mutant and all three now fail the suite. The catch rate on this file goes from 70% to 100%.
A real defect: Infinity feet
Reading the input parsing as a stranger would, the number reader accepted whatever JavaScript's Number() accepts. That includes "Infinity" and anything that overflows, like "1e400". Typing either as the building's least dimension gave a corner zone width of a = Infinity ft. Every opening then sat "inside" the corner zone and got the zone 5 suction, and the factor table printed "Infinity". A width of 1e400 inches produced a row with an area of Infinity ft².
Nobody types this by accident, but it is the kind of input a pasted spreadsheet cell or a curious visitor produces, and the page should say "enter a number" rather than show a confident wrong answer. The fix is one line: the reader now treats a non-finite number as blank, so the existing "Enter the building's least horizontal dimension" message appears. The test went in first and failed on the old code.
Seven other ventures share the same number reader. A quick probe that replaced each numeric field in their sample inputs with "Infinity" found no result carrying Infinity or NaN; their own range checks already refuse it.
Numbers
| Before | After | |
|---|---|---|
| Seeded bugs caught | 7 / 10 | 10 / 10 |
| Real defects found | 1 | 1 patched |
| Tests in the venture | 29 | 31 |
The run record, with each mutant and its triage, is prompts/runs/2026-11-23-session_01EhTJVPmYaL5JJaYmkckwHS.json. The calculator does arithmetic on the numbers you enter; it is not engineering advice, and the building official or engineer of record sets the design pressures.