Chaos Engineering

API Chaos Testing and Chaos Engineering for Backends

Chaos engineering for APIs is not random traffic. It is a deliberate catalog of failures — hung sockets, 503s from an upstream, JSON that will not parse — applied so you can see whether each route fails safely. PatchFlow automates that catalog with 18 deterministic failure modes and a reliability score.

18 deterministic modes

Network, dependency HTTP statuses, corrupt or empty payloads, and database faults — each with a stable id such as http_503 or db_timeout.

Reliability score 0–100

AnalystAgent weights unhandled exceptions, leakage, and latency-style degradation into a posture score you can track across scans.

Same pipeline as production

Findings can flow into FixAgent and a compiler-checked draft PR, the reactive engine used when the SDK sees a real crash.

Why API chaos testing exists

Unit tests mock the database as healthy. Integration tests often use a best-case network. The bugs that page you are the other cases: DNS for a billing service fails, Redis is slow, a partner API returns an HTML error page with a 200. PatchFlow treats those as first-class tests — Engine 1 in the dual-engine design — so you inject them before customers do.

The 18 chaos failure modes

Every selected endpoint is exercised against the same library. Modes are grouped the way the injector is implemented:

Network

  • http_timeout — outbound HTTP hangs with no response
  • connection_refused — upstream TCP refused
  • dns_failure — hostname does not resolve
  • slow_response — 5 second delay to probe client timeouts
  • connection_reset — TCP reset mid-transfer

Dependency

  • http_500, http_429, http_503, http_401, http_404 — upstream status codes your handler may not map to a clean client response

Data

  • malformed_json, empty_response, wrong_content_type, partial_response, null_fields

Resource

  • db_connection_drop, db_timeout, db_constraint_violation

Team plans can add custom payload injection on top of this set. All listed modes are available on Hobby and Pro.

What a chaos scan actually runs

  1. DiscoveryAgent catalogs endpoints from the spec, collection, repo, or manual list.
  2. ChaosAgent selects modes and injects them across those endpoints.
  3. AnalystAgent labels findings (for example, unhandled SQLAlchemyError on GET /orders/{id}) and computes the 0–100 score.
  4. Optionally FixAgent, ReviewAgent, and GitHubAgent open a consolidated draft PR with failure-mode notes in the description.

You can replay the same sequence on the live demo. Scan quota is counted per chaos session — 3 / month on Hobby, 30 on Pro, unlimited on Team.

Use cases

Resilience review before a launch

Point the scanner at staging OpenAPI. Prioritize CRITICAL unhandled modes and leakage. Merge draft PRs that add explicit 503/404 handling rather than shipping bare db.fetch calls.

Regression after an incident

If production hit a truncated JSON body from a gateway, re-run partial_response and malformed_json on the same routes after the fix lands.

Teaching the team what “handled” means

A 200 with a hung worker is not success. The report distinguishes handled (correct error status, no leak), degraded (slow but 200), and unhandled (5xx plus exception text). That vocabulary is useful in code review even when you do not take the auto-generated patch.

Where chaos testing stops

Injection will not see a race that only appears under real user load, or a bug in a code path no spec lists. Pair it with API monitoring: the SDK reports unhandled exceptions from live Node.js, Python, or Spring Boot apps, and after three matching occurrences can open the same style of draft PR. Chaos testing is the rehearsal; monitoring is the show.

Related PatchFlow pages

FAQ

Questions developers ask

Straight answers about how this part of PatchFlow actually works.

How is API chaos testing different from Netflix-style chaos engineering?

Classic chaos engineering often kills processes or partitions infrastructure in a live environment. PatchFlow chaos testing is request-scoped failure injection against your HTTP API: synthetic network, dependency, payload, and database faults applied to discovered endpoints, then scored and optionally patched via a draft GitHub PR.

What are the 18+ chaos failure modes?

There are 18 deterministic modes in four categories: network (timeout, connection refused, DNS failure, slow 5s response, connection reset), dependency (500, 429, 503, 401, 404), data (malformed JSON, empty body, wrong content-type, truncated body, null required fields), and resource (database connection drop, query timeout, constraint violation).

Does chaos testing change my production database?

Injection is aimed at how your handlers behave when dependencies misbehave. You should run scans against a staging or local API, not as a substitute for a change window on production data. PatchFlow opens draft PRs against your GitHub repository; it does not merge them.

How test sessions are configured
Start Free Today

See it on your own API.

Connect a GitHub repository to run a chaos scan, install the SDK for production errors, or walk through a sample run on the live demo — no account required.

  • Hobby plan is free
  • Draft PRs only — nothing auto-merges
  • FastAPI, Django, Express, Spring Boot, Flask