feat: auto-release status:in-progress on close and merge (#58) #59

Closed
jcwalker3 wants to merge 1 commits from fix/issue-58-release-in-progress-on-close into master
Owner

Closes #58. Refs #46, #48 (which left stale status:in-progress after close).

What

When Gitea-Tools closes an issue, merges a PR, or closes a PR without merging, it removes status:in-progress from the affected issue(s).

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). No guessing.
  • release_in_progress_label(issue_numbers, repo_context) — removes only status:in-progress; absent label / repo-label-undefined = no-op success; per-issue failures recorded in failed (never falsely clean); emits an audit record per removal when GITEA_AUDIT_LOG is set.
  • cleanup_in_progress_for_pr(pr_payload, repo_context) — links from PR title/body + head branch, then releases; empty linked_issues when nothing confidently linked (no mutation).

Wired into

  • gitea_close_issue → releases from that issue.
  • gitea_merge_pr → releases from PR-linked issues (reuses the read-back PR; no extra fetch when available).
  • gitea_edit_pr (state=closed) → releases from PR-linked issues without closing them.

Each returns the summary under in_progress_cleanup. Only necessary label GET/DELETE calls added. No change to auth/profile/retry/backoff/config/worktree/release-tag; backwards compatible (returns gain one field).

Behavior guarantees

  • No unrelated labels removed (only the status:in-progress id is deleted).
  • Missing label / no linked issue → no-op, reported clearly.
  • Removal failure → reported in failed, not falsely reported clean.

Tests / checks

  • tests/test_in_progress_cleanup.py — 18 cases (extraction, present/absent, no-op, multiple, failure-reported, label-not-defined, only-status-removed, PR keyword/branch links, close-without-merge doesn't close the issue, audit records the removal). Fake api_request — no network/secrets. Updated TestCloseIssue for the added release calls.
  • Full suite (isolated worktree): 322 passed, 0 failures, 0 errors (JUnit XML).
  • py_compile clean; git diff --check clean; secret scan clean.

Files changed

mcp_server.py, tests/test_in_progress_cleanup.py (new), tests/test_mcp_server.py.

Process

Isolated worktree: ./scripts/worktree-start fix/issue-58-release-in-progress-on-closebranches/fix-issue-58-release-in-progress-on-close.


⚠️ Authored by me — do not self-merge. Needs review by another author.

Closes #58. Refs #46, #48 (which left stale `status:in-progress` after close). ## What When Gitea-Tools closes an issue, merges a PR, or closes a PR without merging, it removes `status:in-progress` from the affected issue(s). ## 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`). No guessing. - `release_in_progress_label(issue_numbers, repo_context)` — removes **only** `status:in-progress`; absent label / repo-label-undefined = **no-op success**; per-issue failures recorded in `failed` (never falsely clean); emits an audit record per removal when `GITEA_AUDIT_LOG` is set. - `cleanup_in_progress_for_pr(pr_payload, repo_context)` — links from PR title/body + head branch, then releases; empty `linked_issues` when nothing confidently linked (no mutation). ## Wired into - `gitea_close_issue` → releases from that issue. - `gitea_merge_pr` → releases from PR-linked issues (reuses the read-back PR; no extra fetch when available). - `gitea_edit_pr` (`state=closed`) → releases from PR-linked issues **without closing them**. Each returns the summary under `in_progress_cleanup`. Only necessary label GET/DELETE calls added. No change to auth/profile/retry/backoff/config/worktree/release-tag; backwards compatible (returns gain one field). ## Behavior guarantees - No unrelated labels removed (only the `status:in-progress` id is deleted). - Missing label / no linked issue → no-op, reported clearly. - Removal failure → reported in `failed`, not falsely reported clean. ## Tests / checks - `tests/test_in_progress_cleanup.py` — 18 cases (extraction, present/absent, no-op, multiple, failure-reported, label-not-defined, only-status-removed, PR keyword/branch links, close-without-merge doesn't close the issue, audit records the removal). Fake `api_request` — no network/secrets. Updated `TestCloseIssue` for the added release calls. - Full suite (isolated worktree): **322 passed, 0 failures, 0 errors** (JUnit XML). - `py_compile` clean; `git diff --check` clean; secret scan clean. ## Files changed `mcp_server.py`, `tests/test_in_progress_cleanup.py` (new), `tests/test_mcp_server.py`. ## Process Isolated worktree: `./scripts/worktree-start fix/issue-58-release-in-progress-on-close` → `branches/fix-issue-58-release-in-progress-on-close`. --- ⚠️ Authored by me — do **not** self-merge. Needs review by another author.
jcwalker3 added 1 commit 2026-07-02 05:01:00 -05:00
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>
sysadmin requested changes 2026-07-02 05:07:04 -05:00
sysadmin left a comment
Owner

I am blocking this PR from being merged. PR #57 (resolving Issue #56) has already been merged into master and implements the exact same functionality (automatically releasing status:in-progress on close and merge). Furthermore, this PR is reporting as unmergeable due to conflicts with the updated master branch. Please close this PR as a duplicate.

I am blocking this PR from being merged. PR #57 (resolving Issue #56) has already been merged into `master` and implements the exact same functionality (automatically releasing `status:in-progress` on close and merge). Furthermore, this PR is reporting as unmergeable due to conflicts with the updated `master` branch. Please close this PR as a duplicate.
Author
Owner

Closing as duplicate. The identical auto-release behavior (extract_linked_issue_numbers / release_in_progress_label / cleanup_in_progress_for_pr, wired into close/merge/edit) already merged to master via PR #57 / issue #56 (3a246ab), which is a superset (it also comments on PR-close). This PR's diff re-adds existing functions and is no longer valid against current master. Not merged (author == authenticated user; and duplicate).

Closing as duplicate. The identical auto-release behavior (extract_linked_issue_numbers / release_in_progress_label / cleanup_in_progress_for_pr, wired into close/merge/edit) already merged to master via PR #57 / issue #56 (3a246ab), which is a superset (it also comments on PR-close). This PR's diff re-adds existing functions and is no longer valid against current master. Not merged (author == authenticated user; and duplicate).
jcwalker3 closed this pull request 2026-07-02 05:07:09 -05:00

Pull request closed

Sign in to join this conversation.