Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.
Rust agent-skillsclaude-codeclicode-migrationcodexffigolangjavajavascriptmcpmigrationnapiperformanceportingpyo3pythonrewriterubyrusttypescript
app record: say a later record keeps the saved --timeout (#1283)
jakalijey4df5aa4b6680
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c00257ca..6ff2eff0 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,9 @@## Unreleased+- `app record --timeout` help and the MCP `app_record` tool say the timeout is saved with the cases+ and kept by a later record, 30 seconds unless it was changed, instead of "default 30" (#1251 by+ @jakalijey).- `doctor --json` has a top-level `"ok"` that matches the exit code, and the text verdict names therequired checks that failed (`Something required is missing: Claude Code mcp, Claude Code skill.`)instead of listing cargo, the MCP server and agent setup whichever one failed (#1262 by @jakalijey).diff --git a/docs/tools.md b/docs/tools.mdindex cf3096fa..26d59bc5 100644--- a/docs/tools.md+++ b/docs/tools.md@@ -337,7 +337,7 @@ Runs the original's code or commands.| `inputs` | string | | JSONL of extra cases: {"name", "args": [...], "stdin", "env": {...}, "files": {path: text}, "remove": [paths]}; `remove` deletes paths from the `fresh` copy before the case runs. || `normalize` | string[] | | Normalizers: timestamps, uuids, key-order, or name=regex. || `name` | string | | Name the app is invoked by in its docs. |-| `timeout` | integer | | Seconds before a run is killed (default 30). |+| `timeout` | integer | | Seconds before a run is killed. Saved with the cases and used by replay; a later record keeps the saved one (30 seconds unless it was changed). || `traps` | boolean | | Add semantic-trap cases (default true). || `http` | boolean | | The app is a server: `run` starts it (it takes its port from PORT or {port}); cases are requests from curl lines in its docs, `inputs` ({"name", "method", "path", "headers", "body" \| "body_base64" \| "body_file"}) and traps. Pass `false` to drop a saved server recording and record as a CLI again. || `port` | integer | | A port the server always listens on (implies http); 0 removes a saved fixed port. |diff --git a/src/main.rs b/src/main.rsindex 012a693b..38b2fc4e 100644--- a/src/main.rs+++ b/src/main.rs@@ -801,7 +801,8 @@ enum AppCmd {/// Leave out the semantic-trap inputs.#[arg(long)]no_traps: bool,- /// Seconds before a run is killed (default 30).+ /// Seconds before a run is killed. Saved with the cases and used by replay; a later record+ /// keeps the saved one (30 seconds unless it was changed).#[arg(long)]timeout: Option<u64>,/// The app is a server: the command starts it, taking its port from PORT or `{port}`;diff --git a/src/mcp.rs b/src/mcp.rsindex 8efe7a5a..7c06c662 100644--- a/src/mcp.rs+++ b/src/mcp.rs@@ -952,7 +952,7 @@ fn tool_schemas() -> Value {"inputs": { "type": "string", "description": "JSONL of extra cases: {\"name\", \"args\": [...], \"stdin\", \"env\": {...}, \"files\": {path: text}, \"remove\": [paths]}; `remove` deletes paths from the `fresh` copy before the case runs." },"normalize": { "type": "array", "items": { "type": "string" }, "description": "Normalizers: timestamps, uuids, key-order, or name=regex." },"name": { "type": "string", "description": "Name the app is invoked by in its docs." },- "timeout": { "type": "integer", "description": "Seconds before a run is killed (default 30)." },+ "timeout": { "type": "integer", "description": "Seconds before a run is killed. Saved with the cases and used by replay; a later record keeps the saved one (30 seconds unless it was changed)." },"traps": { "type": "boolean", "description": "Add semantic-trap cases (default true)." },"http": { "type": "boolean", "description": "The app is a server: `run` starts it (it takes its port from PORT or {port}); cases are requests from curl lines in its docs, `inputs` ({\"name\", \"method\", \"path\", \"headers\", \"body\" | \"body_base64\" | \"body_file\"}) and traps. Pass `false` to drop a saved server recording and record as a CLI again." },"port": { "type": "integer", "description": "A port the server always listens on (implies http); 0 removes a saved fixed port." },diff --git a/tests/app.rs b/tests/app.rsindex 2c1665b6..0316c983 100644--- a/tests/app.rs+++ b/tests/app.rs@@ -1610,6 +1610,43 @@ fn a_library_front_door_prints_one_export_in_the_singular() {);}+#[test]+fn app_record_keeps_a_saved_timeout_when_none_is_passed() {+ let Some(python) = common::python() else {+ return;+ };+ let repo = one_off(+ "keeps-timeout",+ &[("cli.py", "import sys\nprint('hello', *sys.argv[1:])\n")],+ );+ let record = |extra: &[&str], run: &[&str]| {+ let out = common::cli()+ .args(["app", "record", ".", "--no-traps"])+ .args(extra)+ .args(run)+ .current_dir(&repo)+ .output()+ .unwrap();+ assert!(+ out.status.success(),+ "{}",+ String::from_utf8_lossy(&out.stderr)+ );+ };+ let saved = || -> serde_json::Value {+ serde_json::from_str(+ &std::fs::read_to_string(app::cases_dir(&repo).join("rust-anything.json")).unwrap(),+ )+ .unwrap()+ };+ record(&["--timeout", "5"], &["--", python, "cli.py"]);+ assert_eq!(saved()["timeout_secs"], 5);+ // Without `--timeout` (and without the command, which is saved too), the saved one stays.+ record(&[], &[]);+ assert_eq!(saved()["timeout_secs"], 5, "{}", saved());+ std::fs::remove_dir_all(&repo).unwrap();+}+#[test]fn app_record_and_replay_cli_reject_zero_timeout_without_touching_cases() {let repo = one_off("zero-timeout-cli", &[("cli.py", "print('hi')\n")]);diff --git a/website/content/cli-help.json b/website/content/cli-help.jsonindex 36dea895..214455ab 100644--- a/website/content/cli-help.json+++ b/website/content/cli-help.json@@ -83,7 +83,7 @@},{"command": "app record",- "help": "Run the original CLI or server on cases (its own examples, `--inputs`, semantic traps), twice each, and store them in `<repo>/rust/app-cases/`: trycmd files for a CLI, HTTP cases in `http/` for a server. `rust-anything app record . -- python3 cli.py`\n\nUsage: rust-anything app record [OPTIONS] [REPO] [-- <RUN>...]\n\nArguments:\n [REPO] Repository root [default: .]\n [RUN]... The command that runs the original, after `--`; paths are relative to the repository. Taken from the saved cases when omitted\n\nOptions:\n --inputs <INPUTS>\n Extra cases: JSONL of `{\"name\", \"args\": [...], \"stdin\", \"env\": {...}, \"files\": {path: text}, \"remove\": [paths]}`. `remove` deletes paths from the `--fresh` copy before the case runs\n --normalize <NORMALIZE>\n Normalizer: `timestamps`, `uuids`, `key-order`, or `name=regex` for your own. Repeatable; saved with the cases\n --name <NAME>\n The name the app is invoked by in its docs (found from the command and manifests when omitted)\n --no-traps\n Leave out the semantic-trap inputs\n --timeout <TIMEOUT>\n Seconds before a run is killed (default 30)\n --http\n The app is a server: the command starts it, taking its port from PORT or `{port}`; cases are requests (curl lines in its docs, `--inputs`, traps), kept in `http/`\n --no-http\n Drop a saved server recording and record as a CLI again\n --port <PORT>\n A port the server always listens on (implies --http); 0 removes a saved port\n --arg <ARG>\n An argument every server start gets after its command, the original's and every build's, so the Rust binary is started as the original is (`--arg db.json`). Repeatable; implies --http; saved with the cases\n --no-args\n Clear the saved `--arg` server arguments\n --fresh <FRESH>\n A file or folder of the repository the app reads or writes (a project tree, a database file, a public folder): snapshotted into `files/` (`http/files/` for a server) and copied into a fresh working directory before every case (CLIs) or start (servers). A CLI's written files are what differs from it afterwards, and the files it removed are compared too. Repeatable; saved with the cases\n --no-fresh\n Clear the saved `--fresh` paths and remove the saved snapshot\n --pace <MS>\n Milliseconds to wait after each response before the next request, for work a server does after answering (a file watcher reloading what it just wrote). Implies --http; saved with the cases and used by replay; 0 removes it\n --ready-timeout <SECS>\n Seconds to wait for the server to accept connections before giving up (default 60). Implies --http; saved with the cases and used by replay and the front door; 0 restores the default\n --ready <METHOD PATH>\n A request that says the server is ready once it answers 2xx, e.g. `GET /health`, for a framework that opens its port before its routes work. Implies --http; saved with the cases and used by replay and the front door\n --float-tolerance <FLOAT_TOLERANCE>\n Numbers in the output match when they differ by at most this times the larger magnitude (absolute below 1), e.g. 1e-9 for numeric code. Saved with the cases; 0 removes it\n --allow-large-tolerance\n Allow a --float-tolerance above 1e-6, which forgives differences that are not rounding\n --float-file <PATH=FORMAT>\n A written file of raw floats, compared value by value within --float-tolerance instead of byte for byte: `PATH=f32le` or `PATH=f64le`. Repeatable; saved with the cases\n --effects <KINDS>\n Record what leaves the process too: `http` runs a local sink that answers every request (set as HTTP_PROXY, http_proxy and RUST_ANYTHING_HTTP_SINK), `smtp` a local mail server (SMTP_HOST, SMTP_PORT) recording decoded headers and MIME parts, and `smtp-raw` the same server recording the raw MIME DATA. Each case stores what reached them, in order, and replay compares it. Comma-separated or repeated. Saved with the cases\n --effect-env <VAR=KIND>\n Point one of the app's own settings at a sink: VAR=http-url, VAR=smtp-host, VAR=smtp-port or VAR=smtp-url (e.g. WEBHOOK_URL=http-url). Implies that effect\n --effect-response <SPEC>\n Canned response for the HTTP effect sink: `METHOD /path=STATUS [BODY|@FILE]` (e.g. `POST /v1/charges=201 @fixtures/charge.json` or `POST /hooks/*=500`). Matched in order with `*` wildcards; unmatched requests get `200 {}`. Enables the outbound HTTP effect (`--effects http`, not `--http` server mode); saved with the cases so replay sees identical replies. Repeatable\n --db-reset <COMMAND>\n A shell command run before each case (CLIs) or each start (servers) that resets the database to a known state. Cases then run one at a time. It runs in the folder the case runs in; a script it names by a relative path with a script extension (`reset.py`, `seed.sh`, `schema.sql`) is the repository's, other relative paths the case folder's\n --db-dump <COMMAND>\n A shell command that prints the database's state (e.g. `sqlite3 app.db .dump`), run after each case or request in the folder the case runs in; its output is recorded with the effects\n --sandbox\n Run the original with no network, the repository read-only and a CPU limit and, on Linux only, a memory limit, as `record --sandbox` does. On macOS loopback stays open for `--http` and the effect sinks; on Linux (bubblewrap) they do not combine with it\n --json\n Print the machine-readable report as JSON\n -h, --help\n Print help\n"+ "help": "Run the original CLI or server on cases (its own examples, `--inputs`, semantic traps), twice each, and store them in `<repo>/rust/app-cases/`: trycmd files for a CLI, HTTP cases in `http/` for a server. `rust-anything app record . -- python3 cli.py`\n\nUsage: rust-anything app record [OPTIONS] [REPO] [-- <RUN>...]\n\nArguments:\n [REPO] Repository root [default: .]\n [RUN]... The command that runs the original, after `--`; paths are relative to the repository. Taken from the saved cases when omitted\n\nOptions:\n --inputs <INPUTS>\n Extra cases: JSONL of `{\"name\", \"args\": [...], \"stdin\", \"env\": {...}, \"files\": {path: text}, \"remove\": [paths]}`. `remove` deletes paths from the `--fresh` copy before the case runs\n --normalize <NORMALIZE>\n Normalizer: `timestamps`, `uuids`, `key-order`, or `name=regex` for your own. Repeatable; saved with the cases\n --name <NAME>\n The name the app is invoked by in its docs (found from the command and manifests when omitted)\n --no-traps\n Leave out the semantic-trap inputs\n --timeout <TIMEOUT>\n Seconds before a run is killed. Saved with the cases and used by replay; a later record keeps the saved one (30 seconds unless it was changed)\n --http\n The app is a server: the command starts it, taking its port from PORT or `{port}`; cases are requests (curl lines in its docs, `--inputs`, traps), kept in `http/`\n --no-http\n Drop a saved server recording and record as a CLI again\n --port <PORT>\n A port the server always listens on (implies --http); 0 removes a saved port\n --arg <ARG>\n An argument every server start gets after its command, the original's and every build's, so the Rust binary is started as the original is (`--arg db.json`). Repeatable; implies --http; saved with the cases\n --no-args\n Clear the saved `--arg` server arguments\n --fresh <FRESH>\n A file or folder of the repository the app reads or writes (a project tree, a database file, a public folder): snapshotted into `files/` (`http/files/` for a server) and copied into a fresh working directory before every case (CLIs) or start (servers). A CLI's written files are what differs from it afterwards, and the files it removed are compared too. Repeatable; saved with the cases\n --no-fresh\n Clear the saved `--fresh` paths and remove the saved snapshot\n --pace <MS>\n Milliseconds to wait after each response before the next request, for work a server does after answering (a file watcher reloading what it just wrote). Implies --http; saved with the cases and used by replay; 0 removes it\n --ready-timeout <SECS>\n Seconds to wait for the server to accept connections before giving up (default 60). Implies --http; saved with the cases and used by replay and the front door; 0 restores the default\n --ready <METHOD PATH>\n A request that says the server is ready once it answers 2xx, e.g. `GET /health`, for a framework that opens its port before its routes work. Implies --http; saved with the cases and used by replay and the front door\n --float-tolerance <FLOAT_TOLERANCE>\n Numbers in the output match when they differ by at most this times the larger magnitude (absolute below 1), e.g. 1e-9 for numeric code. Saved with the cases; 0 removes it\n --allow-large-tolerance\n Allow a --float-tolerance above 1e-6, which forgives differences that are not rounding\n --float-file <PATH=FORMAT>\n A written file of raw floats, compared value by value within --float-tolerance instead of byte for byte: `PATH=f32le` or `PATH=f64le`. Repeatable; saved with the cases\n --effects <KINDS>\n Record what leaves the process too: `http` runs a local sink that answers every request (set as HTTP_PROXY, http_proxy and RUST_ANYTHING_HTTP_SINK), `smtp` a local mail server (SMTP_HOST, SMTP_PORT) recording decoded headers and MIME parts, and `smtp-raw` the same server recording the raw MIME DATA. Each case stores what reached them, in order, and replay compares it. Comma-separated or repeated. Saved with the cases\n --effect-env <VAR=KIND>\n Point one of the app's own settings at a sink: VAR=http-url, VAR=smtp-host, VAR=smtp-port or VAR=smtp-url (e.g. WEBHOOK_URL=http-url). Implies that effect\n --effect-response <SPEC>\n Canned response for the HTTP effect sink: `METHOD /path=STATUS [BODY|@FILE]` (e.g. `POST /v1/charges=201 @fixtures/charge.json` or `POST /hooks/*=500`). Matched in order with `*` wildcards; unmatched requests get `200 {}`. Enables the outbound HTTP effect (`--effects http`, not `--http` server mode); saved with the cases so replay sees identical replies. Repeatable\n --db-reset <COMMAND>\n A shell command run before each case (CLIs) or each start (servers) that resets the database to a known state. Cases then run one at a time. It runs in the folder the case runs in; a script it names by a relative path with a script extension (`reset.py`, `seed.sh`, `schema.sql`) is the repository's, other relative paths the case folder's\n --db-dump <COMMAND>\n A shell command that prints the database's state (e.g. `sqlite3 app.db .dump`), run after each case or request in the folder the case runs in; its output is recorded with the effects\n --sandbox\n Run the original with no network, the repository read-only and a CPU limit and, on Linux only, a memory limit, as `record --sandbox` does. On macOS loopback stays open for `--http` and the effect sinks; on Linux (bubblewrap) they do not combine with it\n --json\n Print the machine-readable report as JSON\n -h, --help\n Print help\n"},{"command": "app replay",