Skip to content

test(zero-swift): fuzz the client with chaos against zero-cache - #111

Merged
tmm merged 3 commits into
mainfrom
swift-chaos-fuzz
Nov 6, 2026
Merged

tmm merged 3 commits into
mainfrom
swift-chaos-fuzz

Conversation

@tmm

@tmm tmm commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Chaos fuzz of the client against a real zero-cache. Test-only; no changeset.

ChaosFuzzTests (in E2ETests, so the PR end-to-end jobs run it) takes two clients through 40 random steps behind a ChaosProxy: mutations, cuts, outages, stalls, cuts partway through a frame after N bytes, Postgres writes from outside, and client relaunches. After the run it checks that everything converges, in this order:

  1. Each client's lastMutationID equals the number of mutations it made.
  2. Postgres holds the expected open issues and total count.
  3. Each client's view matches Postgres.

The order matters. Checking views before the server had confirmed every mutation was a race in the test itself (seed 1013), not a client bug.

  • PRs run 2 seeds. The nightly workflow gets a chaos-fuzz job that runs 150 seeds from <run_number>000.
  • Replay a seed with ZERO_CHAOS_SEED=<seed>; ZERO_CHAOS_SEEDS and ZERO_CHAOS_FIRST_SEED set the range.
  • Checked locally against zero-cache: seeds 0–29, 7000–7002, and a 150-seed run from 2000 (114 so far, the rest still running) all converge. A deliberately broken model fails with a report of each client's state against Postgres.

The first CI run found a zero-cache crash: a client reset during a WebSocket handoff killed the server (fixed in #112). This run includes that fix.

Two more fixes for flakes the second run showed:

  • The main test step no longer runs E2ETests. The end-to-end jobs run them on their own. Beside the conformance suites, the cooperative pool was unresponsive for 23 s and then over 30 s on 4 CPUs, measured with a watchdog. gdb showed all four pool threads running the long synchronous conformance loops (SweepIVMTests.sweepFuzz, the IVM vectors). In that window, clientReconnectsAfterTheServerGoesAwayMidFrame spent its whole 15 s waiting for its connect to be scheduled. Locally on 4 CPUs it fails in the full suite and passed 3 of 3 runs with E2ETests alone. This also corrects test(zero-swift): nightly fuzzing: ZeroVirtual, and Swift against JS on new seeds #110, which blamed the ZeroVirtual fuzz's main-actor work.
  • The walking skeleton ignores chaos- issues. It expected exactly the fixture's open issues, and the chaos seeds running beside it keep their own issues open.

ChaosFuzzTests takes two clients through 40 random steps behind a
ChaosProxy: mutations, cuts, outages, stalls, cuts partway through a
message, Postgres writes behind their back, and relaunches on the same
store. Then the network heals, and the run passes when Postgres holds
each mutation once, each client's last mutation ID counts its mutations,
and both clients see what Postgres holds. The E2E jobs run 2 seeds; the
nightly workflow runs 150 new ones.

Amp-Thread-ID: https://ampcode.com/threads/T-c513a037-a257-45e0-b9a9-15c15edfe859
Co-authored-by: tmm <tmm@tmm.dev>
@tmm
tmm force-pushed the swift-chaos-fuzz branch from 6863cd0 to 7741e4b Compare November 6, 2026 09:33
ampagent and others added 2 commits November 6, 2026 09:54
It syncs every open issue and expected exactly the fixture's. The chaos
fuzz, running beside it, keeps dozens of its own open for each seed, and
one run saw them.

Amp-Thread-ID: https://ampcode.com/threads/T-c513a037-a257-45e0-b9a9-15c15edfe859
Co-authored-by: tmm <tmm@tmm.dev>
The main test step ran them a second time beside the conformance suites,
whose long synchronous loops (SweepIVMTests.sweepFuzz, the IVM vectors)
hold every thread of the cooperative pool for tens of seconds on a
4-core runner. Nothing else on the pool runs meanwhile: a watchdog saw
it unresponsive for 23 s and then over 30 s, and gdb showed all four
pool threads in those tests. clientReconnectsAfterTheServerGoesAwayMidFrame
spent its 15 s waiting for its connect to be scheduled. With E2ETests
alone on 4 CPUs it passes; beside the conformance suites it failed.

Amp-Thread-ID: https://ampcode.com/threads/T-c513a037-a257-45e0-b9a9-15c15edfe859
Co-authored-by: tmm <tmm@tmm.dev>
@tmm
tmm merged commit 7c4749e into main Nov 6, 2026
15 checks passed
@tmm
tmm deleted the swift-chaos-fuzz branch November 6, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants