Freeze a Bisect SHA and Public API Before an OSS Patch Review
说明与用途
冻结 bisect SHA 和公共 API 快照将模型的更改限制在最小的失败更改集内,防止范围蔓延,确保补丁仅解决预期的错误。
问题
When a model generates a patch for an OSS bug, it often adds unrelated changes—extra files, new public APIs, or style tweaks—causing scope creep and downstream breakage.
结果
By freezing the bisect SHA and public API snapshot, the model’s edits are bounded to the minimal failing change set, eliminating scope creep and ensuring the patch addresses only the intended bug.
工作流
- Clone the repository at the reporter’s tag and run the failing test to confirm the bug.
- Run
git bisectto locate the first bad commit, outputting the SHA toFIRST_BADand the list of allowed files toallowed_files.txt. - Snapshot the public names on the bad tree with
tools/api_snapshot.py, saving toapi.snap.bad. Copyapi.snap.badbesideFIRST_BAD. Createpatch_contract.yamlwith the SHA, allowed files, forbidden changes, required tests, and the snapshot file. Attach the contract to the review prompt and instruct the model to obey it. After the model generates a patch, verify the diff only touches allowed files and the snapshot byte‑for‑byte matchesapi.snap.bad. - Review the patch, ensuring no new public names, modules, or dependency bumps were added.
- Merge the patch if all constraints are satisfied.
证据
The first artifact is a git bisect SHA. The second is a snapshot of public names.
Allowed_files comes from the bisect file list. A model does not extend that list.
- 记录日期: 2026-09-21T12:30:23.742Z