rust-anything, Tested: 100 Bugs Planted in a Rust Port That Passed the Gate
If rust-anything’s gate passes, does your Rust port behave like the original? Mostly, and only as far as the recording reaches. We planted 100 small bugs, one at a time, in a Rust port that passes the gate. Of the 88 that changed behaviour, the gate caught 71. The other 17 passed three runs in a row, including a port that no longer understands 2hrs.
rust-anything is an open-source tool for moving code to Rust one piece at a time with a coding agent such as Claude Code, Codex or Cursor. It was published on November 16, 2026 and had about 12,000 GitHub stars two weeks later. It records what the original code returns and throws, then refuses the Rust port until every recorded case matches. This article measures how much that refusal is worth on one real port. We did not run the agent side, where a model writes the port.
What the gate promises
The loop is short. record runs the original on generated inputs, on inputs you supply, and optionally on the calls its own test suite makes, and saves each result. diff replays those cases against the Rust port. gate is the definition of done: every recorded case must match, and a set of extra checks must pass.
The extra checks are aimed at an agent that cheats. A port can pass diff without porting anything: answer from a table of recorded results, run the original for each call, or edit the recording. The gate looks for each of those, and it adds a held-out check that sends inputs the recording does not contain through both sides.
The project is direct about the limit. Its documentation has a section titled “It can only catch what the recording covers”, which says that passing “means the Rust matches every case that was recorded, nothing more”. Our test puts a number on that sentence.
How we tested it
The repository includes ports the author made with the tool. One is a Rust port of vercel/ms, the small library that turns "2 days" into 172800000 and back. It has four functions and 235 lines of Rust. We used that port unchanged, for the same reason as in our test of the 100x Engineer skill: the tool’s author chose the library and wrote the port, so a weak result cannot be blamed on our own work.
We put the port beside ms at the commit it was made from, recorded the original with rust-anything 5.1.0, and confirmed that the gate passes. Then a script made one small edit to src/port.rs at a time: change >= to >, swap * and /, change a constant, drop one accepted spelling of a unit, break a label, flip a boolean. Thirteen kinds of edit gave 100 versions of the port, each with one planted bug.
For every version we ran the full gate. When it passed, we ran it twice more, because the held-out check draws new inputs each time. We also ran our own comparison of the port and the original on 56,986 calls, to find out whether a surviving edit really changes behaviour or is harmless.
We did this for two recordings:
- 788 cases: the tool’s generated inputs plus the 149 inputs in the crate’s
inputs.jsonl. - 1,127 cases: the same plus the 340 calls the crate’s
test-inputs.jsonlholds, which the author captured fromms’s own Jest suite.
Everything ran in Docker, with only the work folder mounted. No language model was called.
First finding: the published port fails the current gate
Before planting anything, we replayed the fresh recording against the published port:
$ rust-anything diff rust/index-rs
1115/1128 cases match exactly, 1 more accepted as known differences (known-diffs.jsonl)
2 distinct differences in 12 cases:
- format(null): expected {"error":"Value provided to ms.format() must be of type number.","error_type":"Error"},
got {"error":"Failed to convert napi value Null into rust type `f64`","error_type":"TypeError"}
That replay held 1,128 cases; we then removed one duplicated input, which leaves the 1,127 used below. In twelve distinct calls the argument has the wrong type: a string or null passed to format, a number or null passed to parse. The original throws Error with its own message. The port throws TypeError, because the generated bridge rejects the value before the port’s code runs. The current version compares the error’s type, so these now count as differences.
This is the tool working. A newer version found a gap in an older port. It also shows a decision every port has to make: whether callers that pass the wrong type should get the original’s error. We listed the twelve cases in known-diffs.jsonl, which is the documented way to accept a difference, so the mutation test could start from a passing gate.
Results
Twelve of the 100 edits made no difference we could find in 56,986 calls, so they are not bugs. The other 88 change what the port returns.
| Gate run | Bugs caught, of 88 | Passed |
|---|---|---|
| Recording with the original’s test inputs, held-out raised to 2,000 | 72 | 16 |
| Recording with the original’s test inputs (1,127 cases) | 71 | 17 |
| Generated cases and 149 inputs (788 cases) | 67 | 21 |
Every bug the gate caught in the first two rows was caught by the recorded cases. The arithmetic and the unit factors were covered completely: all 14 arithmetic edits and all 7 swapped unit factors failed at once. A port that multiplies by the wrong constant does not get through.
Adding the original’s test suite to the recording helped. With 788 cases, a port that formats one hour as 1hx passed the gate, because no recorded case produced a result in hours or months. The test suite’s calls covered those, and all four label bugs of that kind were caught.
The 17 bugs that still passed
With the larger recording, the gate reported that the recorded cases ran 94% of the original’s lines. These still passed:
- Seven dropped unit spellings.
msacceptsyrs,months,hrs,minutes,mins,secondsandsecsamong others. Remove any one of those seven from the port and the gate passes. Neither the generated inputs nor the library’s own tests use those spellings. - Five changes to how the
longoption is read. The original treats{ long: 1 }or{ long: "yes" }as true. A port that only accepts a realtrue, or getsnulland[]wrong, passes. - Two changes to the plural rule. The original writes
2 secondsfor 1,500 ms. A port that writes2 secondthere passes. - Two off-by-one errors on length. A string of exactly 100 characters is accepted by the original and rejected by the port.
- One whitespace change. The original allows spaces between the number and the unit. The port also allowed a tab.
Here are two of them planted together, with the gate’s own lines:
- "hours" | "hour" | "hrs" | "hr" | "h" => H,
+ "hours" | "hour" | "hr" | "h" => H,
- let plural = if abs >= unit * 1.5 { "s" } else { "" };
+ let plural = if abs > unit * 1.5 { "s" } else { "" };
$ rust-anything gate rust/index-rs --accept-known-diffs 12 | grep -E "coverage|behavior|held-out|Gate"
pass coverage the recorded cases ran 215 of the original's 227 lines (94%); never ran: src/index.ts: 105, 123-125, 129-131, 141-145
pass behavior 1115/1127 recorded cases match exactly, 12 more accepted as known differences
pass held-out 19 fresh and 100 perturbed inputs match the original (seed 473516518, 0.2s)
Gate passed.
$ node compare.mjs # the gated port against the original
ms("2hrs") original: 7200000 port: NaN
format(1500, {"long":true}) original: 2 seconds port: 2 second
The gate did say something. Its coverage line names the lines of the original that no recorded case ran, and lines 105, 123 to 125 and 129 to 131 are the case labels for months, minutes, minute, mins, seconds, second and secs. Five of our seven dropped spellings are in that list. The check still reports pass, because coverage is information and not a threshold.
The other two, yrs and hrs, are not in the list. In the original each sits in a run of case labels that fall through to one return. A recorded call with 2 years enters at the first label and runs down through the yrs label, so the line counts as run although no input ever spelled yrs.
The held-out check did not close the gap
The held-out check exists for this situation: a port that matches the recording and differs elsewhere. On this port it added little. With the default setting it ran three times on each of the 17 surviving bugs, 51 runs in all, and refused none.
We raised it from 50 to 2,000 inputs per function, which sent about 2,900 new inputs through both sides on each run. It refused one of the 17, the dropped secs spelling.
The reason is the shape of the inputs. The fresh half is generated values, and a generated string almost never spells hrs after a number. The other half changes one thing in a recorded call, such as one character of a string. That finds a port that memorised its answers, which is what the check is for. It rarely turns 2 hours into 2 hrs.
Its own self-test passed
rust-anything ships a command, rust-anything selftest, that plants cheating ports and checks that each one is refused by the check meant to refuse it. We ran it:
28 caught, 4 not caught (known gaps), 0 NOT CAUGHT, 0 unexpected; correct port passed.
Selftest passed.
That matches what the documentation reports, including the four gaps it lists itself. A hard-coded table of answers, a port that shells out to the original and an edited recording were all refused. So the two halves of the gate have different strengths. The checks against a port that fakes its answers held up in the project’s own test. The checks against a port that is honestly wrong in places are as good as the recording.
How to use it well
Install it with cargo install rust-anything or npm install -g rust-anything, run rust-anything setup to register it with your agent, and run rust-anything doctor to see which language toolchains it found. The project’s README has the full loop. Record on a copy of your project, since recording runs the original’s real code.
From what this test showed:
- Record from the original’s tests as well as generated inputs.
record --from-tests -- <your test command>caught four bugs here that the generated cases missed. - Treat the “never ran” list as work to do. The gate passes with unrun lines, and it names them. Five of our seventeen survivors were on that list.
- Do not read line coverage as input coverage. For every list of accepted values in the original, such as unit names, option values or flags, add one recorded input per value with
--inputs. Two dropped spellings passed on lines that counted as run. - Record the values on each side of every boundary. Lengths of 99, 100 and 101. The amount just below and just above a rounding or plural threshold.
- Record loosely typed options the way callers really pass them. If JavaScript callers pass
1or"yes"for a flag, record those. - Raise
--held-out-cases, and do not count on it. It is cheap and it caught one more bug here. It is built to catch memorised answers. - Read
known-diffs.jsonlin review. Each line is a case where the port is allowed to differ. Ours has twelve, and each needs a reason a reviewer accepts. Make that call yourself: in one study, people often went along with the choice an agent preferred. - Mutation-test the ports that matter. Plant bugs in the finished port and see what the gate lets through. Every survivor names an input that is missing from the recording. The harness in the download ran 100 mutants in about fifteen minutes.
What this test does not show
This is one small library and one port, both chosen by the tool’s author, with one version of the tool. A string-handling library with many accepted spellings is close to a worst case for generated inputs; numeric code would likely do better, as the arithmetic results here suggest. The planted bugs are single textual edits, and real porting mistakes are often larger and easier to catch. “No difference found” for twelve edits means none in the calls we tried. We did not run rust-anything go, so this says nothing about the quality of the ports an agent writes, about speed, or about the whole-application mode that records HTTP responses and side effects.
Run it yourself
The download holds the Dockerfile, the mutation harness, the comparison script, the three result files and the terminal output quoted above. Its README lists the commands to fetch ms and the published port at the commits we used. The core of it is:
rust-anything record rust/index-rs --inputs /work/all-inputs.jsonl
rust-anything gate rust/index-rs --accept-known-diffs 12 # must pass before mutating
python3 /work/harness/mutate.py # one line per planted bug
To use the harness on your own port, change the path of the crate and the list of edits at the top of mutate.py, and point differential.mjs at your original and your built module.