Repository navigation
ci(cora): skip the review on a release sync identical to develop (#1022) - #1279
Merged
Merged
Conversation
…self-test scripts/cora-release-sync.sh decides, from git objects only, whether a PR is a release sync (chore/release-* into main, same repository, one commit on the tip of main) whose tree equals the tree of a develop commit. It fails closed. scripts/test-cora-release-sync.sh is its self-test (one positive case, many negative ones) and runs in the Format job (#1022).
A step after the checkout runs the script from develop and, only on a proven tree identity, skips the review and writes 'skipped, tree identical to develop at <sha>' to the job summary. The check name, permissions and trigger are unchanged; any doubt runs the review (#1022).
CONTRIBUTING (merge gate, release), AGENTS.md (release flow, large release ranges) and the changelog say when the release sync is skipped and how to check it by hand.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
…c step, document residual risks (#1022)
ajianaz
added a commit
that referenced
this pull request
Nov 28, 2026
… skipped by proof (#1022) (#1333) `Cora Review` triggers on pull requests into `main` again (`branches: [develop, main]`). The skip by tree identity for a release sync (`scripts/cora-release-sync.sh`, merged in #1279) now has an effect: a PR from `chore/release-*` into `main` that is one commit on the tip of `main` with the tree of a `develop` commit ends green with "skipped, tree identical to develop at <sha>"; any other PR into `main` gets the normal review.
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.
What
The
Cora Reviewjob skips its review step on a release sync PR whose git tree is identical to a commit ondevelop, and says so in the job summary ("skipped, tree identical to develop at "). Every other PR, and every doubt, runs the normal review.Refs #1022. This PR does not say
Closes: see "Open point: the trigger" below.Why
A release sync (
chore/release-*intomain, one squash commit with the tree ofdevelop) is hundreds of files and tens of thousands of lines, all already reviewed in the PRs that put them ondevelop. Cora cannot cover that range in the job limit, and "Review could not complete" is a merge blocker (v0.9.0 precedent, AGENTS.md infra facts). A tree equal todevelop's adds no content to review, and any change makes the trees differ and turns the review back on.Changes
scripts/cora-release-sync.sh(new): the decision. Six positional arguments (event, base ref, head ref, head repo, base repo, head sha), exit 0 = skip (stdout<develop-sha> <tree>), exit 1 = run the review, with a reason on stderr. It compares real objects only (GIT_NO_REPLACE_OBJECTS=1). Skips only when ALL hold:pull_request, base ismain, head branch matches^chore/release-[0-9A-Za-z._-]+$(a filter only);refs/remotes/origin/mainandmain..headis 1 commit (so the tree that lands onmainis the head tree for any merge method);git rev-parse <head>^{tree}equals the tree of a commit in the first-parent history (newest 200) ofrefs/remotes/origin/develop, the ref the checkout fetched from the base repository; and the checked-out tree equals the head tree..github/workflows/cora-review.yml: new stepIs this a release sync with the tree of develop?after the checkout. It reads the script fromrefs/remotes/origin/develop(git show), runs it with the event data passed throughenv:(no${{ }}insiderun:) and without the Cora token (env -u ACCESS_TOKEN), validates the output with a regex, then writes the summary and a::notice::. The ci: a docs-only PR makes the Cora review answer "could not complete" because docs/** is excluded #914 scope step and the review step are gated onsteps.release_sync.outputs.skip != 'true'. Permissions (contents: read,pull-requests: write,security-events: write,id-token: write), the job nameCora Reviewand thepull_requesttrigger are unchanged. Nopull_request_target.scripts/test-cora-release-sync.sh(new, wired into theFormatjob ofci.ymlnext to the ci: a docs-only PR makes the Cora review answer "could not complete" because docs/** is excluded #914 self-test).CONTRIBUTING.md(new "Release sync PRs (ci(cora): skip Cora Review on a release sync PR whose tree is identical to develop #1022)" under the merge gate with its residual risks, a paragraph under Release validation),AGENTS.md(release flow and the large-release-range note, minimal),CHANGELOG.md: what is skipped, when, and how to check it by hand.Security properties
developcomes from the base repository: the job'soriginis the base repository and the script reads only the fully qualifiedrefs/remotes/origin/develop. A local branchdevelop, a branch namedorigin/develop, a tagdevelopor another remote'sdevelopcannot stand in (tested).develop, never from the PR checkout. A PR cannot edit the check. Where the script is missing or unreadable, the review runs.rev-parse,rev-list,log --format=%H %T): no diff driver, textconv, hook or filter, and nothing from the PR checkout is executed.skip=false.develop's, so its workflow files equaldevelop's too.Negative cases (all run the normal review; all in the self-test)
Second commit with the same tree; one differing file; one extra file; a merge commit with develop's tree; a root commit; main moved after the sync was cut; a sync cut from an older main; a commit message claiming identity; head branch
develop,chore/release,chore/release-,feat/x,evil/chore/release-v1, with a space, with a newline, empty; basedevelop/main2/ empty; eventspull_request_target,push,merge_group, empty; fork, look-alike repo name, deleted fork (empty head repo), empty base repo; empty, abbreviated, uppercase, non-existing, ref-name and tree-object head shas; 5, 0 and 7 arguments; checkout not at the head tree; no develop ref, only a local develop branch, a localorigin/developbranch plus a tag, another remote's develop; develop lacking the tree; tree only on another branch; tree only in a merged side branch (off the first-parent line); the matching develop commit more than 200 commits back; a shallow clone; arefs/replaceentry that makes an evil head look like a develop commit. Positive: identical tree on the tip of main (also with develop moved on after the cut, 150 commits back, and on a branch checkout).Residual risks
pull_requestrun uses the merge ref's workflow), as it could before this change; the usual guard is branch protection and CODEOWNERS on.github/workflows/. When the skip legitimately applies the workflow files equaldevelop's.main): ifmainmoves after the check ran, GitHub does not re-run the job and the merge result is a three-way merge. A merge queue (merge_groupis skipped by this job) or "up to date" strict checks close it; otherwise re-push the release branch. Documented in CONTRIBUTING.developand reviewed there, but the release is then older thandevelop's tip. Documented in CONTRIBUTING.developrather thanmain, becausemaindoes not have the script until the first release containing it (reading it frommainwould defeat the first use).developis the ref the proof itself is anchored to and is protected the same way. The independent review judged this acceptable;scripts/is not inreview.exclude, so a change to the script is itself reviewed.GITHUB_STEP_SUMMARYand the notice are the visible record; no PR comment is posted.Open point: the trigger
cora-review.ymllistsbranches: [develop]since #1021 (owner decision of 2026-11-20): PRs intomainget noCora Reviewrun at all today, so this step has no effect untilmainis listed again. I did not widen the trigger: it reverses an owner decision and would also put a full (failing) review back ondevelop-headed PRs tomain. To activate:branches: [develop, main]in.github/workflows/cora-review.yml, an owner call. The workflow file of apull_requestrun comes from the merge ref, so this change, and that one, only take effect for a release branch built after they land ondevelop; the v0.12.0 sync (#1021) cannot use it.Testing
bash scripts/test-cora-release-sync.sh: all cases passed on the final head (throwaway bare origin and clone; 1 skipping case plus its variants, the rest negative). The new replace-ref case fails when theGIT_NO_REPLACE_OBJECTSline is removed (checked).bash scripts/test-cora-all-excluded.sh: all cases passed (unchanged).run:block, extracted from the YAML and run locally in a clone with a GitHub-style merge commit asHEAD: skip case wroteskip=true, the summary and the notice; fork case and a missing script on develop wroteskip=false(run before theenv -u ACCESS_TOKENchange, which adds no other behaviour).python3 -c 'import yaml; yaml.safe_load(...)'on.github/workflows/cora-review.ymlandci.yml: both parse.actionlint,shellcheckandyamllintare not installed here and were not run.scripts/arch-check.sh all: ok.scripts/review-local.sh/cora review(nocorabinary here);cargo fmt/clippy/test(no Rust changed). The Cora gate on this PR is the CI job.refs/replace, hex-named branch and tag on the head sha, trailing newline in the head ref, aninfo/graftsentry, a merge commit with develop's tree). Verdict: SECURE WITH NITS. Quoting, the develop trust anchor,originbeing the base repository, the parent and window rules, the output regex, fail-closed paths and the step gating were checked OK. Findings and handling: (1) arefs/replaceentry made a script skip an evil head: fixed withGIT_NO_REPLACE_OBJECTS=1and a self-test case (a PR cannot plant that ref, defence in depth); (2) the script ran withACCESS_TOKENin its environment: fixed withenv -u ACCESS_TOKEN; (3) time of check vs. time of merge and (4) the 200-commit window: documented as residual risks in CONTRIBUTING and above; (5) the by-hand check is simpler than the job: accepted, it is a human check. Not verifiable by the reviewer: the real GitHub runtime (the merge ref andactions/checkoutlayout; if they differ the script never skips, fail-closed), and whether branch protection onmainrequires up-to-date branches.