Skip to content

/ship can clear its test gate from CI on a branch stacked on another branch (GST-3381) - #4689

Merged
capy-ai[bot] merged 3 commits into
mainfrom
pregate-clear-reads-record-base
Nov 22, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
pregate-clear-reads-record-base

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

When a branch is stacked on another branch, /ship can now clear its test gate from a green CI run instead of refusing with base_mismatch.
Teams that ship stacked branches were stuck: the record named the stacked base, but the check read run profiles from the default branch.
Nothing to do: branches based on main behave exactly as before.

What changed

  • gstack-pregate clear --run reads run profiles from the base branch the gate record was made against, not from origin/HEAD. A new optional clear --base <branch> names it explicitly; a --base that differs from the record is refused with base_mismatch before any evidence is read, for every clear route.
  • The CI reuse inside gstack-pregate --base <branch> (what gstack-ship-release accept --base runs) clears the gate against that same base.
  • Accepting a run of a version-bump-only parent commit keeps the default branch's rule on purpose (docs/pregate.md#remote-gate-stamp-only).
  • docs/pregate.md, docs/troubleshooting.md and the CLI help say where run profiles come from.

Why

"REUSE: refused reason=base_mismatch" blocked /ship on every branch stacked on a base other than main, even with green CI at the head. The record already names its base, so the clear now trusts the same base the gate run trusted.

Blast radius

Only gstack-pregate clear and the CI reuse inside gstack-pregate --base. Records made against main resolve to the same base as before, so their behavior is unchanged (bin/gstack-pregate:274 read; the existing clear tests in test/pregate-clear-runs.test.ts still pass). Rung: script ran (494 targeted tests).

Pre-Landing Review

REVIEW_LOOP: passes=2 blocking_found=2 deferred=0 noted=5 fixed=2 scope=frozen ledgers_read=3 dispatches=8
Gate edits: none detected (GATE_SCAN tagged=0 at e660b0b)

Fixed in this PR: a --base that differed from the record could let the bundle option skip run verification (second-model review), and a programmatic clear with no base got the wrong fix hint.

Review notes

Below the blocking floor; recorded here and not fixed in this PR. GSTA-724, GSTA-725 and GSTA-726 reported the refusal.

  • bin/gstack-pregate:274 The record's base now chooses run_profiles; no consumer binds the record base to the PR base (red team and adversarial review; the ruled note in Agent notes covers the same gap).
  • lib/pregate/index.ts:389 Accepting a version-bump-only parent run on a stacked base refuses with advice to rerun against main.
  • bin/gstack-pregate:276 The early base_mismatch refusal also covers the run-URL and saved-result routes; the test covers only the run-ID and bundle routes.

Documentation

Status: updated — one factual correction, no blockers.

Scope: commits 6acb93a..e660b0b against base c2b4f0d2 (bin/gstack-pregate, lib/pregate/index.ts, docs/pregate.md, test/pregate-clear-stacked-base.test.ts, changelog.d/pregate-clear-reads-record-base.md); nothing staged, unstaged or untracked. Audited docs/pregate.md, docs/troubleshooting.md, docs/ship-policy.md, the ship templates that mention gstack-pregate clear, and docs/evals/ship-conductor-fold-prereg.md.

Documentation health:

  • docs/pregate.md: current (the branch updated run evidence for the record's base and clear --base)
  • docs/troubleshooting.md: updated (the PREGATE_RECEIPT_INVALID entry now says run profiles come from the base pregate.json was recorded against, and that --base naming another branch refuses base_mismatch)
  • docs/ship-policy.md, ship/sections/tests.md.tmpl, ship/DRIVER.md.tmpl, ship/sections/pr-body.md.tmpl: current (they don't describe where profiles come from)
  • docs/evals/ship-conductor-fold-prereg.md: not edited (frozen preregistration; describes earlier behavior)

Coverage debt: gstack-pregate clear --base <branch> has reference coverage (CLI help, docs/pregate.md#run-evidence, troubleshooting) but no how-to for clearing on a stacked branch. That is a common gap.

Diagram drift: none.

Tests

  • bun --no-env-file test --timeout=30000 test/pregate-*.test.ts: 494 pass, 0 fail at 0f09ebf (40 files; includes the new test/pregate-clear-stacked-base.test.ts, which fails on main and on 6acb93a without the --base guard).
  • bun run test: runs in CI at this head.
Agent notes

Agent notes

Refs GST-3381

Approvals

Approved: yes (record r-572964556081). The full approval record stays private.
Plan: exempt: bug fix with a failing-first test (GST-3381)
Plan check: exempt bug fix

Ruled note: lib/pregate/index.ts:131:base-binding at e660b0b ruled by GStack Minder (relayed from GSTA-36:2026-11-22T06:00:00Z) at 2026-11-22T05:46:04.123Z: finish's pregate verify does not bind the record's base to the ship base; pre-existing gap, follow-up adds verify --base and has finish pass its base (approval a-9cd4c54e2246)

gstack: ok 1.102.2.0 for=ship

{
  "schema_version": 1,
  "pr": 4689,
  "head": "0f09ebfa380280a03302c66ba8fbc9f184d45608",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "pregate": {
      "pass": 494,
      "fail": 0,
      "skip": 0
    },
    "free": {
      "pass": 1744,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 44995622106,
      "attempt": 1,
      "tree": "fdd2515d31cca1b4ae5b9cc3aed8d3fe626ea16c"
    }
  ],
  "session_kind": "unattended",
  "run": "/home/user/.capy/work/ship-pregate-clear-reads-record-base",
  "head_tree": "fdd2515d31cca1b4ae5b9cc3aed8d3fe626ea16c",
  "product_patch_id": "19f46efbfecce6847d6b92cb4bc2d523e0f36b0e",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 37,
    "rules": "630fd3101899e28e",
    "base": "c2b4f0d2adfa66e11143b95d9a42023a09380212",
    "registry": "c2b4f0d2adfa66e11143b95d9a42023a09380212",
    "gate_scan": {
      "tagged": 0,
      "head": "0f09ebfa380280a03302c66ba8fbc9f184d45608"
    },
    "reasons": [
      "gate-class",
      "runtime=37"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @fdd2515d31cc (8 checks, current for 0f09ebfa3802)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44995622106/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44992850424/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=fdd2515d31cc tests=38817 skipped=71 runs=44995622106/1 profiles=ci-reuse/free-tests heads=0f09ebfa3802 verified=2026-11-22T07:50:32.105Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/ and README.md (docs/pregate.md, docs/troubleshooting.md, docs/ship-policy.md, ship templates naming gstack-pregate clear)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 2,
    "deferred": 0,
    "noted": 5,
    "fixed": 2,
    "scope": "frozen",
    "rounds": 2,
    "ledgers_read": 3,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  },
  "ruled_notes": [
    {
      "finding": "lib/pregate/index.ts:131:base-binding",
      "head": "e660b0bb903f3ca6466acd4613505b6738243a79",
      "by": "GStack Minder",
      "reason": "finish's pregate verify does not bind the record's base to the ship base; pre-existing gap, follow-up adds verify --base and has finish pass its base",
      "at": "2026-11-22T05:46:04.123Z",
      "approval": "a-9cd4c54e2246",
      "relayed": "GSTA-36:2026-11-22T06:00:00Z"
    }
  ],
  "gate_dispositions": []
}

garrytan and others added 3 commits November 22, 2026 04:46
…s (GST-3381)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…fore it reads any evidence

A --base naming another branch now refuses base_mismatch for every clear route, --bundle-lane included, and a programmatic clear with no base keeps the origin/HEAD fix hint.

Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/adversarial-native#3 reader=adversarial-native
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… of the base the record names

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

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