S64: orchestrate mergeable_state — PR create + check completion triggers#317
Merged
Conversation
1ca12c5 to
f4b1f32
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires the three missing triggers from S64 (
mergeable_stateorchestration), closing audit findings A17/A20.Pre-existing: the
pulls.Mergeability()algorithm was complete; only the kicks that enqueue it were missing outside the HTML review flow. CLI-driven PRs lived stuck onunknown.Triggers wired in this PR:
pulls.Create()— kicks pr:mergeability for the new PR so HTTP/REST + CLI opens leaveunknownwithin the first worker tick (no longer requires a human visiting the HTML review screen).head sync— already wired viaPRSynchronizeworker chain; no change needed.api/checks.UpdateRunandactions/checksync.Jobfan out pr:mergeability ticks to every open PR sharing the head SHA, so required-checks gates flip blocked → clean promptly.Triggers 3 (base-ref pushes) + 4 (branch-protection rule changes) deferred per S64 — they're correctness-improving but lower-impact and 3 is partially covered by trigger 2 already.
Refactor: new
internal/pulls/mergeenqueue/subpackage holds the enqueue helpers (ForPR,ForHeadSHA). Necessary to break thepulls → actions/trigger → actions/checksync → pullscycle that direct importing would have created. Existing in-handlerkickMergeability(review path) can migrate to it in a follow-up.Test plan
TestCreate_EnqueuesMergeabilityJob— pulls.Create leaves a row in the jobs table withkind='pr:mergeability'and the new PR's idTestForHeadSHA_EnqueuesPerOpenPR— fan-out enqueues one job per open PR at the given head_oid; PRs at other SHAs skippedTestForHeadSHA_EmptyHeadSHA— empty SHA is a no-op (guards against pre-snapshot rows)go test ./internal/pulls/... ./internal/actions/checksync/... ./internal/web/handlers/api/...— greengolangci-lint run ./...— 0 issuesscripts/lint-unused.sh— cleanshithub.sh,shithub pr createand confirmshithub pr viewshowsmergeable_state≠unknownwithin seconds; then push CI through and confirm a blocked PR flips to clean once required checks succeedCloses audit findings A17/A20.
S64 spec lives at
shithub/.docs/sprints/S64-mergeable-state-orchestration.md(local).