fix: register gitea_lock_issue as MCP tool (Closes #521) #526

Merged
sysadmin merged 1 commits from feat/issue-521-lock-issue-registration into master 2026-07-08 03:50:25 -05:00
Owner

Summary

Restore gitea_lock_issue as a discoverable MCP tool so the author create_pr flow can acquire the issue lock that gitea_create_pr requires.

Problem

@mcp.tool() was attached to internal _list_open_pulls while gitea_lock_issue had no decorator, so ToolSearch/clients could not discover the lock tool even though gitea_create_pr fails closed without a lock.

Changes

  • Remove @mcp.tool() from _list_open_pulls (internal helper only)
  • Add @mcp.tool() to gitea_lock_issue
  • Add tests/test_lock_issue_mcp_registration.py with registration and create_pr lock-flow regression tests

Validation

venv/bin/python -m py_compile gitea_mcp_server.py
venv/bin/python -m pytest tests/test_lock_issue_mcp_registration.py -q
# 4 passed

Closes #521

## Summary Restore `gitea_lock_issue` as a discoverable MCP tool so the author `create_pr` flow can acquire the issue lock that `gitea_create_pr` requires. ## Problem `@mcp.tool()` was attached to internal `_list_open_pulls` while `gitea_lock_issue` had no decorator, so ToolSearch/clients could not discover the lock tool even though `gitea_create_pr` fails closed without a lock. ## Changes - Remove `@mcp.tool()` from `_list_open_pulls` (internal helper only) - Add `@mcp.tool()` to `gitea_lock_issue` - Add `tests/test_lock_issue_mcp_registration.py` with registration and create_pr lock-flow regression tests ## Validation ```bash venv/bin/python -m py_compile gitea_mcp_server.py venv/bin/python -m pytest tests/test_lock_issue_mcp_registration.py -q # 4 passed ``` Closes #521
jcwalker3 added 1 commit 2026-07-08 03:42:50 -05:00
Move @mcp.tool() from internal _list_open_pulls helper onto
gitea_lock_issue so author sessions can discover and call the
issue lock required by gitea_create_pr.

Add regression tests for MCP registration and create_pr lock flow.
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #526
issue: #521
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 97777-052a67d99227
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr526
phase: claimed
candidate_head: d56baa635e
target_branch: master
target_branch_sha: none
last_activity: 2026-07-08T08:47:35Z
expires_at: 2026-07-08T10:47:35Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #526 issue: #521 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 97777-052a67d99227 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr526 phase: claimed candidate_head: d56baa635e53f71be3a895816cecbea411f9363b target_branch: master target_branch_sha: none last_activity: 2026-07-08T08:47:35Z expires_at: 2026-07-08T10:47:35Z blocker: none
sysadmin approved these changes 2026-07-08 03:47:53 -05:00
sysadmin left a comment
Owner

Review: PR #526 / Issue #521

Verdict: APPROVED at head d56baa635e53f71be3a895816cecbea411f9363b.

Identity / profile proof

  • Reviewer: sysadmin (prgs-reviewer)
  • PR author: jcwalker3not reviewer identity
  • Self-review: blocked (distinct accounts)

Head pin

  • Expected: d56baa6
  • Live fetched: d56baa635e53f71be3a895816cecbea411f9363bno drift
  • PR state: open, mergeable

Scope (2 files only)

  • gitea_mcp_server.py — move @mcp.tool() from _list_open_pulls to gitea_lock_issue
  • tests/test_lock_issue_mcp_registration.py — new regression tests
  • No unrelated MCP registration changes

Review focus

  1. gitea_lock_issue decorated with @mcp.tool()
  2. _list_open_pulls no longer exposed (_list_open_pulls ∉ tool registry)
  3. Lock authority unchanged — gitea_lock_issue still gated by _profile_permission_block(task_capability_map.required_permission("lock_issue")) (author role); no reviewer/merger/reconciler widening
  4. create_pr still fails closed without lock (test_create_pr_still_fails_closed_without_issue_lock)
  5. Lock → create_pr path covered (test_create_pr_proceeds_after_valid_issue_lock + existing TestIssueLocking cases)
  6. Diff limited to decorator relocation + tests

Validation

py_compile gitea_mcp_server.py tests/test_lock_issue_mcp_registration.py  # pass
pytest tests/test_lock_issue_mcp_registration.py \
  tests/test_mcp_server.py::TestIssueLocking::test_lock_issue_success \
  tests/test_mcp_server.py::TestIssueLocking::test_create_pr_missing_lock_fails \
  tests/test_mcp_server.py::TestIssueLocking::test_create_pr_honors_scratch_worktree_lock -q
# 7 passed
git diff --check prgs/master...HEAD  # pass
secret/provenance scan on diff  # no matches

Registry check: gitea_lock_issue registered=True, _list_open_pulls exposed=False.

Mutation ledger

Tool Action
gitea_acquire_reviewer_pr_lease Acquired lease on PR #526 (session 97777-052a67d99227)
gitea_mark_final_review_decision Marked approve ready at head d56baa6
gitea_submit_pr_review APPROVED

No merge performed.


Merger prompt (paste when ready to merge):

Merge PR #526 for issue #521. Reviewer sysadmin approved at head d56baa635e53f71be3a895816cecbea411f9363b. Branch feat/issue-521-lock-issue-registrationmaster. Confirm approval still at current head before merge.

## Review: PR #526 / Issue #521 **Verdict: APPROVED** at head `d56baa635e53f71be3a895816cecbea411f9363b`. ### Identity / profile proof - Reviewer: `sysadmin` (`prgs-reviewer`) - PR author: `jcwalker3` — **not** reviewer identity - Self-review: **blocked** (distinct accounts) ### Head pin - Expected: `d56baa6` - Live fetched: `d56baa635e53f71be3a895816cecbea411f9363b` — **no drift** - PR state: open, mergeable ### Scope (2 files only) - `gitea_mcp_server.py` — move `@mcp.tool()` from `_list_open_pulls` to `gitea_lock_issue` - `tests/test_lock_issue_mcp_registration.py` — new regression tests - No unrelated MCP registration changes ### Review focus 1. ✅ `gitea_lock_issue` decorated with `@mcp.tool()` 2. ✅ `_list_open_pulls` no longer exposed (`_list_open_pulls` ∉ tool registry) 3. ✅ Lock authority unchanged — `gitea_lock_issue` still gated by `_profile_permission_block(task_capability_map.required_permission("lock_issue"))` (author role); no reviewer/merger/reconciler widening 4. ✅ `create_pr` still fails closed without lock (`test_create_pr_still_fails_closed_without_issue_lock`) 5. ✅ Lock → create_pr path covered (`test_create_pr_proceeds_after_valid_issue_lock` + existing `TestIssueLocking` cases) 6. ✅ Diff limited to decorator relocation + tests ### Validation ``` py_compile gitea_mcp_server.py tests/test_lock_issue_mcp_registration.py # pass pytest tests/test_lock_issue_mcp_registration.py \ tests/test_mcp_server.py::TestIssueLocking::test_lock_issue_success \ tests/test_mcp_server.py::TestIssueLocking::test_create_pr_missing_lock_fails \ tests/test_mcp_server.py::TestIssueLocking::test_create_pr_honors_scratch_worktree_lock -q # 7 passed git diff --check prgs/master...HEAD # pass secret/provenance scan on diff # no matches ``` Registry check: `gitea_lock_issue` registered=True, `_list_open_pulls` exposed=False. ### Mutation ledger | Tool | Action | |------|--------| | `gitea_acquire_reviewer_pr_lease` | Acquired lease on PR #526 (session `97777-052a67d99227`) | | `gitea_mark_final_review_decision` | Marked approve ready at head `d56baa6` | | `gitea_submit_pr_review` | APPROVED | No merge performed. --- **Merger prompt (paste when ready to merge):** > Merge PR #526 for issue #521. Reviewer `sysadmin` approved at head `d56baa635e53f71be3a895816cecbea411f9363b`. Branch `feat/issue-521-lock-issue-registration` → `master`. Confirm approval still at current head before merge.
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #526
issue: #521
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 97777-052a67d99227
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr526
phase: claimed
candidate_head: d56baa635e
target_branch: master
target_branch_sha: none
last_activity: 2026-07-08T08:50:17Z
expires_at: 2026-07-08T10:50:17Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #526 issue: #521 reviewer_identity: sysadmin profile: prgs-merger session_id: 97777-052a67d99227 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr526 phase: claimed candidate_head: d56baa635e53f71be3a895816cecbea411f9363b target_branch: master target_branch_sha: none last_activity: 2026-07-08T08:50:17Z expires_at: 2026-07-08T10:50:17Z blocker: none
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #526
issue: #521
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 97777-052a67d99227
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr526
phase: merge
candidate_head: d56baa635e
target_branch: master
target_branch_sha: none
last_activity: 2026-07-08T08:50:21Z
expires_at: 2026-07-08T10:50:21Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #526 issue: #521 reviewer_identity: sysadmin profile: prgs-merger session_id: 97777-052a67d99227 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr526 phase: merge candidate_head: d56baa635e53f71be3a895816cecbea411f9363b target_branch: master target_branch_sha: none last_activity: 2026-07-08T08:50:21Z expires_at: 2026-07-08T10:50:21Z blocker: none
sysadmin merged commit 236c8b779f into master 2026-07-08 03:50:25 -05:00
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#526