R124 · AI-built software and its verification › Test oracles for agent-written code

rust-anything: port an app to Rust one unit at a time, gated on recorded behavior

Read the original

test-oracleslegacy-migrationcoding-agentsmcpopen-source

Source: erkamyaman/rust-anything (MIT, created 2026-11-16), surfaced by André Lindenberg on LinkedIn. Distributed on crates.io and npm; registers itself as an MCP server and skill for Claude Code, Codex, Cursor and Gemini CLI.

The idea

rust-anything does not translate code. The coding agent (or a person) writes the Rust; the tool supplies what an agent cannot reliably guess: where the time goes, what to port first, a bridge so existing callers keep the original API, the exact behavior the port must match, and a gate that defines done. The original program stays the source of truth throughout.

It supports TypeScript/JavaScript, Python, C, Go, Ruby and Java, each with a native bridge (napi-rs or wasm, PyO3, extern "C", cgo, magnus, JNI) and a driver that records and replays the original.

The loop

  1. Profile a real workload with the language's profiler to find hot functions and loops worth batching; it flags code that is already compiled, where Rust gains little.

  2. Analyze units, port order, risks with file and line, and dependency-to-crate fit.

  3. Bridge generates a crate with bindings and port.rs stubs; --batch keeps many values inside Rust so a call crosses the boundary once.

  4. Record runs the original on generated edge cases, built-in traps and user inputs, saving outputs and errors.

  5. Port (agent or human writes port.rs).

  6. Diff replays every recorded case against the Rust.

  7. Bench gives a faster-or-not verdict; calling Rust once per small function is often slower than a JIT, so the tool aims at loops.

  8. Shadow runs both side by side in production.

  9. Gate must pass before a unit counts as done.

For a whole app, the same loop runs unit by unit inside an outside-in frame: record the app as a black box from its documented entry points, let a Rust front door take the entry point while unported units fall back to the original, then lift units until replay is 100% in pure Rust. The README claims 38,251 recorded cases replayed with zero mismatches across its demos and speedups from 3x (Java slugify) to 20x (a TypeScript search over 50,000 keys).

Agent workflow around it

The whole-app skill structures multi-session agent work with files: decisions as ADRs in rust/DECISIONS.md (settled by an up-front question round with a recommended answer for each), a glossary mapping original terms to Rust names, background research notes per dependency, a rust/MAP.md of every unit and its state that a session claims before starting, a rust/HANDOFF.md at each checkpoint, and a generated cutover.sh for steps only a person can do (deploys, DNS, secrets), each with a way back.

What it can't catch (stated by the project)

Tradeoffs

Review checklist

Connections

See R124 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.