Skip to main content
Version: Current

runStoreDifferentialTck

@rotorsoft/act-root


@rotorsoft/act-root / act-tck/src / runStoreDifferentialTck

Function: runStoreDifferentialTck()

runStoreDifferentialTck(options): void

Defined in: libs/act-tck/src/store-differential-tck.ts:656

Cross-adapter differential contract (#1030, fuzz workloads #1057, lease/truncate/pii/query fuzz #1200).

Adapters can drift in ways per-adapter cases don't catch โ€” event ordering, the with_snaps snapshot floor, the exact shape of query_stats / query_streams output, the lease lifecycle's effect on a stream's retry/blocked/error, windowed-truncate boundaries, forget_pii erasure, and query-option edge cases. This harness drives a family of randomized, seeded workloads โ€” commits (some PII-bearing), inline + windowed truncates, subscriptions, and the full lease lifecycle (claim / ack / defer / block / unblock / reset / prioritize) โ€” against every store in options.stores, then asserts their normalized outputs are byte-for-byte identical for every workload.

Each workload is its own seeded plan (seed, seed + 1, โ€ฆ): the operation sequence โ€” and even its length โ€” varies by seed, so divergence is hunted across a slice of the input space rather than one fixed script. The seeds are deterministic, so a failing workload is always replayable.

Normalization drops only the fields that legitimately differ between stores (absolute event ids, created timestamps, correlation/causation uuids, lease holder UUIDs, and wall-clock lease expiries) and keeps everything that defines correctness (stream, version, name, data, emission order, and the durable subscription state a lease op leaves behind: watermark, retry, blocked, error, priority, lane). Stream names carry mixed case so a case-insensitive pattern filter (#1197) surfaces as a diff.

Wire it with the in-memory store as the reference and one or more durable adapters as comparands:

Parametersโ€‹

optionsโ€‹

StoreDifferentialTckOptions

Returnsโ€‹

void

Exampleโ€‹

import { runStoreDifferentialTck } from "@rotorsoft/act-tck";
import { InMemoryStore } from "@rotorsoft/act";
import { PostgresStore } from "../src/index.js";

runStoreDifferentialTck({
name: "InMemory vs Postgres",
runs: 6, // durable adapter: fewer workloads keep the suite fast
stores: [
{ name: "InMemoryStore", factory: () => new InMemoryStore() },
{ name: "PostgresStore", factory: () => new PostgresStore({ ... }) },
],
});