feat: gate reviewer mutations on canonical workflow load proof (Closes #389) #392

Closed
jcwalker3 wants to merge 0 commits from feat/issue-389-review-workflow-load-proof into master
Owner

Summary

Closes #389.

Reviewer mutations previously depended on prompt compliance to load review-merge-pr.md. This PR adds mutation-time enforcement: gitea_load_review_workflow records in-process workflow/schema hashes, and gitea_submit_pr_review, gitea_mark_final_review_decision, and gitea_merge_pr fail closed without valid session proof.

Changes

  • review_workflow_load.py — workflow/schema hashing, session proof, prompt-conflict detection, recovery handoff lines (no approve/merge replay)
  • gitea_mcp_server.py — new gitea_load_review_workflow MCP tool; gates on reviewer mutations; workflow_load_proof on gitea_resolve_task_capability (review/merge tasks) and gitea_get_runtime_context; clears proof on new review_pr resolve
  • Tests: tests/test_review_workflow_load.py (10 cases) + reviewer test harness updates

Validation

Working directory: branches/issue-389-review-workflow-load-proof

venv/bin/python -m pytest tests/test_review_workflow_load.py tests/test_mcp_server.py::TestSubmitPrReview tests/test_mcp_server.py::TestMergePR tests/test_permission_reports.py tests/test_llm_agent_sha.py -q

Result: 52 passed (targeted)

Worktree

  • Path: branches/issue-389-review-workflow-load-proof
  • Branch: feat/issue-389-review-workflow-load-proof
  • Commit: 8a8cffb
## Summary Closes #389. Reviewer mutations previously depended on prompt compliance to load `review-merge-pr.md`. This PR adds mutation-time enforcement: `gitea_load_review_workflow` records in-process workflow/schema hashes, and `gitea_submit_pr_review`, `gitea_mark_final_review_decision`, and `gitea_merge_pr` fail closed without valid session proof. ## Changes - `review_workflow_load.py` — workflow/schema hashing, session proof, prompt-conflict detection, recovery handoff lines (no approve/merge replay) - `gitea_mcp_server.py` — new `gitea_load_review_workflow` MCP tool; gates on reviewer mutations; `workflow_load_proof` on `gitea_resolve_task_capability` (review/merge tasks) and `gitea_get_runtime_context`; clears proof on new `review_pr` resolve - Tests: `tests/test_review_workflow_load.py` (10 cases) + reviewer test harness updates ## Validation Working directory: `branches/issue-389-review-workflow-load-proof` ``` venv/bin/python -m pytest tests/test_review_workflow_load.py tests/test_mcp_server.py::TestSubmitPrReview tests/test_mcp_server.py::TestMergePR tests/test_permission_reports.py tests/test_llm_agent_sha.py -q ``` Result: **52 passed** (targeted) ## Worktree - Path: `branches/issue-389-review-workflow-load-proof` - Branch: `feat/issue-389-review-workflow-load-proof` - Commit: `8a8cffb`
jcwalker3 added 1 commit 2026-07-07 08:58:41 -05:00
Add gitea_load_review_workflow and in-process session proof required before
gitea_submit_pr_review, gitea_mark_final_review_decision, and gitea_merge_pr.
Capability and runtime context report workflow-load status; stale or missing
proof fails closed with recovery handoff text that forbids approve/merge replay.
sysadmin requested changes 2026-07-07 10:13:15 -05:00
Dismissed
sysadmin left a comment
Owner

Validation failed. The new workflow-load gate correctly fails closed when no workflow load proof is present, but it breaks 13 existing test cases across tests/test_audit.py, tests/test_permission_reports.py, tests/test_pr_queue_inventory.py, and tests/test_terminal_review_hard_stop.py. These tests need to be updated to load the workflow in their setup (e.g. using a conftest fixture or calling gitea_load_review_workflow) so the test suite passes cleanly. Please update the tests.

Validation failed. The new workflow-load gate correctly fails closed when no workflow load proof is present, but it breaks 13 existing test cases across tests/test_audit.py, tests/test_permission_reports.py, tests/test_pr_queue_inventory.py, and tests/test_terminal_review_hard_stop.py. These tests need to be updated to load the workflow in their setup (e.g. using a conftest fixture or calling gitea_load_review_workflow) so the test suite passes cleanly. Please update the tests.
sysadmin added 1 commit 2026-07-07 12:05:21 -05:00
sysadmin requested changes 2026-07-07 12:13:09 -05:00
Dismissed
sysadmin left a comment
Owner

Validation failed. Running the full test suite (pytest) in the review worktree yields 13 failed test cases. These tests fail with AssertionError: False is not true : ['gitea_load_review_workflow has not been called in this session...']. The test cases need to be updated to load the workflow in their setup (e.g. via a conftest fixture or by explicitly calling gitea_load_review_workflow) so the test suite passes cleanly.

Failing test cases:

  • tests/test_audit.py::TestGatedToolAudit::test_merge_blocked_audited
  • tests/test_audit.py::TestGatedToolAudit::test_merge_success_audited
  • tests/test_audit.py::TestGatedToolAudit::test_submit_review_success_audited
  • tests/test_permission_reports.py::TestEligibilityDenialReport::test_merge_tool_denial_propagates_report
  • tests/test_pr_queue_inventory.py::TestPRQueueInventory::test_reviewer_profile_can_proceed_from_inventory_to_review_gates
  • tests/test_terminal_review_hard_stop.py::TestMergeHardStopWiring::test_merge_blocked_after_request_changes
  • tests/test_terminal_review_hard_stop.py::TestMergeHardStopWiring::test_merge_of_other_pr_blocked_after_approve
  • tests/test_terminal_review_hard_stop.py::TestMarkFinalHardStopWiring::test_mark_ready_blocked_after_terminal_mutation
  • tests/test_terminal_review_hard_stop.py::TestDuplicateRequestChangesSuppression::test_approve_does_not_fetch_feedback
  • tests/test_terminal_review_hard_stop.py::TestDuplicateRequestChangesSuppression::test_duplicate_request_changes_blocked_at_same_head
  • tests/test_terminal_review_hard_stop.py::TestDuplicateRequestChangesSuppression::test_request_changes_allowed_when_no_blocker
  • tests/test_terminal_review_hard_stop.py::TestDuplicateRequestChangesSuppression::test_request_changes_allowed_when_prior_blocker_stale
  • tests/test_terminal_review_hard_stop.py::TestDuplicateRequestChangesSuppression::test_request_changes_fails_closed_when_feedback_unavailable
Validation failed. Running the full test suite (`pytest`) in the review worktree yields 13 failed test cases. These tests fail with `AssertionError: False is not true : ['gitea_load_review_workflow has not been called in this session...']`. The test cases need to be updated to load the workflow in their setup (e.g. via a conftest fixture or by explicitly calling `gitea_load_review_workflow`) so the test suite passes cleanly. Failing test cases: - `tests/test_audit.py::TestGatedToolAudit::test_merge_blocked_audited` - `tests/test_audit.py::TestGatedToolAudit::test_merge_success_audited` - `tests/test_audit.py::TestGatedToolAudit::test_submit_review_success_audited` - `tests/test_permission_reports.py::TestEligibilityDenialReport::test_merge_tool_denial_propagates_report` - `tests/test_pr_queue_inventory.py::TestPRQueueInventory::test_reviewer_profile_can_proceed_from_inventory_to_review_gates` - `tests/test_terminal_review_hard_stop.py::TestMergeHardStopWiring::test_merge_blocked_after_request_changes` - `tests/test_terminal_review_hard_stop.py::TestMergeHardStopWiring::test_merge_of_other_pr_blocked_after_approve` - `tests/test_terminal_review_hard_stop.py::TestMarkFinalHardStopWiring::test_mark_ready_blocked_after_terminal_mutation` - `tests/test_terminal_review_hard_stop.py::TestDuplicateRequestChangesSuppression::test_approve_does_not_fetch_feedback` - `tests/test_terminal_review_hard_stop.py::TestDuplicateRequestChangesSuppression::test_duplicate_request_changes_blocked_at_same_head` - `tests/test_terminal_review_hard_stop.py::TestDuplicateRequestChangesSuppression::test_request_changes_allowed_when_no_blocker` - `tests/test_terminal_review_hard_stop.py::TestDuplicateRequestChangesSuppression::test_request_changes_allowed_when_prior_blocker_stale` - `tests/test_terminal_review_hard_stop.py::TestDuplicateRequestChangesSuppression::test_request_changes_fails_closed_when_feedback_unavailable`
jcwalker3 added 1 commit 2026-07-07 12:24:54 -05:00
jcwalker3 added 1 commit 2026-07-07 16:34:45 -05:00
Merge current prgs/master into feat/issue-389-review-workflow-load-proof.
Combine workflow-load session proof (#389) with reviewer PR lease test
fixtures from #407 so reviewer mutation gates remain fully tested.
Author
Owner

pr: #392
branch: feat/issue-389-review-workflow-load-proof
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/fix-pr392-conflicts
profile: prgs-author
session_id: unknown
phase: claimed
head_before: 2c47208b0d
expires_at: 2026-07-08T08:18:03Z
reviewer_active: no

<!-- mcp-conflict-fix-lease:v1 --> pr: #392 branch: feat/issue-389-review-workflow-load-proof worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/fix-pr392-conflicts profile: prgs-author session_id: unknown phase: claimed head_before: 2c47208b0d8307845bf708ddd44d91d425455a66 expires_at: 2026-07-08T08:18:03Z reviewer_active: no
jcwalker3 added 1 commit 2026-07-08 01:18:13 -05:00
Merge prgs/master into feat/issue-389-review-workflow-load-proof and
preserve workflow-load gates while adopting master test harness patterns
(_seed_ready_review_decision, reviewer leases, expected_head_sha).
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #392
issue: none
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 98052-ac5792812534
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr392
phase: claimed
candidate_head: 685e627984
target_branch: master
target_branch_sha: none
last_activity: 2026-07-08T06:25:48Z
expires_at: 2026-07-08T08:25:48Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #392 issue: none reviewer_identity: sysadmin profile: prgs-reviewer session_id: 98052-ac5792812534 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr392 phase: claimed candidate_head: 685e627984a6476ca644ba14cb2987bf3b0abe44 target_branch: master target_branch_sha: none last_activity: 2026-07-08T06:25:48Z expires_at: 2026-07-08T08:25:48Z blocker: none
sysadmin requested changes 2026-07-08 01:25:55 -05:00
sysadmin left a comment
Owner

PR #392 is superseded by PR #422.
PR #422 is the canonical candidate for this workflow-load direction.
PR #392 should not merge independently.
If the author disagrees, they must explain what unique, non-duplicated value remains in PR #392.

PR #392 is superseded by PR #422. PR #422 is the canonical candidate for this workflow-load direction. PR #392 should not merge independently. If the author disagrees, they must explain what unique, non-duplicated value remains in PR #392.
sysadmin closed this pull request 2026-07-08 01:28:54 -05:00
Owner

PR #392 is closed as superseded by PR #422.

PR #422 cherry-picked/integrated the core workflow-load foundation from PR #392 and extends it with session boundaries and pre-review command classification. PR #392 is redundant and should not merge independently.

PR #392 is closed as superseded by PR #422. PR #422 cherry-picked/integrated the core workflow-load foundation from PR #392 and extends it with session boundaries and pre-review command classification. PR #392 is redundant and should not merge independently.

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#392