Skip to content

v1.92.55.0 fix(ship): finish routes a restamped stale stamp as metadata after a lost slot (GST-895) - #3827

Merged
capy-ai[bot] merged 5 commits into
mainfrom
gst-895-stale-stamp
Nov 2, 2026
Merged

capy-ai[bot] merged 5 commits into
mainfrom
gst-895-stale-stamp

Conversation

@garrytan

@garrytan garrytan commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3827,
  "head": "68548ce721f5ce3bd967aea10bda209d53e9a0b6",
  "version": "1.92.47.0",
  "base": "main",
  "gate": {
    "focused": {
      "pass": 119,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "0ca1768da4a24c1e56fd8dfeb195c6634523c013",
  "product_patch_id": "6ba597729b35fef450006a9e805a2870cbad5734",
  "gstack_version": "1.92.47.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 39,
    "rules": "97c1e5fe49607f73",
    "base": "0000b49ebebe29dc5d9f6a4c84c12830688ad46f",
    "registry": "0000b49ebebe29dc5d9f6a4c84c12830688ad46f",
    "gate_scan": {
      "tagged": 1,
      "head": "68548ce721f5ce3bd967aea10bda209d53e9a0b6"
    },
    "reasons": [
      "gate-class",
      "runtime=39"
    ],
    "risk": []
  },
  "pregate": "requires-remote cleared @0ca1768da4a2 (7 checks, current for 68548ce721f5)",
  "requires_remote": [
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/41369649110",
    "pregate.json/remote_gate: remote-gate tree=0ca1768da4a2 tests=405 receipt=/home/user/.gstack/projects/garrytan-gstack/pregate/runs/20261102T004908Z-1175195-60c1/remote/remote.log sha256=5dc321ac8fa2"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "AGENTS.md, CLAUDE.md, CONTRIBUTING.md, README.md, capy/, docs/ (audit a895-1: no edits needed)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 3,
    "deferred": 0,
    "noted": 2,
    "fixed": 3,
    "scope": "frozen",
    "rounds": 2,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  },
  "review_targeted": {
    "classes": [
      "gate"
    ],
    "rules": "baeb8f7ef7da92d0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "6ba597729b35fef450006a9e805a2870cbad5734",
    "status": "done",
    "findings": 1,
    "raised_by": "targeted"
  }
}

What changed

gstack-ship-release finish now routes a branch's own restamped stale stamp as release metadata after a lost slot, instead of stopping for a full re-review. The change is in stampedFiles (lib/ship-bin-common.ts). A removed line still counts as a stamp when every version it moves is at or above the reviewed tree's VERSION, as before. When that check fails, the line gets a second chance only if the branch added it itself, judged by gstack-restamp's own rule (branchAddedLines: added since the merge base of origin/<base> and HEAD, and not added by origin/<base> since). On such a line, a moved version must be strictly newer than the version at the branch's fork point (forkVersion), the same bound the restamp's stamp_paths stage uses. Only stamp_files paths count, and stampOnlyLine's byte-for-byte rewrite rule still applies, so nothing else on the line may differ. releasePaths and stampedFiles take base, and finish passes its --base at all three call sites.

Before and after: finish on the lost-slot fixture (test/ship-rereview-triggers.test.ts, "a restamp after a lost slot"). The branch stamps 1.0.1.0 and adds a since: '1.0.1.0' row; main moves to 1.0.2.0 with another PR's row at 1.0.1.0; the branch merges main and is reviewed at VERSION 1.0.2.0; the restamp to 1.0.3.0 moves the branch's row.

main 35a676ff6 (lib/ at main, this branch's test):
ROUTE: reviewed=1cfad53c489d current=d249c53d633f behavior=1 docs=0 metadata=1 tests=0 base=0 context=0
=> STOP: behavior, tests or build inputs changed since review (src/notice.ts): insert 5–11.5 → 12–14 → 16 before Step 17 (stage 2.1)

this branch:
ROUTE: reviewed=1cfad53c489d current=d249c53d633f behavior=0 docs=0 metadata=2 tests=0 base=0 context=0

The same fixture still stops when the restamp also moves main's own 1.0.1.0 row, when main later edits the text of a row the branch merged and that row is moved, when the branch's row sits at the fork version (1.0.0.0), and when it predates the fork (0.9.5.0).

Why

GST-895, from GBRA-218 (gbrain #8134 on gstack 1.92.46.0). After a lost slot, gstack-restamp --next correctly moved the branch's own since: '0.60.538.0' rows to 0.60.543.0. But finish floored every moved version at the reviewed tree's VERSION, which was 0.60.542.0 from master after the merge, so it read the rows as a behavior change and stopped with "insert 5–11.5 → 12–14 → 16". Every lost-slot branch that follows "Restamp after a lost slot" hits this.

Proof, failing first. With lib/ at main 35a676f, the new test fails with behavior=1 (captured in the GStack Minder drive, handoffs/GST-895/failing-first.txt). Mutation checks: removing the ownership check, or the strict fork bound, each fails the test (at the moved-base-row case and the fork-version case), and swapping ownership back to "the line's text is missing from origin/<base>" fails the edited-base-row case.

Design notes. The Captain suggested reusing restamp's journal or a form-only rule. The journal (.gstack/tmp/restamp-journal.json) records written files and their hashes, not which lines moved, so it can't tell a restamped line from a hand edit. A form-only rule would let a hand-moved base release row through, which is exactly the control case. Ownership by restamp's own rule keeps finish and the writer in agreement. The first cut decided ownership by whether origin/<base> still carried the line's exact text; review showed that a base edit after the merge, or a stale tracking ref, broke that, so it now uses branchAddedLines from the merge base.

Blast radius

  • Code: stampedFiles and releasePaths in lib/ship-bin-common.ts, and their three call sites in finish (lib/ship-release.ts). They have no other callers. The relaxed floor applies only after the old check fails and only to stamp_files paths, so a repo without stamp_files (gstack included) sees no change.
  • Cost: one git merge-base per finish call and two git diff runs per stamp file that reaches the fallback, cached per file.
  • Security: no network calls, environment reads, permission changes, workflow, setup or install edits, or new dependencies.

Known limits

  • Ownership is read the way restamp reads it, from the merge base of origin/<base> and HEAD. If HEAD merges a newer base after review and that merge deletes a row the reviewed tree still carries, a later hand edit that brings the row back with only its version moved could route as metadata (round 2 targeted reader, INFORMATIONAL, confidence 4). Restamp never writes that edit. This is unreproduced and accepted as an open note at the 2-round review cap.
  • A stamp file the branch adds itself (absent on the base) is covered by the same rule but has no dedicated test (pass 1 testing specialist, INFORMATIONAL).
  • The fork bound matches restamp's tentativeMentions: on a branch-owned line, any version newer than the fork may move, including a base release published after the fork that the line cites in a stamp form. Restamp moves those too; docs/ship-policy.md's stamp_paths stage describes the same limit.

Approvals

None needed. This is a bug fix assigned by GStack Minder (GSTA-36) under GST-895, with failing-first proof and no autoplan (the Captain's ruling for a bug fix).

Pre-Landing Review

REVIEW_LOOP: passes=2 blocking_found=3 deferred=0 noted=2 fixed=3 scope=frozen dispatches=8

Gate edits: 2 listed, 1 read. The one read hunk (RH-16) is the stampedFiles floor itself. The targeted gate reader read it at 3ab917a (one CRITICAL, fixed in c892cf1) and at c892cf1 (one INFORMATIONAL, under Known limits).

Review notes

  • Round 1 (batched testing, security and state-machine specialists, then the Red Team) came back with one INFORMATIONAL test gap, noted under Known limits.
  • Step 11 (adversarial on Opus 5.5, outside voice on GPT-6.1 Sol, targeted gate reader) found two real gaps, both fixed in c892cf1: a moved version equal to the fork version passed (restamp requires strictly newer), and ownership came from origin/<base>'s current text rather than restamp's merge-base rule. Each has a new test row and a mutation check. A third finding labeled CRITICAL (one uncached git show per changed line, a cost issue the reader itself rated Low) went away with the same rewrite.
  • Round 2 on the fix range (specialists, Red Team, targeted) found nothing blocking. The targeted reader's INFORMATIONAL note is under Known limits. That is the 2-round cap.
  • An earlier Step 7 coverage audit (audit-only, could not block) mapped 6 of 8 changed paths to tests; its two gaps are an unreachable path and unchanged restamp code.

Documentation

Status: current. No doc edits were needed for GST-895.

Scope: the diff 35a676f...HEAD (lib/ship-bin-common.ts, lib/ship-release.ts, the test and the changelog fragment) against AGENTS.md, CLAUDE.md, CONTRIBUTING.md, README.md, capy/ and docs/. Files read: docs/ship-policy.md, docs/troubleshooting.md, docs/pregate.md, docs/captain.md, capy/skill/gstack/SKILL.md, ship/SKILL.md.tmpl, changelog.d/gst-895-stale-stamp.md.

Result: docs/ship-policy.md's stamp_paths stage (~1487) and slot-stamp text (~860) already describe the fork-point ownership rule finish now reuses; the ~1363 paragraph covers the receipt carry's tree-receipt rule, which this change does not touch. Finish's old floor at the reviewed VERSION was never documented, so nothing goes stale.

Debt: none new.

Test plan

  • Focused lane, 14 files (ship-rereview-triggers, ship-release, stamp-templates, restamp-*, tree-receipt-*, ship-receipt-*, module-size-ratchet) with the GSTACK_* launch variables unset and Capy's git guard off PATH: 119 tests, 0 failed at tree 26a7051e.
  • bun run typecheck and bun run typecheck:test (814 known diagnostics, none new).
  • Remote pregate (Ubicloud, UBI_OWNER=gsta234) at tree 0ca1768d: 405 tests, 0 failed, $0.03; the VM was destroyed.
  • CI green at 68548ce (44 succeeded, 13 skipped, none failed or pending), including the Windows shard (run 41369649110) and the macOS named regressions (run 41369649210).

Trail note (accepted by GStack Minder): row 7 of the decision trail binds the Step 11 adversarial result STALE because the row was logged after the fix commit. The review read the fixed tree, finish doesn't check that binding, and R51's two-round cap ruled out a rerun.

garrytan and others added 5 commits November 2, 2026 00:10
…line as a stamp after a lost slot (GST-895)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…p's rule, and its moved version must be newer than the fork point (GST-895 review)

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

trunk-io Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions github-actions Bot changed the title fix(ship): finish routes a restamped stale stamp as metadata after a lost slot (GST-895) v1.92.55.0 fix(ship): finish routes a restamped stale stamp as metadata after a lost slot (GST-895) Nov 2, 2026
@capy-ai
capy-ai Bot merged commit 2512dd7 into main Nov 2, 2026
55 checks passed
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