Repository navigation
fix(release): check for a CodeQL result before a merge - #960
Conversation
On 2026-11-08, #943, #937 and #944 merged with --admin past the code-scanning rule. They were opened before the CodeQL workflow (#945), so no scan of their head existed, and --admin does not say which rules it bypasses. The scans of main afterwards found no new alert. - check-ready.sh: not ready when the head has no passing CodeQL check run (the run GitHub's code-scanning rule reads). - RELEASING.md: a PR opened before #945 needs a new push; read the merge's rule results after an --admin merge; a PR's scan covers only changed lines, so read main for all open alerts; a false positive is dismissed only with the owner's yes. Tested: check-ready.sh 951 (scanned) passes the new check; check-ready.sh 943 (head never scanned) fails it. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | 51d365e2c5c2 |
approve |
Verdict: approve
Findings
None.
Non-blocking
scripts/release/check-ready.sh:80— while the CodeQL scan still runs, the message says "push again, or close and reopen the PR". The right action then is to wait. The CI loop already reportscheck analyze: still in_progress, so both messages print. Cosmetic only; the exit code is correct.scripts/release/check-ready.sh:79— a passingCodeQLcheck run proves a scan reached GitHub. It does not prove the code-scanning rule passes. The GHAS check run can endsuccesswith high alerts as annotations; the ruleset is what blocks them. An--adminmerge past a real alert would still see this gate pass. RELEASING.md covers it after the merge (readrule-suites/<id>). A before-merge read ofcode-scanning/alerts?ref=<head>&state=openwould close the gap.scripts/release/check-ready.sh:79— the exact nameCodeQLmatches only PR heads. Onmainpush commits the result shows only as theanalyzejob. The script queries PR heads only, so this is fine today. Reuse of the snippet on a branch commit would never match.
What I checked
- Read the full diff (2 files, 15 added lines) and all of
scripts/release/check-ready.sh. - Verified the gate's key claim against GitHub, live: the PR head gets a check run named
CodeQLfrom thegithub-advanced-securityapp (seen on PR #951's headdf92f1cdand on this PR's head51d365e2). The awk match$3=="CodeQL"is correct for the only SHA the script queries. - Verified the failure case the PR targets: a head never scanned has no
CodeQLrun, so the gate fires. Checked onmaincommits and this PR's head mid-scan. - Checked the awk logic: tab field split matches the jq output;
exit !freturns 0 only on acompleted/success/CodeQLline; theif !guard is correct underset -e. - Checked the workflow from #945 (
.github/workflows/codeql.yaml):pull_requesttrigger with default activity types, so close-and-reopen does re-scan a head. The doc's remedy is right. - Checked the doc lines (RELEASING.md:119, 147-148) against the script and the workflow. They agree.
- No library or proxy code is touched. No behavior change, no data-dependence change.
- The commit carries
Signed-off-by:. DCO passes.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | 51d365e2c5c2 |
approve |
Verdict: approve
Findings
None. The script works as written, and the docs match what the script does.
Non-blocking
scripts/release/check-ready.sh:79— the new check matches the check-run nameCodeQLonly. It does not check which app posted the run. Today only the code-scanning app (github-advanced-security) posts a run with that name. But a future Actions job namedCodeQL(for example, someone renames theanalyzejob) would also satisfy the check, with no real scan behind it. Fix: add.app.slugto the jq output at line 66 and matchgithub-advanced-securityin the awk.scripts/release/check-ready.sh:80— the advice "push again, or close and reopen the PR" cannot work while the PR targets a branch other thanmain. The CodeQL workflow runs only on pull requests tomain(.github/workflows/codeql.yaml:7). The stacked-PR flow in RELEASING.md retargets tomainfirst, so the case is covered. A reader who skips that flow gets advice that never succeeds.
What I checked
- Read the full diff (2 files, 15 added lines) and the whole
check-ready.sh,codeql.yaml, and the RELEASING.md sections around both changes. - Verified the central claim against GitHub, read-only: the code-scanning app posts a check run named exactly
CodeQL, separate from the workflow'sanalyzejob.- PR #955 head
102eee6e:completed success CodeQLfromgithub-advanced-security, next toanalyzefromgithub-actions. - Docs-only PR #954 head
b7ff2412: same passingCodeQLrun. So docs-only PRs get one too, because the workflow has no paths filter. - Main push
48d54447: noCodeQLrun. The app posts it on pull requests only. The script reads PR heads, so this is consistent. - This PR's head
51d365e2:analyzewas still in progress, noCodeQLrun yet. The generic CI loop already flags an in-progress check, so the timing is safe.
- PR #955 head
- Checked the awk under
set -euo pipefail: the pipeline sits underif !, so the awk exit 1 (no match) cannot tripset -e. An empty$runsprints one blank line; awk treats it as no match. Both paths end inno, which is the safe direction. - Checked the doc's remedy: the workflow uses the default
pull_requesttrigger types (opened,synchronize,reopened), so a close and reopen does start a scan on the same head, and the head sha does not move. The approvals stay valid. - Checked the new RELEASING.md bullets against the script and the repo state:
--adminbehavior, the rule-suites API paths, and thecode-scanning/alerts?ref=refs/heads/maincall all read correct. - No Go tests run. Live tests were not approved. The GitHub reads above are the same API calls the script itself makes.
Round 1 of #960, non-blocking points: - The CodeQL check run must come from GitHub's code-scanning app (github-advanced-security), so a job renamed to CodeQL cannot pass the check with no scan behind it. - A passing check run can still carry an alert. The script now also reads the open code-scanning alerts on the PR's merge ref, and a failed read stops it with an error. - The messages say what to do: the PR must target main to be scanned, and a run still in progress means wait. Tested with a stub gh: a clean PR is READY; an open alert gives NOT READY with the alert; a failed alert read gives an ERROR. On real PRs: #951 and #960 pass the scan check; #943 fails it. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Round 1: repliesBoth reviews approve. I fixed 4 non-blocking points in the new head.
Tested with a stub |
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 2 of 2 | 2e0396e7f40e |
approve |
Verdict: approve
Findings
None.
Earlier findings
- Mine, "wrong advice while the scan still runs": fixed. The
*)branch of the newcaseprints "CodeQL check run still in_progress; wait for it". An in-progress run has conclusionnull, socqisin_progress/nulland lands there. Correct. - Mine, "a passing run does not prove the rule passes": fixed. The script now reads open alerts on
refs/pull/<n>/merge. Verified live on this PR: the merge ref has the scan analysis (commit6241897e, refrefs/pull/960/merge), and 0 open alerts is a true clean read, not a vacuous one. - Mine, "the name
CodeQLmatches PR heads only": rejected by the author. Reason: the script reads PR heads only. The reason is right. I said the same in round 1. Accepted. - Reviewer 1, "the check matches the name only, not the app": fixed. The jq now emits
.app.slug, and the awk requiresgithub-advanced-security. Verified live on the new head: the only matching line iscompleted/success/CodeQL/github-advanced-security. - Reviewer 1, "the advice cannot work when the PR does not target main": fixed. The message now says "the PR must target main" before push or reopen. The workflow runs
pull_requestagainstmainonly, so the advice is now accurate.
Non-blocking
scripts/release/check-ready.sh:89— the alerts read goes vacuous when the base branch moves.refs/pull/<n>/mergepoints at a merge commit GitHub recomputes; a base advance moves it to a commit with no analysis. The alerts API then answers 200 with an empty list, not an error. Proven live:alerts?ref=refs/pull/99999/merge(a ref that does not exist) returns 0 alerts with rc=0, and PR #943 (never scanned) also returns 0. So in the window "last scan found an alert, then main advanced", gate 2 reads clean while an alert is open. Gate 1 still proves a scan of the head exists, and the rule itself needs a result for the current merge commit, so the normal path is safe. Fix if wanted: fail whencode-scanning/analyses?ref=refs/pull/<n>/mergeis empty. That tells "scanned and clean" from "no analysis at this ref".scripts/release/check-ready.sh:91— the reply says "a failed read stops it with an error". That holds for a transport failure (gh exits non-zero,apiexits 2). It does not hold for a ref GitHub cannot resolve: the API returns 200 with an empty list (proof above). The script then treats the read as clean. Same root as the point above.
What I checked
- Last review: round 1, 51d365e, 2026-11-08T16:13:48Z.
- New commits read: 1 —
2e0396e7fix(release): require the scan app's run and no open alert. - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files).
- New items since my last review: the new commit
2e0396e7(reviewed below); the author's reply comment at 16:17 (checked each claim against the code); reviewer 1's round-1 review at 16:14 (read for the first time, as round 1 required; its 2 non-blocking points match what the author says he fixed). - Read the full diff
51d365e2..2e0396e7(2 files, 24 added, 12 removed) and the wholecheck-ready.sharound it. - Checked the new
caselogic on real data:cqiscompleted/successon this PR's head2e0396e7; an in-progress run would givein_progress/nulland the wait message; a missing run gives the target-main message. - Checked the alerts call live on this PR: merge ref resolves to the scan analysis, 0 open alerts, so the script's own gates pass on this PR.
- Checked
apierror handling: a non-zero gh exit stops the script with exit 2 and names the call. Verified the DCO sign-off on the new commit. Present. - No library or proxy code is touched. No behavior change, no data-dependence change.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 2 of 2 | 2e0396e7f40e |
blocking |
Verdict: blocking
Round-1 findings: status
- Reviewer 1, name-only match on
CodeQL: fixed. The jq now emits.app.slugand the awk requiresgithub-advanced-security. I verified that slug on real PR heads in round 1 (#955, #954) and again on this head. - Reviewer 1 and reviewer 2, advice when no run exists: fixed. The message now names the
maintarget first, then the push or reopen. - Reviewer 2, message during an in-progress scan: fixed. The
*case now says "still<status>; wait for it". - Reviewer 2, a passing run does not prove the rule passes: fixed in principle, but the fix over-blocks. See finding 1.
- Reviewer 2, the name
CodeQLexists on PR heads only: rejected by the author. The reason is right. The script queries only the PR head sha; I verified in round 1 thatmainpushes carry noCodeQLrun. Accepted.
Findings
- scripts/release/check-ready.sh:89 — the alerts check blocks on alerts the PR did not introduce
- What fails: when
mainhas any open code-scanning alert, every PR — even a docs-only one — printsNOT READY: open code-scanning alerts on the PRand names a file the PR does not touch. The ruleset allows that merge, because it blocks only new alerts in changed lines. The gate then answers "not ready" for mergeable PRs, and the message blames the PR formain's alert. - Proof: the CodeQL workflow on
pull_requestchecks out the merge commit and builds the whole tree (go build ./...,.github/workflows/codeql.yaml:43), and the upload lands onrefs/pull/<n>/merge. So the merge-ref analysis coversmain's code too. The alerts API has no changed-lines filter:ref=refs/pull/$pr/merge&state=openlists every alert in that analysis, including ones inherited frommain. That is exactly the case where theCodeQLcheck run passes with an alert behind it — the gap this check closes is made mostly ofmain's own alerts. The trigger is expected, not hypothetical: the weekly scheduled scan exists to open new alerts onmainwithout a code change (codeql.yaml:9). The PR's own RELEASING.md states the opposite rule: "Only alerts in changed lines block a PR" (line 152) — the script and the doc added by this PR disagree. Today nothing bites:mainhas 0 open alerts (I read it live), so the check passes on every current PR. - Fix: pick one. (a) Make the check match the rule: list
main's open alerts too, and report only alerts not on that list; or filter the merge-ref alerts to the PR's changed files. (b) Keep the strict gate, but state it in both places: the script message ("open code-scanning alerts in the merged tree, possibly from main") and RELEASING.md, replacing the "only changed lines block" claim for this gate.
- What fails: when
Non-blocking
scripts/release/check-ready.sh:82— the awk takes the firstCodeQLrun and exits. Two such runs on one head (a stale one plus a re-run) would make the answer depend on list order. GitHub updates a check run on re-run rather than adding one, so this is theoretical today.
What I checked
- Last review: round 1, 51d365e, 2026-11-08T16:14:35Z.
- New commits read: 1 (
2e0396e7fix(release): require the scan app's run and no open alert). Full diff and both changed files read around the changes. - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files
.review-in-reviews.txt,.review-in-comments.txt,.review-in-inline.txt). - New items since my last review: the author's reply comment (all 4 fixes checked above), and the new commit (reviewed as a first review).
- Verified live, read-only, the same calls the script makes:
- Alerts on
refs/pull/960/merge: empty, exit 0. Onrefs/pull/943/merge(never scanned): empty, exit 0 — so theapiwrapper does not turn a missing analysis into a false ERROR. - Analyses on
refs/pull/960/merge: 2 exist, so the empty alert list is a real clean scan, not a missing ref. mainopen alerts: 0 today.- New head
2e0396e7check runs:completed success CodeQLfromgithub-advanced-security, next toanalyzefromgithub-actions. The app filter matches reality.
- Alerts on
bash -npasses on the script. No Go tests run; live tests were not approved.- The commit carries
Signed-off-by:and oneAssisted-By:line.
Round 2: repliesThe owner granted round 3.
|
Remove the check of open alerts on the merge ref. Two reasons: - The merge-ref list includes alerts inherited from main. The ruleset blocks only new alerts in changed lines. The check would block every PR when main has any open alert. - When main moves, the merge ref has no analysis. The API then returns 200 with an empty list, not an error. The check proved nothing. The CodeQL check run is the result the rule reads. Keep that check. RELEASING.md no longer claims that a passing run can carry an alert. Tested with a stub gh: passed run is READY; no run, a run from another app slug, and a running run are NOT READY. Real PRs 951 (passes the scan check) and 943 (no run). Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
…sion Also in this commit, at the owner's request (2026-11-08): a new first bullet in "Notes for an integrator that is an AI agent session". The main session only coordinates. Each PR, fix round, script and test run goes to a subagent with its own worktree and a full brief. The integrator's own PRs are no exception. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Also in this push: a new first bullet in the integrator notes of RELEASING.md. An integrator does no implementation work in its main session. The owner asked for it. |
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 3 of 3 | df9d7190bbca |
approve |
Verdict: approve
Earlier findings: status
- Reviewer 1, round 2, finding 1 (the alerts check blocks on alerts the PR did not introduce): fixed. The alert-list check is gone from the script and from RELEASING.md. The script and the doc agree again: the
CodeQLcheck run is the only code-scanning check. The removal reason is right on both counts: the merge-ref list carriesmain's own alerts, and the API answers 200 with an empty list for a merge ref with no analysis. The second point matches reviewer 2's live proof in round 2. - Reviewer 1, round 2, non-blocking (the awk takes the first
CodeQLrun): rejected by the author. The reason is right: GitHub updates a check run on a re-run, it does not add a second one. I said the same myself in round 2. Accepted. - Reviewer 2, round 2, both non-blocking points (vacuous alerts read, the "failed read" claim): fixed by the same removal. The code they pointed at no longer exists.
- The unconfirmed claim "a passing run can still carry an alert" is gone from RELEASING.md. The doc now states only what the script proves.
Findings
None.
Non-blocking
None.
What I checked
- Last review: round 2, 2e0396e, 2026-11-08T16:21:20Z.
- New commits read: 2 (
64ec53aafix(release): drop the alert-list check;df9d7190docs(releasing): an integrator does no implementation in its main session). Full diff2e0396e7..df9d7190read, and both files around the changes. - Read in full: 4 reviews, 2 comments, 0 inline comments (from the three files
.review-in-reviews.txt,.review-in-comments.txt,.review-in-inline.txt). - New items since my last review, and what I did about each:
- Reviewer 2's round-2 review (16:21:11, posted 9 seconds before mine, so read now for the first time). Checked its 2 non-blocking points: both are gone with the removal.
- The author's round-2 reply (16:27:20): checked each claim against the code. All hold.
- The author's comment on the new doc bullet (16:28:33): notes the owner asked for it, on 2026-11-08. The commit message says the same.
- Commit
64ec53aa: removal only. Thecaseblock and the app-slug filter from round 2 are unchanged.bash -npasses. - Commit
df9d7190: doc-only. The new first bullet in "Notes for an integrator" says the main session only coordinates and each implementation task goes to a subagent with its own worktree. Checked it against CLAUDE.md: no conflict. CLAUDE.md keepsoffload-reviewin the main session, and the bullet carves that out ("runs theoffload-reviewrounds"). The one-worktree-per-agent rule matches the global worktree rule. The owner request is written down in the comment and the commit message.
- No Go tests run. Live tests were not approved. No GitHub reads needed this round: the change removes a check and adds a doc line, and the removal's premises were proven live in rounds 1 and 2.
- Both new commits carry
Signed-off-by:and oneAssisted-By:line.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 3 of 3 | df9d7190bbca |
approve |
Verdict: approve
Findings
None.
Earlier findings
- Reviewer 1, round 2, finding 1 (blocking, the alerts check over-blocks): fixed by removal, and the reasoning was right. I checked the reasoning myself. The workflow scans the merged tree, not the PR's lines: on
pull_requestit checks out the merge commit and runsgo build ./...(.github/workflows/codeql.yaml:43), and the analysis lands onrefs/pull/<n>/merge. The alerts API for that ref has no changed-lines filter, somain's open alerts appear in every PR's list, while the ruleset blocks only new alerts in changed lines. The gate would block mergeable PRs whenevermainhas an alert. The weekly scheduled scan makes that state expected. Removal is the right call. The script and RELEASING.md now agree: theCodeQLcheck run is the only code-scanning gate. - Mine, round 2, both non-blocking points (vacuous read after a base move; the "failed read stops with an error" claim): fixed by the same removal. Both of my live proofs still stand: a ref with no analysis returns 200 with an empty list, and
refs/pull/<n>/mergemoves when the base advances. The author's new comment in the script states both facts. Accurate. - Reviewer 1, round 2, non-blocking (first-match awk over two
CodeQLruns): rejected by the author. Reason: GitHub updates a check run on a re-run; it does not add a second one. The reason is right, and reviewer 1 itself called the case theoretical. Accepted. - "A passing run can still carry an alert": removed from RELEASING.md as unconfirmed. Fair. I claimed it in round 1 from general GitHub behavior and never proved it in this repo — no open alert exists here to observe. The removal is safe either way: the ruleset itself blocks a new alert at merge time, and an
--adminmerge is still covered after the fact by the rule-results read RELEASING.md mandates.
Non-blocking
- None new. One residual, already known and accepted: the script proves a scan reached GitHub, not that the rule passes. The post-merge rule-results read in RELEASING.md covers that path.
What I checked
- Last review: round 2, 2e0396e, 2026-11-08T16:21:11Z.
- New commits read: 2 —
64ec53aafix(release): drop the alert-list check; the CodeQL run is the result;df9d7190docs(releasing): an integrator does no implementation in its main session. - Read in full: 4 reviews, 3 comments, 0 inline comments (from the three files).
- New items since my last review: reviewer 1's round-2 review at 16:21 (read in full; its blocking finding verified as above); the author's round-2 reply at 16:27 (each claim checked); the author's comment on the new bullet at 16:28; the two new commits (reviewed below).
- Read the full diff
2e0396e7..df9d7190(2 files) and the wholecheck-ready.shat the new head. The removal is clean: no leftoveralertsvariable, theapiwrapper and DCO check intact, the header comment updated to match. - Checked the two claims in the new script comment against my round-2 live proofs: the merge-ref list includes
main's alerts, and a ref with no analysis returns an empty list, not an error. Both hold. - Verified the new head live:
completed/success CodeQLfromgithub-advanced-securityondf9d7190. The script's own gate passes on this PR. - Read the new RELEASING.md bullet (line 284) in context. It matches the section's rules (one worktree per agent, brief in one message) and the repo's CLAUDE.md ("run the review in the main session"). The commit and the PR comment both say the owner asked for it on 2026-11-08. Doc-only, no behavior change.
- Both commits carry
Signed-off-by:. DCO passes. No library or proxy code is touched. No data-dependence change.
Summary
check-ready.shnow fails a PR whose head has no passing CodeQL result. This closes the gap that let 3 PRs merge past the code-scanning rule without anyone seeing it.Behavior change: none. Release scripts and docs only.
Data dependence: none. The script reads GitHub check runs only.
What we found
--admin. The merge rule results showcode_scanning=failfor all 3.--admindoes not say which rules it bypasses, andcheck-ready.shdid not check code scanning.mainafterwards. They show no new alert, and 0 alerts are open.What changed
scripts/release/check-ready.sh: a new check. The head must have a passingCodeQLcheck run, which GitHub's code-scanning app posts and the rule reads.RELEASING.md(step 2 and step 3):--adminmerge, read the merge's rule results, and tell the owner about any failed rule other than the review rule;mainto see all open alerts;RELEASING.md(integrator notes): a new first bullet. An integrator does no implementation work in its main session; subagents do it, and the main session only coordinates. The owner asked for this.How it was tested
check-ready.sh 951(a head CodeQL scanned): printscode scanning: CodeQL passed on the head.check-ready.sh 943(a head never scanned): printsNOT READY: no passing CodeQL check run on the head.🤖 Generated with Claude Code