fix: sync_branch_protection_contexts never falls back to (push) suffixes #15

Merged
john merged 1 commit from feat/fix-branch-protection-push-suffix into dev 2026-06-13 06:45:03 +00:00
Owner

Summary\n\nFixes the branch protection sync function that would write (push) suffixed check names when a branch had no (pull_request) contexts. This created a deadlock: PRs report (pull_request) checks but protection requires (push) checks, so auto-merge can never fire.\n\n## Root Cause\n\nWhen sync_branch_protection_contexts() ran on a branch that had only been pushed to (no PRs yet), the pr_contexts filter returned empty, and the fallback wrote raw_contexts (which included (push) suffixes) to branch protection.\n\n## Fix\n\nReturn early with reason=no_pull_request_contexts_on_head when no (pull_request) contexts exist, instead of falling back to (push) contexts. Branch protection gates PRs, not pushes, so (push) contexts are never correct.\n\n## Impact\n\n- bug-reporter: 9 PRs stuck for 3 days (branch protection patched manually)\n- heyco: branch protection patched manually\n- Fleet-wide: prevents recurrence on any newly wired repo\n\nBumps haskytech-forgejo to 0.1.1.

## Summary\n\nFixes the branch protection sync function that would write `(push)` suffixed check names when a branch had no `(pull_request)` contexts. This created a deadlock: PRs report `(pull_request)` checks but protection requires `(push)` checks, so auto-merge can never fire.\n\n## Root Cause\n\nWhen `sync_branch_protection_contexts()` ran on a branch that had only been pushed to (no PRs yet), the `pr_contexts` filter returned empty, and the fallback wrote `raw_contexts` (which included `(push)` suffixes) to branch protection.\n\n## Fix\n\nReturn early with `reason=no_pull_request_contexts_on_head` when no `(pull_request)` contexts exist, instead of falling back to `(push)` contexts. Branch protection gates PRs, not pushes, so `(push)` contexts are never correct.\n\n## Impact\n\n- **bug-reporter**: 9 PRs stuck for 3 days (branch protection patched manually)\n- **heyco**: branch protection patched manually\n- **Fleet-wide**: prevents recurrence on any newly wired repo\n\nBumps haskytech-forgejo to 0.1.1.
fix: sync_branch_protection_contexts never falls back to (push) suffixes
All checks were successful
CI / detect-changes (pull_request) Successful in 21s
CI / Unit Tests (pull_request) Successful in 10s
CI / Lint & Format (pull_request) Successful in 10s
28e4ff6edc
When a branch has only been pushed to (no PRs yet), the sync function
would fall back to raw_contexts which includes (push) suffixed check
names. These get written to branch protection, creating a deadlock:
PRs report (pull_request) checks but protection requires (push) checks.

Now returns early with reason=no_pull_request_contexts_on_head instead
of writing wrong values. Fixes Phase 0 Quick Fix #7 from the
sufficiency dispatch spec.

Also bumps haskytech-forgejo to 0.1.1.
john merged commit 2f6b66b24d into dev 2026-06-13 06:45:03 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
haskytech/haskytech-modules-py!15
No description provided.