About this project

ChaosSQL is a testing tool aimed at database concurrency defects. According to its README, it performs deterministic concurrency and invariant testing for PostgreSQL, MySQL and SQLite, and is intended to surface silent data corruption, write skew and lost updates in CI/CD before they reach production. How it works The project schedules concurrent worker transactions against a schema and seed dataset, checks user-defined invariants after execution, and, when a violation appears, produces a minimal reproduction. It reports a deterministic seed and a synthesized Go reproduction test file (repro_test.go) that can be added to a test suite. The README states that outputs include anomaly classification such as lost update (P4) and write skew (A5B). Interfaces CLI: the standalone binary is installed with go install github.com/bregaldahq/chaossql/cmd/chaossql and has zero CGO dependencies. Documented subcommands include run, demo, ui, diff, mutate, swarm and proxy. Demos: ten packaged scenarios cover banking lost updates, inventory oversell, hospital write skew, read skew, dirty write, circular information flow, dirty read, anti-dependency, deadlock cycles and foreign key cascade deadlocks. UI: a local trace visualizer with a worker swimlane timeline, an interactive Adya dependency graph, a comparison between the full trace and a shrunk minimal reproduction, and a statement inspector showing SQL, parameters and latencies. SDKs: a Go package (pkg/chaostest) integrates with go test; a Python package installed from pip works with pytest and unittest and offers a pytest fixture; a TypeScript package (at-chaossql-test on npm) targets Vitest, Jest and the Node.js test runner. Reporting: SARIF 2.1.0 export for GitHub Code Scanning, with rules mapped to CWE-362. CI: a GitHub Action (bregaldahq/chaossql, referenced as v1.5.0 in the README) can block pull requests on invariant failure, post PR comments and publish a step summary containing the minimal execution trace. Multi-engine and mutation features mutate generates variants of a scenario by perturbing delays, injecting nested savepoints, shuffling causally valid transaction steps, and inverting lock acquisition order; it exposes variants, output directory, seed and JSON flags. swarm runs scenario suites across several drivers (sqlite, mock, postgres, mysql) with bounded concurrency, optional Markdown summaries and JSON output. Driver DSNs are resolved from POSTGRES_DSN and MYSQL_DSN environment variables. A headless WebAssembly and Web Worker stress harness is described through a make target, with stated goals around bounded linear memory and non-blocking graph layout during long stress runs. Layer-7 proxy chaossql proxy sits between an application and a database, speaking PostgreSQL 3.0 or MySQL wire protocol, and injects micro-jitter and pre-commit barriers while building a live shadow dependency serialization graph that classifies anomalies in real time. It can export SARIF and serve a web UI with JSON telemetry on a configurable port. The README states that application code does not need to be modified to use it. Project details Written in Go (1.22 or newer according to the badges), MIT licensed, with a documentation portal, a browser-based WebAssembly playground, and an examples directory referenced throughout the commands. The README also mentions a hosted cloud service with baseline tracking and pull request comments as early access, plus commercial concurrency audits offered by the vendor; these are vendor services rather than components of the open repository.