Lock the Golden Files. Split Agent Diffs That Touch the Answers
说明与用途
使用 lockfile 和 split‑diff 规则保护金丝雀文件,防止 CI 循环检查,需人工批准更改。
问题
Agent‑generated PRs can rewrite both code and golden files, causing tests to pass while the spec moves with the implementation, creating a tautology.
结果
Golden files are now immutable during agent PRs, preventing circular tests and ensuring that only human‑approved changes update expected outputs.
工作流
- 1. Inventory all golden file paths and generate fixtures.manifest.
- 2. Generate fixtures.lock from a trusted main branch using scripts/write_fixture_lock.py.
- 3. In PRs, enforce split‑diff rule: source only or goldens only, not both unless fixtures:allow label is present.
- 4. CI merge job recomputes hashes; if fixtures.lock mismatches and PR not allowed to edit goldens, fail the check.
- 5. Human reviewer inspects diff, applies fixtures:allow if needed, updates lockfile in a separate commit, and re‑runs CI.
证据
If rule 2 fires, the PR stays open. A person inspects the bytes, applies the label, updates the lock in a visible commit, and re‑runs the check.
- 记录日期: 2026-09-22T04:45:43.776Z