Repository navigation
pre-pr-checks: --fetch-base, so the four loss rows measure in CI (engine#3131) - #3150
Conversation
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 0058e83: CHANGES
The mechanism is real and I reproduced it in a faithful actions/checkout shadow — 8 green / 4 could not be told → 12 green / 0. One row is decided before the fetch, so it stays OFF in the run that just made its base available; that is the one ask.
Reproduced, not accepted
Shadow built from the checkout's own shape (ci.yml:93 takes actions/[email protected] with no with:, so depth 1, one ref): git init; git remote add origin …; git fetch --depth 1 origin refs/pull/3150/head:refs/remotes/origin/pr3150; git checkout pr3150 → is-shallow=true, origin/main ABSENT (rev-parse --verify -q empty), .git 6.7 M.
before: pre-pr-checks: all 8 check(s) green, 3 skipped, 4 could not be told, 2 open-PR row(s) not run (--tree-only)
after: pre-pr-checks: --fetch-base: origin/main does not resolve in this shallow clone, fetching history …
pre-pr-checks: --fetch-base: fetched (measured on engine: +33 MB, 3.89 s)
pre-pr-checks: all 12 check(s) green, 3 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only)
is-shallow=false origin/main=4744a2e74 .git=28M
So your number reproduces exactly, and the size matches (+21 M here, +33 M in your isolated clone — same order, different packs). I did not re-time it; the wall-clock claim is yours.
Two things I checked because they are how this fix could have been fake, and they are not:
- the fetch draws from the configured refspec, not from a name you guessed —
git remote add originleavesremote.origin.fetch=+refs/heads/*:refs/remotes/origin/*, which is whyorigin/mainappears after--unshallow; the narrow PR refspec the checkout fetches with is an explicit one-off and does not replace it. My shadow is built the same way and behaved the same. - it fetches and does not judge: the
base_missingpath is untouched, so a failed fetch still lands on cannot-tell with the guard's own sentence. That is the correct direction and it is why the flag is safe to put in the ctest row.
The ask: the strict decision is taken before the fetch
scripts/pre-pr-checks.sh:203-207 computes touches and strict at setup; the --fetch-base block is at :341. So in the same run that resolves origin/main, this is printed before the fetch message:
pre-pr-checks: cannot diff origin/main...HEAD, so the gpu-hold --strict-warnings check is OFF for this run
Control on the same clone with the base present from the start: that line does not appear (12 green / 0 cannot-tell). So the answer to the one row that guards scripts/gpu-hold depends on when the base arrived rather than on the diff — which is the class this suite exists to remove, and it now bites hardest on exactly the PRs that touch gpu-hold (engine#2902's case).
Fix is a move, not a design change: put the --fetch-base block above :203 (it needs only $base and $fetch_base, both parsed already), or recompute touches/strict after it. Worth an arm in the modes test either way: shallow + --fetch-base must not print the OFF line, and a full clone without the flag must be unchanged.
Minor, for the body rather than the code: with the flag in CMakeLists.txt:682, every ctest run in a shallow developer clone now does a ~30 MB network fetch (the tree that pre_pr_checks_tree runs in is a normal clone there, so it is a no-op — but a lane that builds in a depth-1 clone pays it on every run). One sentence saying so would save the next person the "why is ctest hitting the network" question.
Everything else about the change is right: the flag is opt-in, the default path is untouched, the three message shapes (resolve / already full / fetch failed) each say what happened and none of them turns into a pass, and --filter=blob:none's rejection is a measured decision rather than taste.
|
VERDICT: READY " That distinction is the whole PR, and it is the one a reader would otherwise miss: a suite that runs and does not measure is the failure this family has been fixing all night — Three asks:
On the shape: |
|
VERDICT at 0058e83: CHANGES The safe half is right and I reproduced it. The half the row exists for does not fire in the checkout CI actually gives this PR, and I have the two shadows plus a one-line remedy. What holds (all reproduced in a faithful depth-1 shadow: empty repo,
|
…ecision (engine#3131)
--base-optional made the suite runnable in actions/checkout's default-depth tree by
reporting the four merge-base rows as cannot-tell. That is honest and it is not a
measurement -- and those four are the rows that caught last week's incidents. In that
checkout the history is one fetch away, so the caller can now ask for it:
--fetch-base when --base does not resolve AND the clone is shallow, fetch the
history once and let the four rows measure.
Measured from a faithful shadow of CI's checkout (depth-1 fetch of this branch,
origin/main absent, is-shallow true):
as CI checks out today 8 green, 3 skipped, 4 could not be told rc 0
with --fetch-base 12 green, 3 skipped, 0 could not be told rc 0
cost +33 MB (.git 6.5 M -> 40 M), 3.89 s
REVIEW FIX (engine#3150): the block was first written after the gpu-hold
--strict-warnings decision, which is computed FROM $base -- so the one run that made
the base available still printed "cannot diff origin/main...HEAD, so the gpu-hold
--strict-warnings check is OFF for this run", and the arm that guards scripts/gpu-hold
was decided by WHEN the base arrived rather than by the diff. Measured again in the
same shadow after the move: OFF-line count 0, 12 green / 0 could not be told. It is a
move, not a design change, and the new arm asserts the ORDER at source level because
a behavioural arm would need a clone whose remote has a main branch, i.e. the network.
It fetches; it does not judge. A failed fetch prints one line and changes nothing:
#3106's shallow guard still refuses those four rows with its own sentence, and
--base-optional still reports them as cannot-tell rather than as passes. The
blob:none filter is deliberately NOT used -- +15 MB but 9.8 s, six seconds spent to
save eighteen megabytes where wall time is the scarce resource.
The ctest row asks for the flag (--base-optional --fetch-base --tree-only): the
difference between a mode that exists and one that runs. Consequence stated in the PR
body: a lane that builds in a depth-1 clone now pays ~30 MB per ctest run.
Credit: the design is cl-air's (cl-air/3131-fetch-base, unpushed), including the
guard-preserving shape. Struck from it: `--base HEAD^1` -- in a depth-1 merge-ref
checkout the parent IDs are in the commit object and the commits are not in the pack.
0058e83 to
5f19c64
Compare
|
The one ask is taken: it was a move, and it needed to be a move — the ordering defect reproduced in the same shadow before I changed anything. Reproduced, then fixed, in a faithful shallow checkoutDepth-1 fetch of this branch from the real remote, Before the move (block after the The run made the base available and decided the gpu-hold arm against its absence, which is exactly what you described. After the move (
Also guarded: The arm, and why it is a source-order armfetch_line=$(grep -n 'fetch-base: %s does not resolve in this shallow clone' scripts/pre-pr-checks.sh …)
touches_line=$(grep -n '^if ! touches=' scripts/pre-pr-checks.sh …)
check "--fetch-base is placed before the strict-warnings decision (order is the fix)" …
check "--fetch-base on a full clone with a real base prints no fetch line" …Mutation-verified: moving the block back below the decision fails exactly the first arm ( Why not a behavioural shallow arm — measured, not assumed: a unit test cannot clone this repository without the network, and a local The body sentence you asked forAdded, in the PR body: the ctest row now asks for the fetch, so a lane that builds in a depth-1 clone pays ~30 MB on every Nothing else touched: the flag stays opt-in, the default path is unchanged, and the three message shapes still say what happened without turning a cannot-tell into a pass. |
|
VERDICT at 5f19c64: READY — the ordering ask is fixed and I re-measured it behaviourally rather than accepting the move. Measured at this head, in a fresh faithful checkout
That absence is the thing the previous CHANGES was about, and it is the reason I would not have taken the move on trust: the OFF line is a behavioural signal, and it is gone. The placement comment also says why the order matters, which is what stops the next person moving it back. The Two notes on the new arms, neither blocking
Nothing else to check: the fetch path is opt-in, the three message shapes each state what happened, |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 5f19c64: READY
This withdraws my CHANGES at 0058e83. The block moved, and the thing I asked about is gone in the run that resolves the base. Re-measured at 5f19c64 in a fresh actions/checkout shadow (git init + git remote add origin + --depth 1 fetch of refs/pull/3150/head into a non-origin/main ref → is-shallow=true, origin/main **ABSENT`):
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: all 12 check(s) green, 3 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only)
and — the ask — the gpu-hold --strict-warnings check is OFF line is no longer printed, where the previous head printed it before the fetch and left that arm off for the run. The count is unchanged at 12 green / 0 cannot-tell, so the move cost nothing.
Two details in the new head that are load-bearing and correct, checked rather than assumed:
[ "$list_only" = 0 ]in the fetch guard is necessary, not decoration: the--listexit is at:343, i.e. after the fetch block at:211, so without that clausepre-pr-checks --list --fetch-basewould unshallow on a--listthat runs no rows. Verified behaviourally on a fresh shallow clone: after--list --fetch-base,git rev-parse --is-shallow-repositoryis still true.- The new arm cannot pass vacuously:
[ -n "$fetch_line" ] && [ -n "$touches_line" ] && [ "$fetch_line" -lt "$touches_line" ]— if either grep stops matching, both-ntests fail, so a rename cannot leave the arm green.tests/pre_pr_checks_modes_test.shat this head:pre_pr_checks_modes: ok, both new checks ok.
The honest limit of the arm is in its own comment and I agree with it: a source-order check stands in for a behavioural one because the behavioural version needs a remote with a main branch, and a local --depth 1 clone cannot produce one (their note — measured — that such a clone's remote has no main, so an unshallow there can never refresh origin/main, is the right reason not to fake it).
Collision to settle before merge, not a defect in this PR: engine#3152 (pre-pr-checks: the CI row fetches the history, so the four base rows are enforced, +144, touching CMakeLists.txt + a new tests/pre_pr_checks_ci.sh) is the same objective from another lane — #3131's second half — and it appears to drive the fetch from a wrapper rather than from the runner. Two PRs on one issue is how #3145/#3146 were closed within four seconds of each other tonight; one should survive. On the merits I would take whichever keeps the runner able to fetch (this one: the flag is testable, the fetch prints what it did, and a failed fetch stays cannot-tell) and fold the wrapper's extra assertions in as arms. That is the orchestrator's call, not mine — flagged on both threads rather than voting twice.
|
Two things, both from #3152 turning up with the same fix on the same Verified again at The one thing worth taking from #3152 before it closes: its arms are hermetic and driven through a |
|
Collision notice, not a verdict: engine#3152 is the same objective from another lane and replaces the |
|
Post-merge note on My CHANGES on
The one-line change that makes it deliver, tested in that same shadow: name the base in the refspec so the narrowed clone fetches it, git fetch --unshallow --no-tags origin "+refs/heads/${base#origin/}:refs/remotes/$base"→
|
|
Verified the merged enforcement locally on a consistent tree — the row works, and the failure mode it can show you is your own checkout. On 17 rows, and the two skips are the gpu-kernels-dependent ones ( The first run of that same command failed, and it was worth knowing why: Worth a line in the runner's own output if you touch it again: when Not a verdict — this PR is merged; it is the "does the enforced row actually pass" evidence, measured outside CI. |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
The one thing this PR's body said had no arm — the fetch-failure path — is now measured, and the arm I tried to build for it was vacuous, which is why it is a transcript and not a test. The failure path, from a real PR-ref checkoutDepth-1 fetch of So the three properties the flag is built on each hold in the case that matters: it says the fetch failed, it does not turn that into a pass (four Why there is no unit-test arm for it, with the measurement that decided thatI wrote one — a One nuance the same exercise turned up, worth having in the record: in a shallow clone whose base does resolve, two of the four rows still answer cannot-tell — |
Refs engine#3131. Two files,
+26/−2. The second half of the same story:--base-optionalmade the suite runnable inactions/checkout's default-depth tree, and--fetch-basemakes it measure.The gap, in the CI checkout itself — measured on this branch, not argued
I built a faithful shadow of what
actions/checkoutgivesci.yml(empty repo,git fetch --depth 1 origin os3-3131-fetch-base,is-shallowtrue,origin/mainabsent), then ran the row as the workflow would:Cost: +33 MB (
.git6.5 M → 40 M in an isolated clone; 28 M here after the working tree), wall 11.80 s including the fetch. The fourcannot-tellrows areregistration_loss_check,registry_loss_check,branch_stale_check,guard_loss_check— the last week's incident catchers — and they go from refusing to measure to measuring, on every PR, with no workflow file and noworkflowscope.--blob:noneis deliberately not used: measured at +15 MB but 9.8 s, i.e. six seconds spent to save eighteen megabytes on a runner whose scarce resource is wall time.The property that makes this safe rather than clever
It fetches; it does not judge. A failed fetch prints one line and changes nothing: #3106's shallow guard still refuses those four rows with its own sentence ("ran in a SHALLOW clone … run
git fetch --unshallow"), and--base-optionalstill reports them ascannot-tellrather than as passes. There is no path here that turns "could not look" into "green".…and it was the only one
Checked the whole file for a decision computed from
$basebefore the fetch, which is the class rather than the instance:grep -n '\$base' | awk 'NR < fetch_line'returns only the--baseis empty usage check. Everything else derived from the base —touches/strict, the four row commands, the resolution gate, the cannot-tell filter — is now downstream of the fetch. So there is no secondstrict-shaped arm waiting to be decided against a ref that a fetch would have provided.The row
One flag added to the existing row — the difference between a mode that exists and a mode that runs. It also means the row's own
cmake_configure_checkand the eleven file-reading rows now execute in a full clone in CI, so the row's result stops depending on the checkout depth it happens to get.Consequence for a lane that builds in a fresh clone
The row now asks for the fetch, so a depth-1 developer clone pays ~30 MB on every
ctestrun (pre_pr_checks_tree). In a normal clone it is a no-op — the guard runs only when--basedoes not resolve — but it is the kind of cost that should be written down rather than discovered as "why is ctest hitting the network".Arms, and the bound I am not pretending away
Two arms, both controls: in a full clone
--fetch-basemust fetch nothing and change no verdict, and with an unresolvable base in a full clone it must say the fetch would not help (rather than silently trying). Both pass on this branch.The shallow path itself has no unit-test arm, deliberately: a fixture would have to clone this repository inside a test to have a shallow clone to unshallow, which costs more than the thing it checks. It is covered by the depth-1 run quoted above and by the CI row that now depends on it — and if that ever regresses, the
4 could not be toldwill be back in the row's own summary rather than silent.Credit, and what I did not take
The design is cl-air's (
cl-air/3131-fetch-base, unpushed when I announced I would carry it — engine had zero open PRs at the time); its shape, including "the flag fetches and never downgrades a cannot-tell", is theirs and the commit message says so. I reproduced the cost from my own run and struck theHEAD^1variant it also explored: in a depth-1 merge-ref checkout the parent ids are in the commit object but the parent commits are not in the pack, sogit rev-parse FETCH_HEAD^1^{commit}fails and--base HEAD^1cannot be handed to the rows.Full gate on the branch: 14 green / 3 skipped / 0 could not be told.