Pin the Broken Input: Characterization Tests Before an OSS Parser Patch
说明与用途
添加最小化的测试用例和特征化测试,将隐藏的回归转变为可重现的问题,使审查者能够根据冻结的行为验证更改。
问题
A green test suite can miss regressions when a patch fixes only the happy path and the failing input is not represented in tests, leading to silent behavior changes in production.
结果
Adding a minimal failing fixture and a characterization test turned a silent regression into a reproducible, reviewable issue, ensuring future patches cannot drift the observed behavior.
工作流
- 1. Minimize the failing input and store it as a fixture in tests/fixtures/
- 2. Write a characterization test that fails for the correct reason and runs against the default branch
- 3. Freeze the public contract beside the test in a contract file
- 4. Patch only the minimal code needed to make the characterization test pass
- 5. Review the diff against the frozen failure, not against style
证据
The local suite stayed green because every fixture used short fields without embedded line breaks.
A characterization test should name the behavior under dispute, not the implementation the contributor hopes to land.
- 记录日期: 2026-09-15T01:15:24.337Z