fix(review): plan dedup ranks a merged pair by what rule B counts, so reviewer order never lowers a blocker

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-10-16 16:46:10 +02:00
commit e8ea98747d
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
4 changed files with 166 additions and 47 deletions

View file

@ -16,6 +16,10 @@
# (exit 0, REVISE); the bare gate exits 1 with PLAN_GATE_OPEN_MAJOR.
# 8. git status --porcelain --untracked-files=all lists no snapshot; the
# round-1 snapshot file exists under .git/voyage/plan-snapshots/.
# 9. Round 3 (plan unchanged, counted fully): a minor merged with its copy
# that claims a lowering from blocker, and a minor with a lowered_from
# that is not a severity (exit 0, BLOCK, two blockers); the bare gate
# exits 1 with PLAN_GATE_OPEN_BLOCKER.
# Prints "e2e: ok" and exits 0, or names the failed check and exits 1.
# bash 3.2 compatible, ASCII only.
@ -144,5 +148,21 @@ echo "$st" | grep -q 'plan-snapshots' && fail "git status lists a snapshot: $st"
[ "$st" = '?? plan.md' ] || fail "git status lists more than the plan: $st"
[ -f "$REPO/.git/voyage/plan-snapshots/$H1.md" ] || fail "no round-1 snapshot under .git/voyage/plan-snapshots/"
# ---- 9. round 3: a refused and a malformed lowering reach the gate as blockers ----
M9='Step 1 never names the exit code its verify command expects'
G9='The revert for step one is never run against a dirty tree'
printf '{"plan_critic":{"findings":[{"file":"plan.md","line":%s,"rule_key":"step-quality","severity":"minor","text":"%s"}]},"scope_guardian":{"findings":[{"file":"plan.md","line":%s,"rule_key":"step-quality","severity":"minor","lowered_from":"blocker","caught_by":"npm test","text":"%s"},{"file":"plan.md","line":%s,"rule_key":"gap","severity":"minor","lowered_from":"high","caught_by":"npm test","text":"%s"}]}}\n' \
"$L1" "$M9" "$L1" "$M9" "$LO" "$G9" > "$TMP/r3.json"
out="$(round "$TMP/r3.json")"
rc=$?
[ "$rc" -eq 0 ] || fail "9: round 3 --record: exit $rc, expected 0: $out"
echo "$out" | grep -q '"verdict":"BLOCK"' || fail "9: round 3 is not BLOCK: $out"
echo "$out" | grep -q '"blocker":2' || fail "9: round 3 does not count two blockers: $out"
out="$(gate plan.md)"
rc=$?
[ "$rc" -eq 1 ] || fail "9: the bare gate exit $rc, expected 1: $out"
echo "$out" | grep -q 'PLAN_GATE_OPEN_BLOCKER' || fail "9: no PLAN_GATE_OPEN_BLOCKER in: $out"
echo "e2e: ok"
exit 0