{"slug": "testing-distributed-systems-with-ai-agents", "title": "Testing distributed systems with AI agents", "summary": "Methodology for testing distributed and stateful systems using AI coding agents that execute two specialized skills: one to design a claim-driven test plan and another to execute it. The approach produces structured Markdown artifacts—a test plan and a findings report with 9-state verdicts and explicit blame classification—allowing a human reviewer to decide whether to ship without re-running any tests. The workflow enforces principles such as starting from product claims rather than test cases, requiring coverage adequacy arguments, and combining fault injection with abstract models and consistency checkers for rigorous validation.", "body_md": "**Two skills for AI coding agents that design and run claim-driven\ntests for distributed and stateful systems.** Together they produce a\nstructured Markdown test plan and a findings report with 10-state\nverdicts and an explicit SUT / harness / checker / environment blame\nclassification. A reviewer reads the two artifacts and decides\nwhether to ship; nothing else has to be re-run.\n\nWorks with Claude Code, Codex, Copilot CLI, Cursor, Gemini, or any agent that reads Markdown and runs shell. The skills are plain SKILL.md files. The agent executes them; the plan and findings report are the output.\n\nOne skill designs the plan. The other runs it. A plan starts from\nthe product's claims, generates hypotheses tied to those claims, and\nwrites scenarios named after the claim each tries to falsify. For\nconsistency-critical scenarios, each scenario also binds an abstract\nmodel (`register | queue | log | lock | lease | ledger | …`\n\n) to an\noperation-history schema, a named checker, and a nemesis with\nobservable landing evidence. The plan ends with a coverage adequacy\nargument and a conservative confidence statement.\n\nThe default for testing distributed and stateful systems — write a few integration tests and call it done — finds a small fraction of the bugs that actually break these systems in production: partial network partitions, non-deterministic concurrency, crash-recovery, upgrade/rollback, idempotency under replay, timing-sensitive ordering.\n\nThese skills enforce an opinionated workflow that pulls from the field's hard-won knowledge:\n\n**Claim-driven, not test-driven.** Start from what the product promises. Every scenario falsifies one claim under one fault. A test named after its claim is harder to weaken than one named after its setup.**Coverage adequacy is a deliverable.** The plan ends with an argument that the chosen scenarios are*enough*to ship, plus an honest list of what stays unverified.**Reuse the SUT's own toolbox.** The execute skill discovers existing tests, runbooks, and fault-injection scaffolding before inventing anything new.**Model + history + checker, not just chaos.** For safety, durability, idempotency, isolation, ordering, or membership claims, every scenario declares an abstract model, an operation-history schema, a named checker (linearizability, serializability, session-consistency, no-lost-ack, exactly-once, …), and how it treats ambiguous outcomes (timeouts, unknown commits, retries). Chaos plus a model and a checker, not chaos alone.**No silent passes.** Every PASS cites oracle execution evidence*and*the signal proving the fault actually fired. Verdicts come from a 10-state set, so \"the chaos script ran cleanly\" can't be read as \"the claim survived the fault.\" Every FAIL carries a SUT / harness / checker / environment blame tag so reproducers reach the right queue.\n\nEnd-to-end, the two skills produce:\n\n```\ntesting-plans/<slug>.md             ← plan with §0–§9 (see below)\ntest-sessions/<UTC>/\n  ├── session-log.md                 ← timeline + toolbox + env probe\n  ├── logs/                          ← per-scenario stdout/stderr\n  ├── metrics/                       ← metric snapshots\n  ├── artifacts/                     ← ephemeral harnesses, dumps\n  └── findings/\n      ├── <scenario>.md              ← per-scenario verdict (written as run proceeds)\n      └── report.md                  ← summary + adequacy + confidence delta\n```\n\nThe plan structure (a reviewer can read this and decide whether to ship without re-running the tests):\n\n```\n0. Architectural summary       — system as it actually exists\n1. Scope\n1b. Claims under test          — the spine\n1c. Missing claims discovered  — docs ↔ code drift\n2. SUT model\n3. Existing test inventory     — what's already covered\n4. Failure-mode hypotheses     — tied to claim IDs\n5. Coverage matrix             — claim × hypothesis\n6. Technique selection         — from the catalog\n6b. Environment requirements\n7. Scenarios                   — each named after the claim, with\n                                  Target test file + Skeleton\n   7.M Model / history /       — mandatory when the scenario falsifies\n       checker discipline        a claim in {safety, durability,\n                                  idempotency, isolation, ordering,\n                                  membership}: model under test,\n                                  operation-history schema, named\n                                  checker, nemesis + landing evidence,\n                                  ambiguous-outcome handling, reduction\n                                  plan (SUT/harness/checker/env blame)\n7b. Coverage adequacy argument — why these tests are enough\n7c. Residual uncertainty       — what stays unverified, and why ok\n7d. Confidence statement       — the reviewer's verdict\n8. What this plan does NOT cover\n9. Open questions / followups\n### Scenario S3: linearizable_append_under_partition\n- Falsifies if it FAILs: C1 (every acknowledged append is durable\n  and linearisable), C5 (leader election completes within 5s)\n- Workload: 8 clients, 70% append / 30% read, 5min, key-skew zipf\n- Faults: asymmetric partition isolating current leader at T+60s\n  for 30s\n- Oracle: linearizability via Porcupine over per-key histories\n\n§7.M (model / history / checker discipline)\n- Model under test:    log\n- Operation history:   default 11-field schema (op id, process id,\n                       invoke/complete ts, op type, key, input,\n                       output, error, timeout marker, node seen,\n                       fault epoch). Recorded in-process + server-\n                       side audit.\n- Checker:             linearizability (Porcupine) per-key, then\n                       no-lost-ack against final state\n- Nemesis + landing:   asymmetric-partition (iptables drop one\n                       direction). Landing evidence = iptables drop\n                       counter goes 0 → 14,712 over the 30s window\n                       AND raft log emits \"leader-lost; starting\n                       election\" within 2s of injection.\n- Ambiguous outcomes:  timeouts → timeout_marker=true, complete_ts\n                       =null, treated as could-have-succeeded;\n                       retries are separate ops sharing input\n- Reduction plan:      if FAIL, bisect fault window + fix seed, then\n                       classify SUT / harness / checker / environment\n                       per references/test-case-reduction.md\n```\n\n| ID | Verdict | Nemesis landing evidence | Reduction class |\n|---|---|---|---|\n| S3 | `PASS-hardening` |\niptables ctr 0→14,712; raft re-election at T+1.8s | n/a |\n| S4 | `FAIL-reproducible` |\npartition landed; Elle: G2-item anomaly on key K17 | SUT |\n| S7 | `INCONCLUSIVE-fault-not-proven` |\niptables rule installed but counter stayed 0 — wrong chain | harness |\n| S9 | `PARTIAL-model` |\nlanding ok; checker covered per-key, not cross-key | n/a |\n\n(The full findings template carries Oracle, Oracle execution evidence,\nartifact links, an adequacy-vs-plan section, and a confidence delta —\nsee `skills/executing-distributed-system-tests/assets/findings-report-template.md`\n\n.)\n\nPaste this at any AI coding agent (Claude Code, Codex, Copilot CLI, Cursor, Gemini, or anything else that reads Markdown and runs shell):\n\n```\nRead https://raw.githubusercontent.com/shenli/distributed-system-testing/main/INSTALL.md\nand follow the instructions to install and configure\ndistributed-testing-skills for this agent.\n```\n\nThe agent fetches [ INSTALL.md](/shenli/distributed-system-testing/blob/main/INSTALL.md), clones the repo to\n\n`~/.local/share/distributed-testing-skills/`\n\n, and wires the skills in\n(symlinks under `~/.claude/skills/`\n\nfor Claude Code, a pointer block\nin `~/AGENTS.md`\n\nfor other agents).After that, ask any agent on the machine to \"design a test plan for this system\" or \"execute the plan at X\" and it'll follow the SKILL.md workflow.\n\n**Paste the same one-liner again.** `INSTALL.md`\n\nis idempotent:\nif the install path exists, it does `git pull --ff-only`\n\n; if not,\nit does `git clone`\n\n. Symlinks always point at the cloned content\nso they pick up the new version automatically. The `~/AGENTS.md`\n\npointer block uses HTML markers and is replaced cleanly on each\nrun — no duplication.\n\nIf you have local edits to the cloned skills, `git pull --ff-only`\n\nwill fail; the agent will stop and ask before discarding them.\n\n```\ngit clone https://github.com/shenli/distributed-system-testing.git \\\n    ~/.local/share/distributed-testing-skills\n\n# Claude Code: symlink under ~/.claude/skills/\nmkdir -p ~/.claude/skills\nln -snf ~/.local/share/distributed-testing-skills/skills/designing-distributed-system-tests \\\n    ~/.claude/skills/designing-distributed-system-tests\nln -snf ~/.local/share/distributed-testing-skills/skills/executing-distributed-system-tests \\\n    ~/.claude/skills/executing-distributed-system-tests\n\n# Codex / Copilot CLI / Cursor / Gemini / others: see INSTALL.md\n```\n\nOnce the skills are installed, you have two ways to drive them:\n\n**Casual ask (Claude Code with auto-trigger):**\n\n```\nDesign a project-wide test plan for this codebase.\nExecute the plan at ./testing-plans/<slug>.md against this codebase.\n```\n\nThe skill descriptions pick up natural phrasing like \"design a test plan\", \"execute the plan\", \"run stability tests\", \"design a release validation plan\", etc.\n\nFor a specific mode, output path, or a non-auto-trigger agent,\n[ USAGE.md](/shenli/distributed-system-testing/blob/main/USAGE.md) has copy/paste prompts for every workflow\n(design and execute, in their respective modes) plus tips on scope,\nenv probing, and long-run checkpointing.\n\nWalks the repo, extracts the claims the product makes, generates\nhypotheses tied to those claims, picks techniques from the catalog,\nand writes a structured Markdown plan with a coverage adequacy\nargument and a confidence statement. For consistency-critical\nscenarios, the plan fills a §7.M block per scenario: model under\ntest, operation-history schema, named checker, nemesis + landing\nevidence, ambiguous-outcome handling, reduction plan. Details:\n[ history-discipline.md](/shenli/distributed-system-testing/blob/main/skills/designing-distributed-system-tests/references/history-discipline.md).\n\nTwo modes: **change-scoped** (a specific commit or PR) and\n**project-wide** (a holistic plan with existing-test inventory and\ngap analysis).\n\nReads the plan, discovers the SUT's toolbox, probes the environment,\nand runs scenarios with checkpoint discipline. Per scenario: captures\nlanding evidence for the fault, runs the green-but-broken and\nweak-oracle audits, assigns a verdict from the 10-state taxonomy in\n[ verdict-taxonomy.md](/shenli/distributed-system-testing/blob/main/skills/executing-distributed-system-tests/references/verdict-taxonomy.md),\nand classifies every FAIL into SUT / harness / checker / environment\nbefore filing. Produces a findings report with adequacy-vs-plan\nassessment and confidence delta.\n\nTwo modes: **default** (read-only on the SUT, ephemeral harnesses\nunder the session dir) and **author mode** (writes scenario skeletons\ndeclared in the plan's §7 into the SUT for review).\n\nEight reference files distilled from the field's literature:\n\n| File | When to reach for it |\n|---|---|\n`catalog-index.md` |\n\n`jepsen-and-elle.md`\n\n`deterministic-simulation.md`\n\n`chaos-and-fault-injection.md`\n\n`fuzzing.md`\n\n`formal-methods-tla.md`\n\n`property-and-metamorphic.md`\n\n`performance-and-benchmarking.md`\n\n`crash-recovery-and-upgrade.md`\n\nEach follows the same shape: when to reach for it, what it detects well, what it misses, concrete tools, papers, cost signal, plan checklist. The catalog index pairs symptoms to references.\n\n```\n.\n├── plugin.json                                 ← optional plugin manifest\n├── README.md                                   ← this file\n├── INSTALL.md                                  ← idempotent install / update (paste-this)\n├── USAGE.md                                    ← copy/paste prompts for every workflow\n├── LICENSE\n├── skills/\n│   ├── designing-distributed-system-tests/\n│   │   ├── SKILL.md                            ← the design workflow\n│   │   ├── assets/plan-template.md             ← §0–§9 incl. gated §7.M\n│   │   └── references/                         ← 8-file technique catalog + index,\n│   │                                             common-distributed-systems-pitfalls,\n│   │                                             history-discipline,\n│   │                                             boundary-and-isolation-testing\n│   └── executing-distributed-system-tests/\n│       ├── SKILL.md                            ← the execute workflow\n│       ├── assets/\n│       │   ├── session-log-template.md\n│       │   └── findings-report-template.md     ← 10-state verdicts + landing evidence\n│       └── references/                         ← oracle-patterns (checker picker + 14\n│                                                 patterns), fault-injection-howto\n│                                                 (22-row nemesis taxonomy),\n│                                                 test-case-reduction (with blame\n│                                                 classification), green-but-broken-\n│                                                 red-flags (incl. weak-oracle audit),\n│                                                 finding-classification (TaxDC),\n│                                                 verdict-taxonomy (10-state)\n├── evals/                                      ← eval suites for both skills\n├── verification/                               ← real runs against AgentDB (concrete output)\n└── specs/                                      ← original design spec\n```\n\nEarly but exercised. Both skills have been driven against AgentDB (a distributed agent runtime in Rust) end-to-end multiple times, surfacing six findings (one P0-candidate now closed, two P1s shipped as a PR, two open). The skill bodies evolve as harness experience accumulates; expect minor updates to the SKILL.mds and templates over the next few iterations.\n\nReal plan outputs, session directories, and findings reports from\nthose runs live under [ verification/](/shenli/distributed-system-testing/blob/main/verification), one\nsubdirectory per run, each with a\n\n`README.md`\n\ndescribing what\npassed, what failed, and what the skill surfaced about itself in\nthe process. Notable runs:— change-scoped plan + execution for AgentDB commit`verification/agentdb-fab7d9d/`\n\n`fab7d9d`\n\n(durable idempotent append replay); 670-line plan with 16 hypotheses across all eight failure-mode categories.— consistency + crash-recovery run with linearizability checking.`verification/agentdb-jepsen/`\n\nand`verification/agentdb-projectwide-lidev/`\n\n`-v2`\n\n— project-wide plans with full coverage matrix + adequacy argument + confidence statement.\n\nThere is also an eval suite under [ evals/](/shenli/distributed-system-testing/blob/main/evals) (separate\n\n`evals.json`\n\nfor the design and execute skills) — used to validate\nbehavioural changes to the SKILL.md bodies between iterations.The technique catalog is distilled from Andrey Satarin's comprehensive\n[testing-distributed-systems](https://github.com/asatarin/testing-distributed-systems)\ncatalog. Seminal papers anchoring the catalog include:\n\n- Yuan et al., \"Simple Testing Can Prevent Most Critical Failures\" (OSDI'14)\n- Gunawi et al., \"What Bugs Live in the Cloud?\" (SoCC'14)\n- Zheng et al., \"Torturing Databases for Fun and Profit\" (OSDI'14)\n- Kingsbury & Alvaro, \"Elle: Inferring Isolation Anomalies from Experimental Observations\" (VLDB'20)\n- Alfatafta et al., \"Toward a Generic Fault Tolerance Technique for Partial Network Partitioning\" (OSDI'20)\n- Lou et al., \"Understanding, Detecting and Localizing Partial Failures in Large System Software\" (NSDI'20)\n- Gao et al., \"An Empirical Study on Crash Recovery Bugs in Large-Scale Distributed Systems\" (FSE'18)\n- Zhang et al., \"Understanding and Detecting Software Upgrade Failures in Distributed Systems\" (SOSP'21)\n- Bornholt et al., \"Using Lightweight Formal Methods to Validate a Key-Value Storage Node in Amazon S3\" (SOSP'21)\n- Newcombe et al., \"How Amazon Web Services Uses Formal Methods\" (CACM'15)\n\nMIT.", "url": "https://wpnews.pro/news/testing-distributed-systems-with-ai-agents", "canonical_source": "https://github.com/shenli/distributed-system-testing", "published_at": "2026-05-20 14:40:42+00:00", "updated_at": "2026-05-20 15:07:35.487821+00:00", "lang": "en", "topics": ["artificial-intelligence", "developer-tools", "large-language-models", "cloud-computing", "research"], "entities": ["Claude Code", "Codex", "Copilot CLI", "Cursor", "Gemini"], "alternates": {"html": "https://wpnews.pro/news/testing-distributed-systems-with-ai-agents", "markdown": "https://wpnews.pro/news/testing-distributed-systems-with-ai-agents.md", "text": "https://wpnews.pro/news/testing-distributed-systems-with-ai-agents.txt", "jsonld": "https://wpnews.pro/news/testing-distributed-systems-with-ai-agents.jsonld"}}