Repository navigation
Description
What problem does this solve
microburst's detect → decide → effect pipeline proves the thesis that fault injection only exercises real client behavior when the error arrives in the wire format the driver parses. That same thesis applies beyond AWS:
- PostgreSQL: drivers (pgx, psycopg, JDBC, libpq, ActiveRecord) classify retries by SQLSTATE —
40001serialization_failure,40P01deadlock,55P03lock timeout,53300too_many_connections,57P01admin_shutdown,25006read-only after failover. Toxiproxy can drop bytes; it cannot return a protocol-correct ErrorResponse, so retry/failover paths go untested. - Redis/RESP: cluster clients only exercise slot-migration handling if they see real
-MOVED/-ASKredirects; also-LOADING,-READONLYpost-failover, timeouts mid-MULTI. - gRPC: status trailers (UNAVAILABLE, RESOURCE_EXHAUSTED, ABORTED) injected mid-stream — needs HTTP/2 frame awareness, not protobuf parsing.
- MySQL: same shape as PG — error packets with errno + SQLSTATE.
Today the rules engine, effects (latency/timeout/reset/corrupt), control API, fired log, presets and metrics are all protocol-agnostic in spirit but AWS-shaped in packaging. Extracting them into a shared core turns each new wire protocol into a module instead of a fork.
Proposed shape
Keep the pipeline, generalize the seams:
protocols/base.pyalready defines a registry seam (@register_serializer). Extend it upstream: a protocol module declares a frame parser, an operation detector, and an error renderer for its wire format.- New top-level mode:
microburst --protocol postgres --upstream localhost:5432(TCP listener instead of HTTP), same control API surface (/_microburst/rules,/fired, presets, Prometheus metrics — possibly namespaced per protocol). - PG MVP faults: ErrorResponse with chosen SQLSTATE mid-query, mid-ResultSet termination (partial rows then error),
25P02aborted-transaction state, connection kill mid-transaction for failover testing, NOTICE storms. - Rule sketch:
- protocol: postgres
query: "INSERT INTO orders" # regex on query text
probability: 0.3
error:
sqlstate: "55P03" # lock_not_available
message: "could not obtain lock"
latency: {min: 200, max: 1500}Redis (-MOVED/-ASK) is the natural second module — RESP framing is trivial and cluster-redirect testing is a real gap.
AWS behavior evidence
Not an AWS fault — this extends the fidelity thesis to adjacent wire protocols.
- PostgreSQL wire protocol + ErrorResponse fields: https://www.postgresql.org/docs/current/protocol-message-formats.html
- SQLSTATE codes drivers retry on: https://www.postgresql.org/docs/current/errcodes-appendix.html (class 40 = transaction rollback, class 53/57 = resource/operator intervention, class 08 = connection exception)
- Redis error replies and cluster redirects: https://redis.io/docs/latest/develop/reference/protocol-spec/
Guess, not verified: most language drivers treat class-40 errors as retryable at the transaction level; worth confirming per-driver (pgx, psycopg, JDBC) before locking semantics.
Activity
pingedbrain commentedon Oct 9, 2026
Design exploration — how the PG wire mode fits microburst
Spent a session mapping this properly. The core finding: PostgreSQL should not be forced through the HTTP pipeline. HTTP is one-request→one-response; PG is a long-lived bidirectional framed stream. What the two share is the decision plane, not the transport loop.
What gets reused as-is
rules.py) — service/operation/label matchers map cleanly to verb+table detection/_microburst/*), metrics, stats endpoint — protocol-agnostic alreadyWhat is PG-specific (
src/microburst/pg/)Q, extended protocolP/B/D/E/S,X)S/V/C/M/D/F/Lfields; SQLSTATE-correct (40001,40P01,55P03,53300,57P01,57014…)The honest thesis difference
AWS SDKs auto-retry — so microburst exercises the driver's retry path. PG drivers (pgx, psycopg, JDBC, libpq) generally don't auto-retry; they surface SQLSTATE + severity to the application. The fidelity target shifts: the error must be indistinguishable from real PostgreSQL so the application's classification/retry code gets exercised. Same product, different consumer.
The hard problem: state divergence
An injected
ERRORinside a transaction puts the client in failed-transaction state while the upstream never saw it — connections desync. MVP dodges this: FATAL-class errors only (they kill the connection, no divergence), ERROR-class only when the tx status byte isI(idle). Emulating25P02-in-transaction faithfully is Phase 2 and needs minimal tx state tracking.MVP scope
53300too_many_connections FATAL at connectQ) error injection + latency/reset/timeout (57014query_canceled vs hang)Naming: single package
microburstwith--protocol postgres; nomicroburst-coreextraction yet — the seam issrc/microburst/pg/as a sibling transport, shared rule engine imported directly.Marking this in-progress — implementation starts after the current effects batch lands.
pingedbrain commentedon Oct 9, 2026
Phase 1 MVP landed in fb62d9c: src/microburst/pg/ (v3 frame codec, SSL/GSSENC refusal, ErrorResponse renderer with real SQLSTATE+severity, verb+table detector, asyncio TCP proxy), --protocol postgres flag, shared rule engine (sql: matcher, error.sqlstate alias, partial_rows). Verified live against real PG16 + psql: SCRAM passthrough, 53300 FATAL at startup, 40001 ERROR outside tx, tx-status-aware skip inside tx (fired note), partial_rows TCP-abort mid-ResultSet. Remaining for later phases: COPY interception, prepared-statement-by-name, Redis/MySQL same-seam.
pingedbrain commentedon Oct 10, 2026
Phase 1.5 landed in 8a11fea: Redis/RESP mode proves the sibling-transport seam generalizes — src/microburst/redis/ (RESP2+RESP3 codec, -LINE renderer, verb+key detector, asyncio proxy). --protocol redis --port 16379. Live-verified vs real Redis 7 + redis-cli: -MOVED/-ASK cluster redirects parse correctly in clients, MULTI-skip semantics (errors skip while queuing — fired note), cut_reply mid-bulk aborts, pub/sub splice passthrough. The seam held: rules engine/fired/metrics/stats/control API all shared, ~40 LOC of glue in cli.py.
pingedbrain commentedon Oct 10, 2026
Phase 2 complete — the seam is now proven at four transports. 10c6f8c: MySQL wire mode (, src/microburst/mysql/) — ERR packets with real errno+SQLSTATE (1213/40001 deadlock, 1040/08004 too-many-connections at handshake), tx-status-aware injection (SERVER_STATUS_IN_TRANS tracked), COM_STMT_PREPARE id→SQL map so sql: matches EXECUTE. Live-verified vs MariaDB 11.8 + mariadb client. ff1ff2d: generic TCP fallback (, user-declared length-prefix/delimiter/fixed framing, payload: byte-regex, respond: synthetic bytes) covers protocols without a dedicated module. The transports registry (src/microburst/transports.py) is the formal seam — new transports are registry entries + sibling packages. Remaining scope on this issue: gRPC trailers (HTTP/2 path), subscribe/stream-mode injection, TLS termination.
pingedbrain commentedon Oct 27, 2026
Status update:
--protocol grpclanded in c10c99c — h2c transport with trailers-only and mid-stream (partial_messages) error injection, RST_STREAM aborts, and stalls with real flow-control backpressure. That leaves subscribe/stream-mode injection and TLS termination as the remaining scope on this issue.feat(redis): decide per push frame in pub/sub and MONITOR streams (#17)
feat(tls): client-side TLS termination via --tls-cert/--tls-key (#19)
pingedbrain commentedon Oct 28, 2026
Epic complete — every item has landed on
main:TRANSPORTSregistry (transports.py—run_*contract, schemes, per-transport options)src/microburst/pg/) — SQLSTATE errors, tx-aware injection, startup refusalssrc/microburst/redis/) — RESP2/RESP3,-CODEerrors, MOVED/ASK, MULTI-aware skippingsrc/microburst/mysql/) — errno+SQLSTATE ERR_Packets, tx tracking, auth passthroughsrc/microburst/tcp/) + framing — protocol-blind transport faultssrc/microburst/grpc/) — trailers-only + mid-stream injection, RST_STREAM, flow-control stallsdrop:/error:/latency/reset/cut_reply.after_messages(feat(redis): fault injection in pub/sub and MONITOR push streams #17)--tls-cert/--tls-keyacross all transports incl. https listener; pg SSLRequest→S and mysql SSLRequest upgrade in-band; upstream stays plaintext (feat(tls): client-side TLS termination via --tls-cert/--tls-key #19)cion main is green. Remaining per-transport follow-ups live in ROADMAP's "What remains" lists (RESP3 blob-error synthesis, binlog/cursor streams, per-stream timers, etc.) — trackable as separate issues when needed.