Repository navigation
ci(queue): stop merge-queue entries re-running checks a PR already passed on the same tree (FND-4344) - #4592
Conversation
…queue branch name (FND-4344) GitHub names a queue branch gh-readonly-queue/<base>/pr-<N>-<sha>, where the SHA is the commit the entry was built on (the queue commit's parent), not the PR head. queue_tree_diff.py read it as the head, so it compared every queue commit with its own base: `identical` was never true and the FND-3321 Pre-commit and Conformance Gate skips never fired. Fetch the head from refs/pull/<N>/head instead (contents: read only) and expose it as a `pr_head` output for a later step that trusts a verdict on that commit. Every failure path still runs every check. Claude-Session: https://claude.ai/code/session_017gdsZwMP78agPsUHUV3ksA
|
/lens |
…n the queued tree (FND-4344) (#4593)
lens summary · updated after round 1 (first review)✅ Ready to merge — every finding is resolved Open findings: 🔴 0 critical · 🟠 0 high · 🟡 0 medium · ⚪ 0 low (nit) lens reads this PR as — The merge-queue branch-name SHA identifies the queue entry’s base parent, not the PR head, so the shared diff logic compared against the wrong commit and failed to recognize identical trees. The PR also aims to let release queue entries reuse a successful Approach check — worth a second look (advisory, does not block):
🕘 Round history (1)
round 1 · $0.053 of $1.00 · 18 model calls · 0 failed requests · 76% prompt cache hits · gpt-6-luna |
atlan-ci
left a comment
There was a problem hiding this comment.
lens: ready to merge — every finding at every level is resolved (round 1).
What
There are two changes, and the second depends on the first:
queue_tree_diff.pynow reads the PR head fromrefs/pull/<N>/headand adds apr_headoutput.queue-proofjob intests-reusable.yaml. It runs onmerge_grouponly, on ubuntu-slim, withcontents: readandstatuses: read. When a release PR's/gate-checkalready passed on the exact tree being queued, its Unit/Integration re-run in the queue is skipped.1. Queue head lookup fix
GitHub names a queue branch
gh-readonly-queue/<base>/pr-<N>-<sha>. That SHA is the commit the entry was built on, the queue commit's parent. It is not the PR head. I checked 7/7 recent queue entries on a connector repo and 1 on this repo: the ref SHA equalledparents[0]of the queue commit every time.The script read that SHA as the PR head, so it compared each queue commit with its own base.
identicalwas never true, and the FND-3321 skips for Pre-commit and Conformance Gate never fired. For example, a release PR whose queue tree was byte-identical to its head still re-ran both.The head now comes from
refs/pull/<N>/head, which needs onlycontents: read, the permission everyqueue-diffjob already has.Behaviour change for every PR, not just releases: Pre-commit and Conformance Gate now skip on a queue entry whose tree equals the PR head and whose head already contains the base. This is what FND-3321 documented, and it is the normal case for an up-to-date PR.
2. Release-PR skip in tests-reusable
A release PR's full suite already ran on its head:
/gate-checkdispatchestests.yamlthere, and it refuses a branch behind its base. Real data from a connector with a queue: 16/16 recent bump PRs queued an identical, up-to-date tree, and each queue entry re-ran ~8 billed minutes of Tests jobs.queue-proofworks in three steps:queue_tree_diff.py, the same step as the otherqueue-diffjobs, pinned by a test.identical=truedoes it run the newqueue_gate_check_proof.py. That script reads the newestgate-checkstatus that github-actions[bot] posted on that exact PR head, using the same creator rule as Release Gate (FND-3947).proven=trueonly onsuccess.On a proven entry, Unit, Detect integration suite, Detect hosted api member, the scorecard and Tests Gate skip at job level. Integration, api-member and dataforge wake/pause skip because their roots did. Every job keeps its static name, so
tests / Tests Gateresolves as skipped, which passes the required context. That is the FND-3320/FND-3947 pattern.What still runs everything
gate-checksuccess from the bot on the head.queue-proofskipped (every non-queue event) or failed: its output is empty.Single-leg retry is unchanged. It happens on the PR's dispatched run (FND-4331), before the queue.
Tests
test_queue_tree_diff.pynow builds the real ref shape: base SHA in the name, head atrefs/pull/42/head. New tests:test_queue_gate_check_proof.pycovers the script's trust rules: bot only, newest row wins, a re-run that cleared a failure counts, and every fail-safe path. It also simulates a whole run of the reusable job by job through the realif:expressions, with GitHub's implicitsuccess()onneeds:queue-proof;test_the_gate_job_still_always_reportsassertedif: always(). The gate now skips on exactly one input,proven == 'true', which only amerge_grouprun can produce. FND-2167's hazard was a skipped suite on a PR commit overriding a real failure. A queue commit belongs to one entry, so no other suite shares its SHA (ci.md, "Newest suite wins").test_integration_always_runs_off_the_pr_pathnow passes theneedscontext thatdetect-integrationreads.tests-reusable.yaml, plus the queue tests.Rollout and cost
Consumers call these reusables at
@main, so no resync is needed. Callers already grantstatuses: write, because Tests Gate needs it, sostatuses: readis not clamped.Expected on a release queue entry: about 11 → 3 billed min. Tests drops from ~8 to 1 (
queue-proof), and Pre-commit plus Conformance (~3) go to 0, while the three decision jobs stay. I'll post the before/after from the next real release on FND-4344.Review notes
This is a security-relevant change to scripts and workflows that decide whether required checks skip. A wrong
identical=trueorproven=truewould green a required check on a tree that was not tested. Guards:🤖 Generated with Claude Code
https://claude.ai/code/session_017gdsZwMP78agPsUHUV3ksA