Meta writes a test for each risky change, then throws it away
Every night, Meta has AI models write fresh tests aimed at the previous day's riskiest code changes. A test that fails on the change is evidence of a bug, and only the strongest cases reach an engineer.
ContextMost AI code review leaves comments for a person to judge. Meta's approach produces a failing test instead, which shows the behaviour change directly.
Meta calls them Catching JiTTests, for just-in-time tests. They run overnight on spare machines, against changes submitted the day before that a risk model marks as risky. The tests are written for that one change and are not kept in the test suite.
There are two ways in. One treats the change itself as a possible bug and looks for any behaviour that differs from the code before it. The other has a model guess what the change is meant to do, list how it could go wrong, plant those mistakes as small variants of the code, and write tests that tell them apart. Tests that fail on the real change become candidates.
Most candidates are false alarms, so a panel of AI models judges each one, and a rule-based checker gives a second, deterministic verdict. Only the highest ranked go to the engineer who wrote the change, who mostly answers one question: did you mean the behaviour to change?
Meta reports 589 engineers engaged with the alerts (64% of those contacted), a 60% true-positive rate by their judgment, and 74 serious privacy bugs caught before release in the first half of 2026, when privacy incidents fell 20%. The paper was presented at FSE 2026.
74serious privacy bugs caught before release, first half of 2026 (Meta-reported)
Technical details
The two workflows are called dodgy diff and intent-aware. The intent-aware one reads the diff, its title and summary, describes the risks in text, and turns each risk into a mutant that still passes the existing tests. Tests that kill those mutants and fail on the real diff are called weak catches.
Risky diffs are picked with a model similar to Meta's Diff Risk Score, trained on past changes. The false-positive filter pairs an ensemble of LLM judges, which is not deterministic, with RubFake, a rule-based environment that is.
Meta frames this as human on the loop rather than in the loop: engineers set the criteria and review results in aggregate, and rarely read the generated test code.
Why it mattersIt turns AI review from opinions into evidence a person can check in seconds. The parts (pick risky changes, generate tests, filter hard, show only the best) work at any team size.
For youCopy the shape for agent-written PRs in the SaaS repos: a nightly job where Claude Code writes throwaway tests against yesterday's riskiest diffs and reports only tests that fail on the change. Start with the intent-aware prompt.
- mutants
- Copies of the code with a small deliberate mistake planted in them, used to check whether tests notice.
- true-positive rate
- The share of alerts that turned out to be real problems.
- FSE
- The ACM conference on the Foundations of Software Engineering, a major research venue.