DIVE-4090: derive the file-size ratchet base from the merge commit, not a branch name and a pasted sha - #17
Merged
Conversation
…ot a branch name and a pasted sha The weekly upstream-sync PR carries a merge commit whose second parent is upstream's tip; the ratchet's default base (HEAD^1, our pre-merge main) reads every upstream commit as this PR's diff (DIVE-3850). Two fixes keyed the override on the branch name and pasted the sha: the name slipped in week 4 (DIVE-4069), the widened predicate now over-matches any `dive-*-sync` feature branch onto week 3's stale sha (DIVE-4090). - scripts/resolve-file-size-base.sh runs before `File size policy`: on a pull_request run it fetches exactly this PR's commits on top of the depth-2 checkout (--shallow-exclude=<base>, trees only), walks the PR's first-parent chain, and exports the first foreign second parent as CHECK_FILE_SIZES_BASE. Anything else keeps HEAD^1. It prints one `ratchet-base:` line saying which base the run got and why. - scripts/test-resolve-file-size-base.sh: four shapes at fetch-depth 2 from a bare origin (plain feature, sync + fix-up, feature that merged main, push) plus the full-history path. - ci.yml: fetch-depth back to a plain 2 (upstream-identical), the env literal and both name predicates removed. Receipts: on the week-3 tree (PR #14's merge-ref shape, the case where the bases disagree) HEAD^1 is rc=1 on `agent_models_tests.rs: 965 -> 1001` and the derived base c3132c3 is rc=0 on desktop/web/mobile; a depth-2 emulation of week 4's merge ref resolves to 3c7f288 in 1.6s; live PRs #9 and #10 resolve to HEAD^1.
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.
Row: DIVE-4090 (parent DIVE-4069). Both failures named there dissolve by reading the ratchet base off the merge commit instead of a branch name plus a pasted sha.
What changes
scripts/resolve-file-size-base.sh(new) runs right beforeFile size policy. On apull_requestrun it fetches exactly this PR's commits on top of the depth-2 checkout (git fetch --filter=blob:none --shallow-exclude=<base> origin <head>), walks the PR's first-parent chain reading raw parents (git cat-file -p, because a shallow boundary commit is grafted parentless), and exports the first foreign second parent asCHECK_FILE_SIZES_BASE. A second parent that is absent after a fetch that excluded the base branch is, by construction, on the base branch, so a feature branch that mergedmaininto itself keepsHEAD^1. Push events keepHEAD^1. It prints oneratchet-base:line: the receipt for which base this run got and why.scripts/test-resolve-file-size-base.sh(new): four shapes checked out the wayactions/checkoutdoes (refs/pull/N/mergeat depth 2 from a bare origin): plain feature, sync merge + fix-up, feature that merged main, push event; plus the full-history path..github/workflows/ci.yml:fetch-depthback to a plain2(upstream-identical), the env literal and bothhead_refpredicates removed. The fork's delta in this file is now the one added step.Why not the name predicate
contains(head_ref, '-sync')put anydive-*-…-sync-…feature branch onto week 3's sha. Now a branch name is never read; a plain-commit PR resolves toHEAD^1whatever it is called. This PR's own branch is named…-sync-derivedon purpose: itsResolve file size ratchet basestep must printratchet-base: HEAD^1 (no merge commit among this PR's 1 first-parent commit(s)).Receipts (a green run is not evidence here; these are the cases where the bases disagree)
main 1c28c6e3d+ head7bd362744, a fix-up above sync merge9436a3bdd), same checker, only the base changing:HEAD^1→ rc=1:src-tauri/src/commands/agent_models_tests.rs: 965 -> 1001 (+36) lines (allowed 1000)ratchet-base: c3132c3ee982d194cd0198ad07b57ec8bd726e4e (second parent of merge commit 9436a3bdd, the foreign side of a wholesale merge; 2 first-parent commit(s) on this PR)→ rc=0 on desktop, web, mobilec3132c3ee(the old literal) → rc=0, identical21241a0dd= mainf745e5546+ head76ec11e9f, base ref pointed at pre-merge main):ratchet-base: 3c7f288c60d67df78577b237e27c3dfc8831aaa1 (second parent of merge commit 76ec11e9f …), 1.6s wall including the fetch, ~44 KB of pack.dms listmust query the relay-emitted kind:39000, not kind:41001 #9 and fix(pairing-cli): send the JSON envelope the apps decode, and stop panicking on wss:// #10 at depth 2:ratchet-base: HEAD^1 (no merge commit among this PR's 1 first-parent commit(s)), 0.85s.dive-0000-probe-sync, this branch +refs/pull/9/headmerged with--no-ff) is opened alongside; its step must print the second-parent receipt. It is a probe, not for merging.Residual, named not fixed
pushruns keepHEAD^1. Week 3's push tomainatf745e5546was red on this step for the same reason (nothing was gated by it). On a push there is no base ref to exclude, and a bounded walk intomain's history could bind to last week's sync merge, which would loosen the ratchet rather than fix it. Left as status quo.Same change on
5dive-ai/5dive-chat, byte-identical blobs (git hash-objectper file in that PR's body).