Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

The Diff Budget: Four Checks Before Merging an AI-Generated Refactor

说明与用途

一种逐步流程,使用特征化测试套件和 diff_budget.sh 脚本,将重构委托给 AI,限制更改仅在单个文件内、≤50 行且不包含行为信号标记,确保安全性。

问题

AI‑generated refactors can produce large, unsafe diffs that change behavior or touch too many files, making manual review costly and error‑prone.

结果

The workflow guarantees that AI‑generated refactors are small, scoped, and behavior‑preserving, reducing manual review effort and preventing regressions.

工作流

  • Write a characterization test suite that emits a transcript.txt
  • Run the suite and copy its output to golden.txt
  • Slice the refactor into a single transformation per prompt
  • Ask the LLM for a diff, providing only the test suite and a concise prompt
  • Apply the diff and run diff_budget.sh
  • If any check fails, revise the prompt and repeat until all checks pass

证据

The diff budget: four checks that turn "small and safe" into a script.

来源

Write the characterization suite. Make it emit transcript.txt with sorted rows and a pinned locale.

来源

The gate proves nothing observable changed. It does not prove the new structure is good.

来源

  • 记录日期: 2026-09-05T17:09:59.438Z