feat: enforce review gate at backlog→todo transition #218
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/claude-custom!218
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "214-backlog-todo-gate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Extends
check-board-advance.shto gate backlog→todo in addition to the existing todo→next_up gate. "TODO MUST ALWAYS MEAN REVIEWED" — items cannot move from backlog to todo without a/review-ticketAPPROVED verdict. The todo→next_up gate remains as belt-and-suspenders for dependency scoping.Changes
hooks/check-board-advance.sh— Extended bothupdate_board_itemandbulk_move_board_itemsroutes to detect and gate backlog→todo transitions using the existingcheck_review_approvedhelper. Deny messages now include the specific gate name (e.g., "backlog→todo" or "todo→next_up"). Updated header comments to document both gates.tests/test_check_board_advance.sh— Added 9 new tests (Tests 21-29) covering the backlog→todo gate: single item deny/allow, NOT APPROVED regression, same-column no-op (todo→todo), bulk move deny/allow, mixed gates (backlog→todo + todo→next_up simultaneously), multiple backlog items, and blocks-based verdict. Updated mock board data with backlog items (id 60, 70). Updated Test 2 to accurately describe fail-open behavior. All 34 tests pass.Test Plan
bash tests/test_check_board_advance.sh— 34 passed, 0 failedupdate_board_itemmoving backlog→todo without review note — blockedupdate_board_itemmoving backlog→todo with APPROVED review — allowedReview Checklist
Related Notes
Related
QA Review: PR #218
Scope Verification
hooks/check-board-advance.sh,tests/test_check_board_advance.sh)Code Quality
Hook logic (
check-board-advance.sh)update_board_itemandbulk_move_board_itemsroutes to gate backlog→todo alongside existing todo→next_upcheck_review_approvedhelper reused without modification (good)backlog→todoortodo→next_up) -- actionable for the agentEdge cases handled:
Tests (
test_check_board_advance.sh)Nits
Test Results
VERDICT: APPROVED
PR #218 Review
DOMAIN REVIEW
Tech Stack: Bash hooks + Bash test framework with Python mock HTTP server.
Correctness Analysis:
Does the new backlog->todo gate correctly reuse the existing
check_review_approvedhelper?Yes. The
check_review_approvedfunction (lines 46-77 on main) is completely untouched by this PR. Both theupdate_board_itemroute (line 116) and thebulk_move_board_itemsroute (line 171) already called it; those call sites remain structurally identical post-change. The helper searches forreview-{item_id}-*notes and checks body + blocks for APPROVED (excluding NOT APPROVED). This works equally well for backlog->todo and todo->next_up gates since the review note convention is item-based, not column-based. Clean reuse.Does it handle both
update_board_itemandbulk_move_board_itemsroutes?Yes, both routes are updated symmetrically:
update_board_item: Target column check broadened from!= "next_up"to!= "todo" && != "next_up". Then aGATEDvariable determines the specific transition (backlog->todoortodo->next_up). IfGATEDis empty, the hook allows.bulk_move_board_items: Filter broadened from.column == "next_up"to.column == "todo" or .column == "next_up". Per-item loop now looks upTARGET_COLfrom the move request and applies the sameGATEDlogic. Gate name is appended to blocked items for the deny message.Does it NOT break the existing todo->next_up gate?
No breakage. The gated transition logic explicitly handles
todo->next_upas a named case alongsidebacklog->todo. Tests 11-20 (the original deny/allow suite) are completely unchanged in the diff. Theelifbranch fortodo->next_uppreserves the prior behavior exactly.Test coverage for the 9 new tests (Tests 21-29):
The coverage is thorough. Tests 21-23 mirror 11-13 (deny/allow/NOT APPROVED regression) for the new gate. Test 24 is a critical edge case. Tests 25-28 cover bulk operations including the mixed-gate scenario. Test 29 confirms blocks-based verdict works for the new gate just as Test 18 does for the existing gate.
Test 2 Update: The original Test 2 ("move to todo, not next_up") was subtly misleading -- with the new code, moving to
todoIS now a gated column, but without a mock API the hook fails open. The updated test honestly names this as "fail-open" behavior with an explicitly unreachable API URL (http://127.0.0.1:1). This is a good correction that makes the test contract clearer.Deny message improvement: Gate names (
backlog->todo,todo->next_up) are now included in deny messages. Tests 21 and 27 explicitly verify these gate names appear. This improves actionability for agents receiving the deny.BLOCKERS
None.
check_review_approvedis reused, not duplicatedNITS
Test 6 description stale: Test 6 says "bulk_move with no next_up targets" but now
todois also a gated column. The test still passes correctly (items targetin_progress/donewhich are not gated), but the description could be updated to "bulk_move with no gated column targets" for consistency with the new terminology. Non-blocking since the test logic is correct.Mock board data comment: The comment on the board items in the mock setup says items 60 and 70 are in "backlog" but the fixture file at
/home/ldraney/claude-custom/tests/test_check_board_advance.shline 57 still references the old count in the description ("Board items: item 42..."). The diff correctly updates this, so this is addressed.SOP COMPLIANCE
214-backlog-todo-gatefollows{issue-number}-{kebab-case-purpose}PROCESS OBSERVATIONS
trap 'exit 0' ERR) means even if the new gate logic has an edge case bug, it degrades to "allow" rather than blocking agents. The 34 tests provide strong regression coverage.GATEDvariable in both routes) is a clean way to add gates without duplicating the transition-detection logic. Adding a third gate in the future would be a 3-line change.VERDICT: APPROVED