Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Teleport 17 min read Deep dive mediumAdept

Property Based Thinking

Properties come in two flavours: formal safety and liveness properties that constrain a whole system over time, and property-based testing (PBT) properties that relate a function's inputs to its outputs. Using Teleport's generic `List` pagination implementation (`genericLister`) as the running example, properties such as page size bound, uniqueness, termination and completeness are derived from design docs and classified as safety, liveness, postcondition, metamorphic or model-based. The PBT side is shown in Go with the `rapid` library, including guiding the fuzzer toward boundary values and its lack of coverage-guided feedback. To check system-wide properties under concurrency and faults without building a formal model, Teleport runs a full cluster in Antithesis's deterministic simulation environment. The core recommendation is to define properties at design time, because retrofitting them onto existing code is much harder.

Assumes: Go testingunit testing basicsAPI pagination

Related posts

  • Random Fuzzy Thoughts

    TigerBeetle mediumAdept

    Treating a fuzzer's byte slice as a finite PRNG unifies coverage-guided fuzzing with structured property-based testing: the entropy length measures input complexity, gives test-case minimization almost for free, and tells interactive simulations when to stop injecting faults. A seed reproduces a failure only at a specific commit, so robust regression tests should persist the generated structured data (e.g. a .wasm module) rather than the seed, using a separate generate/build/process pipeline that also supports hand-written inputs. For interactive distributed-system tests, a livelock in TigerBeetle was reproduced by running the VOPR simulator with a perfect network and steering it with predicates over system state, suggesting regression suites made of predicate 'key frames' that random traces must hit.

  • Protocol-Aware Deterministic Simulation Testing

    TigerBeetle hardMaster

    TigerBeetle's deterministic simulator (the VOPR) has full visibility into each replica's consensus and storage state, so it can check invariants that black-box tools like Jepsen or Antithesis cannot see through user-facing APIs. For safety, it asserts that every committed WAL entry has matching checksums across replicas, that LSM manifest structure is consistent everywhere, and that replicas are byte-for-byte identical, which goes deeper than the cheaper production checks that crash a diverging backup. For liveness, it enforces per-replica invariants: a replica with an uncorrupted WAL must never need cluster coordination to recover, and missing blocks must be repaired from intact copies on other replicas whenever any copy still exists.

  • The final boss of reliability: formal verification

    Turso mediumAdept

    Turso, a from-scratch SQLite rewrite, is adding formal verification via Aretta AI's Aristo, which turns natural-language intents annotated on code into formally checked properties, to complement its deterministic simulation testing and Antithesis runs. Aristo found in minutes a durability bug that DST had missed. When Turso acts as a sync replica of a cloud database, it bypasses the page cache, so pages became dirty without the dirty bit being set and were sometimes written to disk without fsync. The case for the approach is that properties like "a commit frame must be fsynced before being reported durable" are cheap to check formally. Runtime testing can miss them, because most runs happen to call fsync for unrelated reasons.

  • A Descent Into the Vörtex

    TigerBeetle mediumAdept

    TigerBeetle has added Vortex, a non-deterministic, generative full-system test harness that complements its Deterministic Simulation Testing by exercising real production binaries and client libraries from the outside in. A supervisor coordinates a cluster of stock replicas, a workload that checks safety properties, and language-specific client drivers (Zig and Java so far). It injects network faults through a TCP proxy, kills or pauses processes, and runs liveness checks. In four months it found two bugs: incorrect request batching in tb_client and double connection termination. Planned work includes continuous runs, upgrade testing, network partitions and storage faults.

  • How we use formal modeling, lightweight simulations, and chaos testing to design reliable distributed systems

    Datadog Engineering hardMaster

    Datadog validated the design of Courier, a multi-tenant message queue built on multiple FoundationDB clusters after its March 2023 outage, by combining TLA+ formal modeling, lightweight simulations and chaos testing. Each tenant is sharded across 4 of 8 FoundationDB clusters so that no two tenants share the same set, and brokers health-check clusters and route around failures. The TLA+ spec models brokers, senders and receivers with weak fairness, and TLC checks properties such as at-least-once delivery across every reachable state. Simulations then cover what model checking cannot, such as latency, cost and scalability. Together these give design-level confidence that unit tests miss, at the cost of keeping models and simulations in sync with the design.

The quest for software engineering knowledge.

Look:
Layout: