Commit Graph

1 Commits

Author SHA1 Message Date
sysadmin 7c2aabf6ac feat: auto-release status:in-progress on close and merge (#58)
When Gitea-Tools closes an issue, merges a PR, or closes a PR without merging,
remove status:in-progress from the affected issue(s) so closed work doesn't
retain stale in-progress state (as happened with #46/#48).

Helpers (deterministic, unit-testable) in mcp_server.py:
- extract_linked_issue_numbers(text, branch_name): pure; matches
  Closes/Fixes/Resolves/Refs #N and issue-<N> in a branch name (not review/pr-N).
- release_in_progress_label(issue_numbers, repo_context): removes ONLY
  status:in-progress; absent label / undefined repo label = no-op success;
  per-issue failures recorded in `failed` (never falsely reported clean);
  emits an audit record per removal when auditing is enabled.
- cleanup_in_progress_for_pr(pr_payload, repo_context): links from PR
  title/body + head branch, then releases; empty when nothing confidently
  linked (no guessing, no mutation).

Wired into:
- gitea_close_issue → releases from that issue.
- gitea_merge_pr → releases from PR-linked issues (reuses the read-back PR).
- gitea_edit_pr (state=closed) → releases from PR-linked issues WITHOUT closing
  them.
Each returns the cleanup summary under `in_progress_cleanup`. Only necessary
label GET/DELETE calls added; no auth/profile/retry/config/worktree/release-tag
changes; backwards compatible.

Tests: tests/test_in_progress_cleanup.py (18 cases) — extraction, present/absent
label, no-issues/no-link no-op, multiple issues, failure reported, label not
defined, only-status-removed, PR keyword/branch links, close-without-merge does
not close the issue, and audit records the removal. Updated TestCloseIssue for
the added release calls.

Full suite 322 passed / 0 failures; py_compile clean; git diff --check clean;
no secrets.

Closes #58. Refs #46, #48.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 06:00:34 -04:00