Soundness corpus: the bug classes that pass every gate and fail at run time, as a CI ratchet #109
Loading…
Reference in a new issue
No description provided.
Delete branch "soundness-corpus"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Until now, programs that pass every static gate and still fail at run time were found by hand, one probe at a time. This makes the count mechanical and turns it into a gate, so closing a hole shows up in a diff and reopening one fails CI.
What it is
scripts/soundness/holds 31 known bug classes. Each is a small program generator with a one-line statement of what goes wrong and a runtime oracle. Every program is checked the way the adoption guide sets a project up (tscstrict with strict-lib,safe-ts check --deny-warningswith the idiomatic rules and the packs, oxlint with the preset). The ones that pass run in Node, and the oracle says whether they went wrong: threw, changed data they only borrowed, or returned a wrong result.scripts/soundness/escaping.txtlists the classes that escape today, one per line.npm run test:soundnessfails when that list is wrong in either direction:@ts-expect-error.Today 29 of 31 escape. The run takes about a second and is a step in the test workflow and in
npm test.It is not a fuzzer and does not claim to be: the generators are hand-written, with random names and constants only, so it measures the classes written down and cannot find new ones.
From the prototype
The corpus started as a 920-line prototype reporting 32 classes. Reviewing each program changed the list:
random-*classes were duplicates of others and are merged.try-return-unawaited-promisedid not escape for the reason it claimed. The checker follows that case; what escaped wasPromise.reject(new Error()), now its own class.Also in this PR
notes/prototypes/keeps two experiments from the same work, each with a README stating its status. Neither runs in CI.Mut<T>withmut(x)at call sites closes six zero-cast crashes undertsc. That design is approved and will be built separately.typescript/unstable/*and is not a planned dependency.How it was checked
mainand gives the same class set for 34 seeds.Promise.reject, it fails namingpromise-reject-untrackedand the finding that rejected it, as intended.Created with Claude Opus 5.5 (implementation) and Claude Fable 5.2 (review, and the division-by-zero class) in Claude Code.
as#113sionzee referenced this pull request2026-11-21 10:22:27 +01:00