fix: surface skipped tracker cleanup on merge read-back failure (#98) #99
Reference in New Issue
Block a user
Delete Branch "fix/issue-98-merge-cleanup-status"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #98. Found by the read-only
gitea_merge_pr()/cleanup_in_progress_for_pr()trace.Summary
gitea_merge_prran tracker cleanup inside the sametryas the post-merge read-back GET. If the merge POST succeeded but the read-back failed, cleanup was silently skipped:merge_commit: null, nocleanup_statuskey, no signal —status:in-progresscould stay stuck while the merge read as full success.Behavior before / after
cleanup_statussetcleanup_statusabsentcleanup_status: "skipped (merge read-back failed)"; merge stillperformed: trueexceptswallowed it and (wrongly) nulledmerge_commitcleanup_status: "skipped (cleanup error: <redacted>)";merge_commitpreservedDesign choices (per issue notes): cleanup stays keyed on the read-back payload — the eligibility result doesn't carry title/body/branch, and pre-fetching before the merge POST would add a happy-path API call and re-sequence every mocked test. Cleanup remains never a merge blocker.
_redactkept on all surfaced error text.Files changed
mcp_server.py— split read-back vs. cleanup handling ingitea_merge_pr(+16/−3 lines, one function)tests/test_mcp_server.py— 2 regression tests: read-back failure ⇒ explicit skip +performed: true+ no tracker DELETE traffic (call-count pinned at 4); cleanup exception ⇒ surfaced + redacted (secret-xyznever appears)Validation
git diff --check— cleanpython3 -m py_compile mcp_server.py manage_labels.py gitea_auth.py— OKbash -n scripts/clear-provenance— OK-k "TestMergePR or TrackerHygiene"— 26 passedpytest tests/ -q— 357 passed (355 → +2)Risk notes
{}(which produced a misleading "no linked issue found") — strictly more accurate.@_audit_pr_resultstill classifies from the result dict.Confirmations
🤖 Generated with Claude Code
Independent review from a detached worktree at pinned head
8120486.02c0c20), mergeable, head unchanged.Review Metadata:
Approving.