# Meta uses JiTTests to generate failing tests that catch bugs before code lands

> Original title: 代码合入前抓住缺陷：Meta 用 JiTTests 生成会失败的测试，并让工程师在流程里把关

- Source: meng shao
- Published: 2026-11-10T02:21:04.000Z
- Bad Influence: https://badinfluence.news/items/hnpha9s6sjb550c89sw6sf3ub
- Original: https://x.com/shao__meng/status/2119978619196084717

## Summary

Meta's JiTTests uses LLMs to generate tests that fail on new code changes and pass on parent versions, surfacing behavioral differences before merge. Meta says engineers report about a 60% true-positive rate and that the system helped catch 74 privacy SEVs at the diff stage in the first half of 2026, lowering overall privacy SEV occurrence by about 20%. The post notes the 60% figure comes from participants' feedback and the 20% from Meta's own comparison, with no independently checkable controlled experiment provided.

## Post

代码合入前抓住缺陷：Meta 用 JiTTests 生成会失败的测试，并让工程师在流程里把关

不靠更快地审代码，而是生成会失败的测试

多数 AI 查错像加速版人工评审。JiTTests 针对尚未合入的代码变更，自动生成可执行测试，故意让它在新版本上失败、在父版本上通过，把行为差异摊开。系统夜间用空闲算力跑，并按类似 Diff Risk Score 的机制，优先处理前一天的高风险变更。

两条工作流并行。一条把每次改动都当成变异，生成能区分新旧行为的测试，不推断作者意图；另一条则根据代码、标题和摘要推断意图与风险，再构造变异、生成测试，并在真实变更上运行。先得到「弱捕获」，也就是测试失败了；再从中筛出真正指向缺陷的「强捕获」。论文称，在大约 22,126 个生成测试上，这种感知变更的方法，弱捕获大约是传统测试加固的 4 倍、偶然失败测试的 20 倍。

Meta 自报的过滤与效果

失败测试里误报很多。系统用规则工具 RubFake，再加上多个大模型组成的评判团来排序。论文写，在 600 个出现弱捕获的变更上，评判团大约把人工审阅负担降了 70%。流程需要工程师把关：人来定标准、看汇总，通常只需确认行为变化是否符合预期。

论文记录的是初期触达：向工程师报告 41 个候选，8 个被确认为真阳性，大约 19.5%，其中 4 个若未拦截可能导致严重故障。博客给出更晚的生产口径：589 名工程师参与过（占被触达者的 64%），他们报告真阳性率约 60%；2026 年上半年，系统在变更合入前帮助捕获 74 起严重隐私事故，并使同期这类事故的总体发生率下降约 20%。60% 来自已参与者的反馈，20% 是公司自己的对比口径，文中没有给出可独立核对的对照实验。

https://engineering.fb.com/2026/10/29/security/catching-bugs-before-they-land-jittestings-human-on-the-loop-approach-at-full-scale/

![](https://badinfluence.news/api/img-proxy?u=https%3A%2F%2Fpbs.twimg.com%2Fmedia%2FHWutT6aasAA4Pxh.jpg&mode=thumb&exp=1795651200&sig=ae3bdd0f94a448bb)

## Quoted post @Meta_Engineers

> 🧠 Most AI bug-catching tools review your code the way a human reviewer would, only faster. What if the AI wrote a test that proved the bug instead?
> 
> That’s Catching Just-in-Time Tests (JiTTests) — a novel approach where LLMs generate executable tests designed to fail, surfacing behavioral changes in a code change before it lands.
> 
> After a year of research, it’s now part of Meta’s infrastructure.
> 
> ✅ 589 engineers have engaged with it, reporting a 60% true-positive rate
> 
> 📈 In the first half of 2026, it helped catch 74 privacy SEVs at the diff stage, lowering overall privacy SEV occurrence by 20%
> 
> 🔗 Read how it works: https://engineering.fb.com/2026/10/29/security/catching-bugs-before-they-land-jittestings-human-on-the-loop-approach-at-full-scale/
> 
> 📄 Read our FSE 2026 paper, “Just-in-Time Catching Test Generation at Meta”: https://arxiv.org/pdf/2601.22832
> 
> #AI #SoftwareEngineering #SoftwareTesting #DeveloperTools #Engineering

https://x.com/Meta_Engineers/status/2119829872738714070
