test: cover ambiguous hunk id error path#84
Conversation
A single hex-char prefix that matches more than one hunk hits the 'ambiguous hunk id' branch in _find_hunks_by_ids, which had no coverage. Pigeonhole on the first hex char of 20 hunk ids guarantees a collision.
Finalized. Single clean commit adding an integration test for the ambiguous hunk-id error path; drives the real CLI, no mocks. Pigeonhole reasoning (20 hunks > 16 hex chars) soundly guarantees a single-char prefix collision, and the test asserts both the non-zero exit with
Verdict: recommend-merge. |
Verdict: Reviewed at medium effort (correctness + conventions). The PR adds a single, well-scoped e2e test covering the ambiguous-hunk-id rejection path on
Branch is fully current with |
_find_hunks_by_idsraisesambiguous hunk id '<prefix>'when a partial idmatches more than one hunk, but that branch had no test. This adds an e2e test
that provokes it: with more than 16 hunks, two ids must share a leading hex
char (pigeonhole over the 16 possible hex digits), so a single-char prefix is
ambiguous. The test finds such a prefix, stages it, and asserts the error fires
and nothing is staged.
Test plan
uv run pytest tests/e2e/error_test.py::test_ambiguous_hunk_id_rejectedmake test(246 passed)make lint