feat(task): done-evidence gate — block move→done when PR not merged#250
Merged
Conversation
When a task has VCS links and an agent moves it to done, MoveTask now verifies that every linked PR is either merged or closed. An open PR blocks with 422 done_evidence_required + message naming the PR. If the task has no VCS links at all, falls back to the same standard check as the review-gate: at least one artifact or comment is required. System actors (auto_transition) are fully exempt so subtask cascades are unaffected. Changes: - internal/service/task_service.go: vcsLinkRepo field + WithVCSLinkRepoTask option + done-gate block in MoveTask + DoneEvidenceError type - internal/handler/task_handler.go: map DoneEvidenceError → 422 done_evidence_required - cmd/api/main.go: wire WithVCSLinkRepoTask(vcsLinkRepo) - internal/service/mock_repos_test.go: MockVCSLinkRepository - internal/service/task_service_test.go: 8 done-gate tests (all pass) Resolves: #2697392d — scope-extension from Riker comment on #381a8d25 Co-Authored-By: Garfield Stoun <garfieldstoun@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
service.MoveTasknow checks VCS link state when an agent transitions a task todoneopen(not merged or closed) → 422done_evidence_requiredwith the PR title in the messageauto_transition, subtask cascades) are fully exemptDoneEvidenceError→{"code":"done_evidence_required","message":"..."}(same pattern as review-gate)Test plan
TestTaskService_MoveTask_DoneGate_BlockedWhenPROpen— open PR → 422TestTaskService_MoveTask_DoneGate_PassesWhenPRMerged— merged PR → passTestTaskService_MoveTask_DoneGate_PassesWhenPRClosed— closed PR → passTestTaskService_MoveTask_DoneGate_CommitLinkDoesNotBlock— commit link → pass (only PR-type gated)TestTaskService_MoveTask_DoneGate_SystemActorExempt— system actor + open PR → passTestTaskService_MoveTask_DoneGate_NoVCSLinks_BlockedWhenNoEvidence— no VCS, no artifact, no comment → 422TestTaskService_MoveTask_DoneGate_NoVCSLinks_PassesWithArtifact— artifact → passTestTaskService_MoveTask_DoneGate_NoVCSLinks_PassesWithComment— comment → passAll pre-push checks green (full suite).