Skip to content

ci: guard ratchets compare to main's tip at section start, not the run's build base #4861

Closed

Description

@noahgift

The guard-tree and guard-cargo sections fetch the origin/main tip when the section starts, and every baseline ratchet in them compares against it. A section can start hours after the merge commit it judges was built, so a branch that never touched a baseline goes red when main shrinks that baseline in the meantime.

Observed (#4813): the run built merge 092b5e990 on base 358e9d4d11, where scripts/pipe_grep_q_baseline.txt records 62. The guard section started later, when main was ece9e563bd; da7059c5c7 had shrunk the count to 60 in between. check_baseline_ratchets reported pipe_grep_q_baseline.txt GREW (62 vs 60). #4813 does not touch the file.

Fix: pin refs/remotes/origin/main to the run's build base before the guard steps: the first parent of the merge commit on pull_request, merge_group.base_sha on merge_group (as the refinement gate already does), and the tip (deepened by one on push) otherwise. Re-adding an entry main deleted is still refused, by the merge_group run, which is built on main as it merges.

Epic: #3863

Activity

  1. added this to the backlog milestone on Oct 8, 2026
  2. added a commit that references this issue on Oct 10, 2026
  3. noahgift commented on Oct 12, 2026

    @noahgift
    MemberAuthor

    evidence for close: #4996 / 5a3b047 (on main), how checked:

    • scripts/ci/pin_build_base.sh is on main and pins the build base per event: pull_request uses the merge commit's first parent, merge_group uses merge_group.base_sha.
    • It is wired into ci/sections.yml (--self-test then the run, ~:1193-1194, and again in the second guard section ~:1728).
    • Its mutation case is C16 in scripts/tests/ratchet_semantics_test.sh.
  4. noahgift commented on Oct 12, 2026

    @noahgift
    MemberAuthor

    Cop batch close (FLOW-004 drain, ≤43/d): fix verified on main — merged #4996 ; ancestor of origin/main: 5a3b047 . Evidence: #4861 (comment)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions