Skip to content

DIVE-4090: derive the file-size ratchet base from the merge commit, not a branch name and a pasted sha - #17

Merged
lodar merged 1 commit into
mainfrom
dive-4090-ratchet-base-sync-derived
Sep 8, 2026
Merged

lodar merged 1 commit into
mainfrom
dive-4090-ratchet-base-sync-derived

Conversation

@lodar

@lodar lodar commented Sep 8, 2026

Copy link
Copy Markdown

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 before File size policy. On a pull_request run 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 as CHECK_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 merged main into itself keeps HEAD^1. Push events keep HEAD^1. It prints one ratchet-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 way actions/checkout does (refs/pull/N/merge at 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-depth back to a plain 2 (upstream-identical), the env literal and both head_ref predicates removed. The fork's delta in this file is now the one added step.

Why not the name predicate

  • Over-match (quinn, DIVE-4069): contains(head_ref, '-sync') put any dive-*-…-sync-… feature branch onto week 3's sha. Now a branch name is never read; a plain-commit PR resolves to HEAD^1 whatever it is called. This PR's own branch is named …-sync-derived on purpose: its Resolve file size ratchet base step must print ratchet-base: HEAD^1 (no merge commit among this PR's 1 first-parent commit(s)).
  • Stale sha (olivia, DIVE-4069): nothing is pasted; the weekly sync row no longer owes a bump.
  • Name slip (week 4, DIVE-4051): a sync branch called anything at all is detected by its merge commit.

Receipts (a green run is not evidence here; these are the cases where the bases disagree)

  1. Week-3 tree, PR DIVE-3850: weekly upstream sync — merge block/buzz main (100 behind) #14's merge-ref shape (main 1c28c6e3d + head 7bd362744, a fix-up above sync merge 9436a3bdd), same checker, only the base changing:
    • HEAD^1 → rc=1: src-tauri/src/commands/agent_models_tests.rs: 965 -> 1001 (+36) lines (allowed 1000)
    • resolver → 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, mobile
    • pasted c3132c3ee (the old literal) → rc=0, identical
  2. Depth-2 emulation of week 4's merge ref (21241a0dd = main f745e5546 + head 76ec11e9f, 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.
  3. Live merge refs of fix(cli): dms list must 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.
  4. Contract test: 6/6 cases, 0.8s.
  5. Live arm: a merge-shaped probe PR (dive-0000-probe-sync, this branch + refs/pull/9/head merged 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

push runs keep HEAD^1. Week 3's push to main at f745e5546 was 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 into main'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-object per file in that PR's body).

…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.
@lodar
lodar merged commit e7f65c4 into main Sep 8, 2026
226 of 245 checks passed
@lodar
lodar deleted the dive-4090-ratchet-base-sync-derived branch September 11, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant