Engineering Notes

How we measured SafeState across 26 real repositories.

Every number on our landing page comes from offline, reproducible runs on real TypeScript, JavaScript, and Python repositories. We keep third-party repository names private in public documentation and report aggregate failure classes and methods below.

1. 26-repository empirical study (65 verified stateful bugs)

We ran SafeState offline against 26 active open-source backends, workflow engines, CLIs, and developer platforms (covering Drizzle, Prisma, SQLite/D1, raw SQL, and ORM-free TypeScript/Python state machines). A finding was counted only when SafeState produced a deterministic seed and runnable counterexample proving the invariant violation.

Failure classTypical trigger sequence
Async TOCTOU & read-modify-write racesTwo calls overlap across an await (outbound fetch, payment SDK, or async DB write), causing double refunds, duplicate reservations, or lost updates.
Webhook & retry idempotency failuresOut-of-order or duplicate delivery of lifecycle webhooks resurrects a canceled subscription or double-credits a ledger balance.
Auth, session & tenant boundary leaksToken refresh racing with revocation, stale permission caches surviving role removal, or missing org-scope filters on nested queries.
Module singleton & cache leaksTop-level Map/Set caches or mutable variables retaining stale state across logical resets or concurrent tenants.
Quota, rate-limit & timer boundary driftBurst retries crossing virtual clock boundaries or partial failure paths failing to release reserved capacity.

2. Deterministic throughput & byte-identical replay

Across a 10,000-trace benchmark running multi-step billing and webhook operations with virtual time, seeded PRNG, and in-memory database snapshot/restore, SafeState sustained 372 traces/sec end to end while verifying byte-identical SHA-256 trace hashes across repeated seeded replays. On a 2,300-file TypeScript monorepo, SafeState’s single-pass TypeScript AST pre-flight audit completes in 2.7 seconds at $0 LLM cost.

3. Anti-tautology mutation gating

Property and stateful tests fail quietly when assertions are too weak or when a harness skips the real state transition. SafeState runs an internal mutation gate before accepting any passing invariant suite: it injects targeted P0 faults into the target module (removing refund caps, dropping idempotency guards, inverting status checks) and verifies the invariant fails on the broken mutant. Invariants that stay green against planted faults are pruned and flagged.

4. Scope boundaries & caveats