Servers
The same commands prove HTTP servers. --http says the command starts a server; it takes its
port from PORT or {port} in the command (--port for one that always listens on the same
port):
sh
rust-anything app record . --http -- node server.js
rust-anything app replay .
rust-anything app front-door . # axum: every route proxied
rust-anything app wire . api --route 'GET /users/{id}' --route '*'
rust-anything app lift .
- Requests come from
curllines in the app's docs (curl -X POST -d ... http://localhost:8080/x,--data-binary @filesent as raw bytes,-F/--formas amultipart/form-dataupload),--inputs({"name", "method", "path", "headers", "body" | "body_base64" | "body_file"}, abody_filerelative to the inputs file or the repository) and traps: path segments and query values swapped for the same traps as CLI arguments, bodies for text and JSON traps, and an unknown route. Each run starts the server fresh and sends the requests in name order, so state between requests is kept. - A server that keeps state in files gets a fresh copy for every start:
--fresh db.json(a file or folder, repeatable) is snapshotted intohttp/files/and copied into a new working directory each time the original, the front door or a build starts;--arg db.jsonis an argument every start gets after its command, so the Rust binary is started as the original is.--pace 50waits 50 ms after each response, for work a server does after answering (a file watcher reloading what it just wrote). A server gets 60 seconds to accept connections;--ready-timeout 180gives a slow start (a JVM, .NET) longer, and--ready-timeout 5makes a build that never listens fail fast. A framework that opens its port before its routes work gets--ready "GET /health": after the port opens, that request is sent until it answers 2xx, within the same wait, by record, replay and the front door. - Cases are
rust/app-cases/http/<case>.toml(the request, the status and the headers that matter) and<case>.body(the response body, with[..]where two runs differed). Date, server and other per-response headers are left out; delete any header line you do not care about. - The front door is an axum server that starts the original on a port of its own and proxies
every route no unit answers.
wire --routetakes axum routes:METHOD /path/{param},/pathfor any method,*for everything else; the glue gets the route, its parameters and the request.liftremoves the proxy; HTTP cases then run in CI withapp replay.
Shadow live traffic
Recorded cases cover what the docs, --inputs and traps thought of. app shadow checks a build
against real requests too: a proxy sends each request to the original, relays its answer to the
client byte for byte, then sends the same request to the build and compares the two answers
(status, headers other than the per-response ones a recording leaves out, body) with the saved
normalizers:
sh
rust-anything app shadow . --build rust/app/target/release/app --listen 8080
rust-anything app shadow . --build ./server-rs --upstream 127.0.0.1:3000 --keep
- Clients only ever get the original's answer, and the build is asked after the client has it, so a slow or broken build changes nothing for them. Requests are handled one at a time.
- The original runs for real: the saved command starts it (with its saved
--args), or--upstream HOST:PORTpoints at one already running. Each side effect happens once, there. - The build runs on a port of its own with the HTTP and mail sinks of
--effectsalways on (HTTP_PROXY,SMTP_HOST,SMTP_PORTand any saved--effect-env), and the--freshpaths copied from the repository into a working directory of its own when it starts. Its effects are dropped, not compared.--db-resetand--db-dumpare not run, and a database the build reaches over the network is not isolated: point the build at a copy. - A header whose value differed between the original's own runs when it was recorded is checked for presence only.
- Each mismatch is a line in
rust/app-cases/shadow/mismatches.jsonlwith the method, a hash of the path and, for each field that differed (body,status,header content-type), its shape asapp replay --redactwrites it: where it first differs, kind, line and column, lengths, never the values. The terminal shows the same, and at the end the distinct differences with how many requests each covers.--keepappends the request itself torust/app-cases/shadow/inputs.jsonl, whichapp record --inputsturns into a case, so a mismatch seen live is replayed with the full diff from then on. - It runs until Ctrl-C;
--requests 100stops after 100 requests and exits 1 if any mismatched. CLIs are not covered yet, and there is no MCP tool, since it runs until stopped.
A real one
json-server needed --fresh, --arg and --pace: it rewrites its database on every write, and its file watcher can undo a write that follows quickly.