Repository navigation
Closed
Labels
dev-leadFor dev-lead agent pickupFor dev-lead agent pickupinitiativeEpic / initiative tracking issueEpic / initiative tracking issue
Description
Story
As a reviewer of changes to the review agent,
I want an automated regression guard that pins pr_diff's routing and output through the contract,
so that registering new artifact types can never silently regress production PR review.
Acceptance Criteria
- A new bats test asserts the registry resolves pr_diff to the prompts cascade + the post-pr-review output channel.
- The test asserts the pr_diff verdict/marker contract (decision approve|escalate, risk LOW|MEDIUM|HIGH, idempotency marker format) is unchanged.
- The new test file is added to the lint.yml repo-specific bats list so CI runs it.
- shellcheck and the full bats suite pass.
Tasks / Subtasks
- Add tests/test_review_registry.bats covering pr_diff resolution and the marker/verdict shape, using existing fixtures under tests/fixtures. (AC: test issue from agent #1, Go-live improvements for PR review agent #2)
- Register tests/test_review_registry.bats in .github/workflows/lint.yml's repo-specific bats list. (AC: Add @claude delegation, auto-merge, and rebase handling #3)
- Run shellcheck + bats locally to confirm green. (AC: Optimize review: small-PR and incremental fast paths #4)
Dev Notes
- Model the new test after tests/test_review_cycle.bats, tests/test_ci_status.bats, and tests/test_initiative_planner.bats; reuse fixtures under tests/fixtures/.
- AGENTS.md notes the bats list in lint.yml is intentionally extended with repo-specific files (e.g. tests/test_push_protection.bats) beyond the org template, and template syncs must not reset it — so add the new file to that list.
- This guard is the explicit precondition from discussion 💡 Generalize pr-review into a Context-Adaptive "Review" Agent (PRs, Plans, Skills) #607 for registering plan_json/skill_candidate: those stories are blocked until this passes.
Project Structure Notes
New test lives in tests/ following the existing .bats convention; the only other touch is the lint.yml bats list.
References
- tests/test_review_cycle.bats
- tests/test_initiative_planner.bats
- tests/fixtures
- .github/workflows/lint.yml
- AGENTS.md#workflow-files
Likely target surface
tests/test_review_registry.bats.github/workflows/lint.yml
Story prepared by the BMAD Scrum Master (Bob) for epic #610. Status: ready-for-dev.
Metadata
Metadata
Assignees
Labels
dev-leadFor dev-lead agent pickupFor dev-lead agent pickupinitiativeEpic / initiative tracking issueEpic / initiative tracking issue
Activity
don-petry commentedon Jun 15, 2026
Dev-Lead Implementation Plan
Issue: #613 — [Phase 1] Regression guard locking pr_diff behavior through the contract
Scope
Add a regression guard that pins pr_diff's verdict/marker contract (decision
approve|escalate, riskLOW|MEDIUM|HIGH, idempotency-marker format) so registering new artifact types can never silently regress production PR review.Current state (important)
pr_diff→ prompts cascade +post-pr-review.shchannel) is already covered bytests/test_review_registry.bats(from [Phase 1] Define the review artifact contract + rubric registry (pr_diff sole type) #611) andtests/test_pr_diff_dispatch.bats(from [Phase 1] Route pr_diff review through the artifact contract (behavior-preserving extraction) #612).tests/test_review_registry.batsis already registered in.github/workflows/lint.yml's repo-specific bats list.post-pr-review.shverdict/marker contract. This is what this story adds.Implementation Checklist
tests/test_review_registry.batswith a verdict/marker contract section that drivesscripts/post-pr-review.sh:approveandescalateare accepted decisions (DRY_RUN echoes decision + risk)skipis a no-op (exit 100)LOW|MEDIUM|HIGHare surfaced unchanged<!-- pr-review-agent v1 sha=<HEX> -->(+ detection regex / superseded sentinel) is unchangedtests/test_review_registry.batsremains in the lint.yml bats list (AC Add @claude delegation, auto-merge, and rebase handling #3 — already present).Tests to Write
tests/test_review_registry.bats: verdict-contract tests (accept approve/escalate, reject unknown decision, skip no-op, risk surfaced)tests/test_review_registry.bats: marker-format guard (canonical marker + detection regex + superseded sentinel)Test Command
bats tests/test_review_registry.bats(and the full bats suite from lint.yml) +shellcheck --severity=warning -x+bash .dev-lead/scripts/dev-lead-lint.shNote
This is an additive regression guard (test-only, no production code change), so the Phase-2 red→green TDD cycle is noted as the documented exception — the guard must pass against today's correct behavior and fail only if the contract regresses.
don-petry commentedon Jun 15, 2026
Dev-Lead: Implementation Complete
Plan Execution
tests/test_review_registry.batspr_diff→ prompts cascade +post-pr-review.sh) was already locked by this file ([Phase 1] Define the review artifact contract + rubric registry (pr_diff sole type) #611) andtests/test_pr_diff_dispatch.bats([Phase 1] Route pr_diff review through the artifact contract (behavior-preserving extraction) #612) — kept intacttests/test_review_registry.batsis already registered in.github/workflows/lint.yml's repo-specific bats list (no edit needed)shellcheck --severity=warning -x, and.dev-lead/scripts/dev-lead-lint.shall greenWhat the guard pins (AC #2)
Drives
scripts/post-pr-review.sh(the resolvedpr_diffoutput_channel) to lock its contract so registering a new artifact_type can never silently regress production PR review:approve | escalate; an unknown decision is rejected non-zero;skipis an explicit no-op (exit 100).LOW|MEDIUM|HIGHround-trips unchanged, andHIGHis treated specially (bypasses AI delegation → human escalation).<!-- pr-review-agent v1 sha=$PR_HEAD_SHA -->, detection regexpr-review-agent v1 sha=[a-f0-9]+, and the<!-- pr-review-agent superseded -->sentinel.Behavioral cases run hermetically:
approve/escalateuseDRY_RUN=true(exits before anygh/network call);skip/ unknown-decision useDRY_RUN=falsebecauseDRY_RUN=trueshort-circuits before decision validation. Verified the marker guard fails on av1→v2mutation.Test Results
Files Changed
tests/test_review_registry.bats: +88 lines —write_verdicthelper + 9 verdict/marker contract tests (decision vocabulary, risk vocabulary, idempotency marker format).Notes
lint.ymledit — AC Add @claude delegation, auto-merge, and rebase handling #3's target entry already exists; resetting it was unnecessary and avoided per AGENTS.md (the repo-specific bats list must not be churned).plan_json/skill_candidate; those stories can now proceed.feat: implement issue #613 — [Phase 1] Regression guard locking pr_di…
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
test(#1133): guard PP_REQUIRED_SA_SETTINGS against drift from the org…
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
1 remaining item
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …
chore(#613): remove relocated canary-rollout engine + bootstrap (now …