Testing a Durable app

Four layers: workflow tests on memory stores, the store proof, the tree rules, the platform contract; recording a provider.

Open in CursorView as Markdown

Generated from the SDK's own source (docs/durable/testing.md) at build; edit there.

What you can test, how, and what each layer costs (ADR-0072). Four layers, each a question the others cannot answer; every command is shown as it runs in the engine's own repository, with the unit of ADR-0072's batch that landed it beside it (every unit landed on 2026-10-11; the kit stays in the engine's own packages while ADR-0046 §M's extraction pause holds). The house rule under all four: a test that is green proves something, a finding carries its fix, and nothing is retried ("Why no retries" below).

Layer The question Where it runs Cost
1. Workflow tests on memory stores and fakes Does this workflow survive attempt 2, undo what it did, emit what it says and call the provider once? Your test runner; no database, no network seconds
2. The store proof Does the engine's store behave on your Postgres as on the reference, and does the schema stand as stamped? Your Postgres (a service container in CI) minutes
3. The tree rules Is there a line the framework cannot keep its promises over? Your test runner over your tree; no database seconds
4. The platform contract Is what was deployed a thing the hosted plane can serve? Your deploy job, against the plane seconds

1. Workflow tests (seconds, no database)#

The harness is testDurable() of @durable-sdk/testing (ADR-0051 §3): the engine over memoryStores() behind one call, with a fake platform (every wake recorded), a session factory, a clock the test moves and readers for what a run left behind. Hand it what createDurable() was handed; the engine's own repository reads the fields off the bound instance in @durable-sdk/testing (testDurable()), which also puts its two databases on memory doubles and installs the fakes.

import { testDurable } from "@durable-sdk/testing";
import { durable } from "../src/durable"; // the barrel over createDurable()
import { helloWorkflow } from "../src/workflows/hello";

const base = durable.config;
const t = testDurable({
  scope: base.defaultScope,
  catalog: base.catalog,
  partition: base.partition,
  principal: base.principal,
  redaction: base.redaction,
  reverters: base.reverters,
  workflows: base.workflows,
  listeners: base.listeners,
  clock: { start: "2026-10-11T12:00:00Z" },
});

const r = await t.run(helloWorkflow, {
  shop: "s",
  orderId: "o1",
  requestId: "r1",
});
expect(r).toMatchObject({ status: "completed" });
expect(await t.steps(r.runId)).toMatchObject([{ name: "hello.greet" }]);
await t.advance("3h"); // a tick a minute: a delayed fact, a timer, a slot fire when due
expect(await t.outbox({ undelivered: true })).toEqual([]);
  • t.run(definition, input, { actor? }) executes as system:test; t.emit(name, payload) queues a fact as a route would; t.tick() is one whole tick; t.advance("3h") moves the clock and runs a tick at every minute crossed (never early: a fact due mid-minute lands at the next minute's tick). The clock is the harness's: a body reads a moment from instance().now(), never Date.now(), so advance is the only way time moves, and a retry's delay, a rate bucket's refill and an external step's in-flight window all run on it.
  • The readers are the console's views: t.detail(runId), t.runs(), t.steps(runId), t.ledger(scope), t.outbox(filter), t.waits(), t.wakes(); logs: "collect" keeps the engine's lines for t.logged(). t.reset() empties the world and puts the clock back; t.dispose() ends it.
  • A connector is a fake you bind through your own seams; in this repository tests/helpers/fakes (fakeShipping().install(), then answer, answers, fail, failAfter, flip, calls), installed for every connector at once by testDurable({ fakes: true }) with the network fenced. The fakes stay the host's: the package names no provider.

Crash it and let it resume. The seams are on every harness: t.crashAfterStep(seq, { workflow }) arms one crash once the step row at that seq lands (t.run answers in_progress, fenced: true, the run RUNNING); t.crashBeforeFinish(true, { workflow }) arms one at the finish (the body returns whole, the outcome never lands); t.crashInsideStep(seq, { after: "write", workflow }) one inside the step, after its write and before its row; t.crashBeforeStep one at the step's fenced insert. Then t.advance(t.durable.leaseMs + 60_000) lets the resumer claim the run as attempt 2, and t.crashed() says which attempt it took and where. What to assert: the run COMPLETED, every row at or before the crash a replay row, and every fake's count the same as on a clean run.

The double-run proof. prove() of @durable-sdk/testing (TQ-001) runs one definition clean, then crashed at every boundary (the start of each step, after each step, inside each step that writes your store or calls a provider, the finish) and resumed, and answers its findings: a body invoked twice (a fake's count that grew, named with the step), a memo lost to the cap or a secret, a step whose stored output is not what the body got back, a provider write made again after a lost record. The package knows the core and itself; what is yours comes in through ProveOptions: the harness, one run of the definition, your fakes' counters (callsByStep, writesByStep), seedWorld (a definition's world beside example, put where the body reads it before every run the proof makes) and hostWrites (your store's write journal and its name in a finding). This repository binds it in tests/helpers/replay-proof.ts over testDurable({ fakes: true }), and the guard the workflow-replay guard runs it over every registered definition, so a workflow is in it the day it is defined (ADR-0060 decision 1).

A red test from a production failure. A run that failed on a deployment is one document, its bundle (GET /admin/api/runs/<id>/bundle, the MCP run_bundle), and one command turns it into a failing test:

ADMIN_TOKEN=… durable-sdk replay <runId> --api <url> [--out tests/replays]

The file it writes seeds the bundle into a harness and redrives the run as the console's Redrive would (replayRun(bundle, "<workflow>", { harness, seedHost }) of @durable-sdk/testing: the completed steps served from their rows, the host's rows under host seeded through your hook, the failed step re-invoked against the fakes you bind), then expects completed: red until the cause is fixed, the regression test once it is green. Review the bundle before you commit the pair (it is redacted at the source but may name ids).

The scenario DSL (TQ-003): one readable test per workflow, scenario(t, name, { seedWorld, providerCalls }) of @durable-sdk/testing with given (settings rows, facts already queued, a world your seeder puts where the bodies read it), when (execute, emit, signal, advance, tick, crashAfterStep, crashBeforeFinish, act) and expect (runs with their steps and output, ledger rows by their images, facts by payload, noFacts, provider calls per fake and per step, waits), every expectation read through the harness's readers and a field not named not read; the first failure is one sentence with the run's cause (ScenarioFailed), never a dump, and the answer is the collected rows. Your binding hands the seams once (here scenario of tests/helpers/scenario.ts: the world seeder and the fakes' counts); tests/scenarios/ holds three over real workflows (a hold placed and lifted, a listener reached from its fact, a scan crashed after a step and resumed).

import { execute, scenario } from "@durable-sdk/testing";

await scenario(t, "a hold placed and lifted", { seedWorld })
  .given({ world })
  .when(
    execute(setJobsWorkflow, {
      jobIds: ["job-1"],
      change: "hold",
      reason: "stock",
      requestId: "r1",
    }),
  )
  .when(
    execute(setJobsWorkflow, {
      jobIds: ["job-1"],
      change: "release",
      reason: "",
      requestId: "r2",
    }),
  )
  .expect({
    runs: [{ workflow: "queue.set", status: "COMPLETED", count: 2 }],
    ledger: [{ type: "pickjob", resourceId: "job-1", after: { hold: true } }],
    facts: [
      { name: "pickjob.updated", payload: { jobId: "job-1", change: "hold" } },
    ],
    noFacts: ["pickjob.cancelled"],
  });

2. The store proof (minutes, your Postgres)#

The engine reaches its tables through one store interface, and the store is proved by a conformance suite rather than by the engine's own tests. The verb tier is the kit's (TQ-002): storeConformance(name, makeStores, traits, api) of @durable-sdk/testing/conformance, one case per store verb, over a double's harness (memoryHarness(memoryStores()), postgresHarness({ driver, stores, pins })) and its declared traits (MEMORY_TRAITS, POSTGRES_TRAITS), with your runner's own { describe, it, expect, beforeAll, beforeEach } handed in as the fourth argument (the package imports no runner; a hook left out is refused by name before any case is collected), so jest or node:test hand theirs. The engine-level promises (conformance(name, makeDouble) of tests/conformance/suite.ts: one run per intent, replay after a crash, compensation, the ledger's chain, the facts, the relay, retention, the operator actions) stay the engine's own, since they bind its catalog, reverters and routes. Both run on memoryStores() and on postgresStores() under both namings (tests/conformance/*.test.ts, each runner a few lines). A case that fails on one store and passes on another is a store defect, never a case to bend.

One verb proves any Postgres from the shell:

durable-sdk test store --url <postgres url> [--naming snake|prisma-legacy] [--schema <name>]

It writes a spec and a config of its own under .durable-sdk/ (gitignored) and runs them through your vitest with --config, so your projects and setup files play no part: the SDK versions applied to the latest under the naming, the store conformance over postgresStores() on that database, the ledger's append-only trigger, the catalog's drift verdict and the engine over the store through testDurable() (a run, its ledgered step, its fact delivered on the tick, the ledger verified); the counts and every failed case's title printed, exit 1 on any. --url is required and never read from the environment, and a database whose ledger or runs carry rows is refused before any case: the suite empties the framework tables between cases, so point it at a throwaway database, never a deployment's. The up/down round trip is not the verb's; the migrations and the schema are the CLI's, on any Postgres:

durable-sdk migrate [--baseline[=if-missing|always]] [--url <url>] [--schema <name>] [--naming snake|prisma-legacy]
durable-sdk migrate --dry-run       # applies, reports the catalog checksum, rolls back
durable-sdk migrate status          # ok, pending, drifted, naming_mismatch, a held lock
durable-sdk migrate down --to <n>   # one transaction per version, refused where a down would lose rows (--accept-loss)
durable-sdk verify                  # the app's probe as a command: the version, the stamp, the naming
durable-sdk doctor --strict         # every table, index, trigger and constraint against the definition; fix SQL on a drift

The connection is DATABASE_URL_UNPOOLED, then DATABASE_URL, then --url; the bookkeeping schema is durable and the naming snake by default (the engine's own repository runs under DURABLE_NAMING=prisma-legacy with --baseline=if-missing, since its tables predate the SDK). What CI proves here on a throwaway database (.depot/workflows/ci.yml, the checks job): a fresh database migrated twice (the second a no-op), doctor --strict green, migrate status ok, a dry run with nothing to apply, and the up/down/up round trip landing on the first apply's catalog checksum, under both namings; and the ledger trigger (ledger_append_only) refusing every UPDATE and DELETE on a ledger row (tests/pg/durable-postgres.pg.test.ts, the conformance runners).

3. The tree rules (seconds)#

The doctor reads your tree and answers one finding line per failed rule, exit 1 on any:

durable-sdk doctor --host | --core [--json] [--explain <rule id>]
durable-sdk doctor --definitions [--json] [--api <url>]

A line is error <id> <file:line> <message> → <fix> (<ADR>); --explain <id> answers a rule's law, hazard, drawback, fix and ADR offline, and durable-sdk explain <code|refusal id|signature|runId> the same for an error code, a refusal or a run (ADR-0060 decisions 15, 16 and 18). doctor --definitions judges every registered definition without a database (the key pure, the example storable and re-keying, the schedule's slot in the key, a sentence on every definition, listener and fact); durable-sdk key <workflow> <input.json> says what an input keys to and who owns the key. doctor --host runs two readings over your tree (ADR-0072 D06, TQ-004): the core guard pack of @durable-sdk/testing/guards (the generic rules: the authoring rules over your application root, the definitions' and the identity's verdicts over your loaded registry, the refusals registry, the platform pins; each a suite over your durable.guards.ts descriptor and your runner's own describe/it/expect, its rows in CORE_RULES) and your own guard files under the guard files with their the guard rules' registry. A pack suite runs through your guard file of its stem when you have one (mark it core: true in GUARD_FILES), else through a spec the doctor writes under tests/.durable-sdk/guards/ and removes after the run; doctor --core runs the pack alone, and a tree with a descriptor and no guards of its own gets the pack and no refusal. Write the descriptor beside durable.config.ts: the routes convention and the pin, the heartbeat, the lease and the call window, roots (app, tests, config, guards, rules), modules (the module that exports your bound durable, the catalog, the listeners, the manifest, the primitives barrel and its stubs, the payload fixtures), setup (the modules the spec imports first: your databases' doubles) and authoring (the names your primitives barrel carries beyond ADR-0051's list and the holdouts that stood when each rule landed, each with its reason: read by the spec and by your own guard file alike, one spelling). The rules the pack does not carry (a write outside a step, a key part read off the clock, a client or a secret in an input, the configuration's one factory call) are the engine's own own guard files still.

4. The platform contract (seconds, the network)#

A deployment is proved against the hosted plane, never the other way round. What exists today, each one read:

  • GET /health: { ok, sha, env, time, environment: { name, role, peers } }, no-store.
  • GET /admin/api/health (the bearer ADMIN_TOKEN): schema (state ok when the version, the stamp and the naming agree; behind, drifted, naming_mismatch and ahead otherwise, the remedies in runbook "The app refuses every run") and instance (the row names this environment).
  • GET /admin/api/environments: every member of the mesh, its role, its last ping, the sequence and the lag per direction; durable-sdk peer ping <name> --api <url> proves one round trip and durable-sdk env doctor --api <url> the members file against the deployment.
  • Every answer carries X-Durable-Api: <major>.<minor>; the console shows one banner behind an older major.
  • durable-sdk doctor --definitions --api <url>: the deployed definitions' verdict, and since FW-052 a step whose observed p95 is over the need it starts with (time for the numbers: a step is started with the plan's maximum less the reserve at most, and the page is where every limit is spelled).

durable-sdk platform check --api <url> [--peer <name>] [--wait <duration>] [--json] [--strict] (TQ-006) folds these into one verdict table with an exit code: seven rows, health (the public /health), api (the deployment's major against the CLI's: behind a fail, ahead a warn), schema and instance (the probe's states: behind, missing, drifted and naming_mismatch a fail, unverified and ahead a warn; a row naming another environment a fail), ledger (verify: the chain walked and the append-only trigger present), limits (the time contract) and relay (the members listed, a warn on facts unsent past the expiring window; with --peer a ping that must be answered inside --wait, 30 s unless said), each ok | warn | fail with its detail, every HTTP failure a row's value and never a stack, exit 1 on any fail and on a warn under --strict, --json for a job to read; the bearer is ADMIN_TOKEN from the environment alone, blanked from every line. It is what a deploy job runs once the deployment serves the commit, and what the engine's own verify-dev-release and verify-prod-schema jobs run (TQ-005b). A preview deployment registers with the mesh as an ephemeral member (ADR-0053 decision 2) and is checked at its own URL; a sandbox tenant of the hosted plane is a feature of the plane, not of the verb.

The tiers#

Three tiers (TQ-005a), the first two verbs of the CLI over your own tools, never a copy of them:

  • Seconds: durable-sdk test --changed [--base <ref>] (pnpm quick here; pnpm t is pnpm's own alias of pnpm test) runs your vitest with --changed <base> on the unit project (vitest's own import graph: the files the change reaches from the merge base against origin/develop or --base, the index and the working tree), then the guard files a changed path can break by a table the verb prints before it runs anything (GUARDS_BY_PATH: the application, the packages or the configuration → the definitions', the identity's, the manifest's, the key parts', the step bodies', the contexts', the refusals', the log catalog's and the events' guards; docs/** → the docs parity; a changed guard file itself; vercel.json or a route → the platform pins); no database, the exit code vitest's.
  • Minutes: durable-sdk test --pr [--base <ref>] [--keep-going] (pnpm pr) runs the proving set in order, your typecheck script, eslint over the changed files (your lint script's flags kept), the unit, slow and postgres projects (the last when DATABASE_URL is set, one line otherwise), doctor --host and every gen:* --check your check script lists, then a verdict table with durations; exit 1 at the first failing step unless --keep-going. The three project names are the convention (tests/projects.ts here); a host without them sees vitest's own refusal.
  • The default branch: the full run as your CI spells it; here ADR-0071's matrix (pnpm test:leg --project <p> --shard=<i>/<n>), the soaks and the bench on develop's push.

A flaky test is quarantined by name in tests/quarantine.json ({ file, test, reason, expires, issue }), judged by quarantineHook({ beforeEach }) of @durable-sdk/testing/quarantine, one line in your setup file (tests/setup.ts here): a listed test is skipped with quarantined until <expires>: <reason> (<issue>), counted as skipped and never run, and a row past its expires (or a malformed one) fails every file at startup with one sentence naming it. A quarantine is a loan with a date and an issue, never a retry.

Why no retries#

A retry hides a race. The first layer is deterministic by construction: the clock is the harness's and advance the only way time moves, the engine reads every moment off the bound clock, the fakes answer what they were planted. So a test that fails one run in ten is a defect, not weather: a race the engine or the body has, a leak between files (a registration left on the process-global slot, a fake left installed), a real timer inside a step. The kit retries nothing at any tier; such a test gets a quarantine row with an issue and an expiry, and the fix lands under the issue. The store suite's concurrency tier is the one place two writers race on purpose, and there the race is forced through a seam (holdNextTransaction) and never left to timing.

Running it in GitHub Actions#

One uses: per tier (TQ-005b, ADR-0072 D09): the composite action durable-sdk/test-action@v1 (.github/actions/durable-test in this repository, published beside the packages when the pause lifts) installs from the lockfile, runs what the tree needs built first (prepare), fetches the base branch when the ref does not resolve, registers a problem matcher so every finding line of the host doctor (error <id> <file:line> <message> → <fix> (<ADR>)) becomes an annotation at its file and line with the fix in its text, runs the tier through durable-sdk test --changed or test --pr (or test store --url for the store proof, TQ-002's verb) with --summary $GITHUB_STEP_SUMMARY, so the job's summary carries the verdict table, and keeps the vitest report blobs as an artifact when the run wrote any. Its inputs: tier (changed, pr or store), base (origin/develop unless said; on a pull request origin/${{ github.base_ref }}), database-url (required for store, what runs the postgres project under pr), working-directory, install ("false" for a second tier in the same job), node-version-file, prepare and summary; the action's README has each with its default.

durable-sdk ci init writes the workflow for a repository with none, .github/workflows/durable.yml, and holds it current:

name: durable
on:
  pull_request:
  push:
    branches: [main]

jobs:
  quick:
    name: The quick tier (durable-sdk test --changed)
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v7
        with:
          # vitest's --changed diffs from the merge base with the base
          # branch, which a shallow checkout does not hold.
          fetch-depth: 0
      - uses: durable-sdk/test-action@v1
        with:
          tier: changed
          base: origin/${{ github.base_ref }}

  prove:
    name: The proving tier and the store proof
    runs-on: ubuntu-latest
    timeout-minutes: 30
    services:
      postgres:
        image: public.ecr.aws/docker/library/postgres:18
        env:
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: app_ci
        ports:
          - 5432:5432
        options: >-
          --health-cmd "pg_isready -U postgres"
          --health-interval 5s
          --health-timeout 5s
          --health-retries 10
    env:
      DATABASE_URL: postgresql://postgres:postgres@localhost:5432/app_ci
    steps:
      - uses: actions/checkout@v7
        with:
          fetch-depth: 0
      - uses: durable-sdk/test-action@v1
        with:
          tier: pr
          base: origin/${{ github.base_ref || github.event.repository.default_branch }}
          database-url: ${{ env.DATABASE_URL }}
      - uses: durable-sdk/test-action@v1
        with:
          tier: store
          install: "false"
          database-url: ${{ env.DATABASE_URL }}

durable-sdk ci init [--provider github] [--branch <name>] [--action <uses>] [--check] [--force] is idempotent: a file equal to the rendering is left and said unchanged, one that differs is refused by name unless --force writes it again, and --check writes nothing and exits 1 when the file is missing or differs (a step of your CI, beside your other generated files). The action is the published name unless the tree carries its own copy (.github/actions/durable-test/action.yml, this repository) or --action says; the push job's branch is main unless --branch says. The Postgres image is Docker's official postgres:18 read from AWS's public mirror of the Docker Hub library (the same image, no account), since Docker Hub's anonymous pull limit refuses GitHub's shared runners at times; that mirror rations anonymous pulls too (it refused two of the engine's own runs on 2026-10-12), so this repository's own workflows read a mirror of their own under the job's GITHUB_TOKEN since CI-003 (ghcr.io/<org>/<repo>/postgres:18, refreshed weekly by .github/workflows/mirror-postgres.yml; docs/runbook.md "CI's Postgres image: the repository's own mirror"), a private package another repository cannot pull: a host whose runs meet toomanyrequests mirrors the image the same way and edits the rendered image:.

A Postgres-backed test file skips without a database and refuses to skip in CI (the engine's own isLocalPostgres and assertPgInCi of tests/helpers/pg-suite.ts: a renamed variable is red, never a green run with zero Postgres cases); keep that rule in your runners. The workflow above is two jobs; the engine's own own matrix (the shards, the gate that skips a tree already proven, the release gates) is ADR-0071's and stays its own, and dogfoods the action in ci.yml's durable-quick job on every pull request (docs/runbook.md "The tiers in GitHub Actions"). The deploy job's last step, a deployment proved against the hosted plane, is durable-sdk platform check --api <url> (TQ-006), what verify-dev-release and verify-prod-schema run here. Landing a pull request from a laptop, the whole chain (the checks, the squash, develop's CI, the beta gates, the promotion, master's CI and the prod gates) is pnpm pr:land <pr> (docs/runbook.md "Landing a PR"; --dry-run prints the steps, --no-promote stops after the beta gates).

Recording a provider#

A fake is a claim about a provider; a cassette holds it to the wire (ADR-0072 D08; TQ-007, landed 2026-10-11). A provider call is made once by a person with the credentials through recordingFetch of @durable-sdk/testing, a fetch over the real one that keeps each exchange as shapes, never values: an object's keys each mapped to its shape, an array as its first element's, a scalar as its type, and the one value that survives is an enum word under a key the recording's allowlist names (keep), as { "$literal": "pending" }; the path's ids go through templates (/v2/shipments/{id}), the query's values are shapes, and no header is read. So a cassette carries no customer value and no credential by construction, cassetteClean refuses one a hand edited (a literal outside the allowlist, an e-mail-shaped literal, a literal under an address-looking key, an id-looking path segment), and the file carries the date it was read and the provider's API version where the caller named one.

import {
  recordingFetch,
  replayFetch,
  checkFake,
  loadCassette,
  withFetch,
} from "@durable-sdk/testing";

// Record (once, by a person with the key; reads alone):
const recording = recordingFetch(globalThis.fetch, {
  provider: "shipstation",
  name: "shipment.get",
  keep: ["shipment_status", "confirmation", "unit", "currency"],
  paths: ["/v2/shipments/{id}"],
});
globalThis.fetch = recording;
await getShipmentDetail(account, id); // your client, its own fetch
recording.save("tests/cassettes/shipstation");

// Check (every run): the fake against the recording, through your client's own reading.
const cassette = loadCassette("tests/cassettes/shipstation/shipment.get.json");
const findings = await checkFake(cassette, {
  "GET /v2/shipments/{id}": {
    fake: async () => ({
      status: 200,
      body: await fake.getShipmentDetail("se-1"),
    }),
    read: (_body, replay) =>
      withFetch(replay, () => getShipmentDetail(account, "se-1")),
  },
});
expect(findings).toEqual([]);
// "GET /v2/shipments/{id}: the fake answers `money` as null; the provider answered an object on 2026-10-11"

replayFetch(cassette) answers a request from the matching exchange with the recorded shape filled per type (a number 1, a boolean true, a string its own key's name, a date-named key an ISO moment, an enum word itself), so a client runs without the network; checkFake runs every recorded exchange through the host's handler (the fake's answer, and through read the client's own reduction of the recording, so a fake that answers the connector's shape is held to the wire through the one module that knows it) and answers sentences: a key the fake answers not, a key the provider did not (a fake that answers more than the provider is a claim nobody proved), a type that differs (null against a value among them), a status that differs, an exchange no handler checks. Never a throw on a finding.

In the engine's own repository: the cassettes under tests/cassettes/shipstation/, recorded by tests/cassettes/shipstation.record.test.ts under RECORD=1 (the command is on the facts sheet), the check tests/cassettes/shipstation.check.test.ts, the host's allowlist and templates in tests/helpers/cassettes.ts, the guard the cassettes guard (cassettes/corpus-clean: every file a clean cassette under the host's allowlist; cassettes/fakes-checked: every cassette named by the check test), and the provider facts sheet shipstation: every fact a recording cannot prove (a write's behaviour) written with its date, and what the first check found the fake lying about. A second provider's cassettes are next (the recorder takes any fetch); a cassette past its date as a warning is not taken yet.

The local loop#

One command on a fresh clone, on a laptop with Docker or in a devcontainer (GitHub Codespaces, VS Code's Dev Containers, Claude Code on the web):

pnpm setup:local

It writes .env from .env.example when none exists (the database URLs at the compose Postgres, a minted cron secret and operator token; an existing .env is never overwritten), starts the compose Postgres (docker-compose.yml: CI's postgres:18 image, the app's and the warehouse datasource's databases, a named volume, a healthcheck) when nothing answers on the loopback port, installs from the lockfile, generates the Prisma clients, builds the SDK, applies the migrations and the framework's baseline (durable-sdk migrate --baseline=if-missing) and ends on durable-sdk verify: one line per step with its duration, a failure naming the step, the remedy and the runbook heading, and a second run doing nothing but verify (TQ-008, landed 2026-10-11; runbook "Local setup in one command" has every step, the 5433 override and what it does not do). Then the runner (pnpm exec vitest run --project unit for the quick loop, pnpm test for the three projects, the postgres one against that database with nothing exported), and durable-sdk dev for a running app with a ticking engine (pnpm build && pnpm start). The devcontainer (.devcontainer/) is the same compose Postgres as a sibling service on the container's own network and pnpm setup:local as its postCreateCommand, so a codespace opens migrated, baselined and verified. For a tree of your own the shape is the same three files: a compose Postgres, a setup script over your migrations, durable-sdk migrate and verify, and a devcontainer that runs it; durable-sdk ci init (TQ-005b) writes the workflow, not these.

Where the pieces are#

  • @durable-sdk/testing: memoryStores(), testDurable(), seed, replayRun, the fake adapters, prove, the scenario DSL, the quarantine, the cassettes, the store conformance under ./conformance and the core guard pack under ./guards.
  • Adding a workflow "Testing it": the harness as the engine's own repository binds it, the crash seams, the replay pair.
  • runbook "Testing": the three projects, the shards, the soaks, the doubles, a laptop's Postgres, the three tiers, the quarantine and the store conformance against a database.
  • shipstation: the provider facts sheet, the recording command and what the cassettes hold the fake carrier to (TQ-007).
  • 0072-the-testing-kit-as-a-product: the decisions and the units.