Skip to content

v1.92.63.0 fix(ship): a slot restamp after the docs audit keeps finish's docs check fresh (GST-906) - #3834

Merged
capy-ai[bot] merged 5 commits into
mainfrom
gst-906-changelog-rehead-docs
Nov 2, 2026
Merged

capy-ai[bot] merged 5 commits into
mainfrom
gst-906-changelog-rehead-docs

Conversation

@garrytan

@garrytan garrytan commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3834,
  "head": "15b3b90e3a91a5d062d9ce1e4b72d900c237d18d",
  "version": "1.92.51.0",
  "base": "main",
  "gate": {
    "focused": {
      "pass": 64,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "a1e12991e39b7d61cc49004a26c0c510857e0732",
  "product_patch_id": "cc49371a82aa832e043e4419e45b3dba1f7c8066",
  "gstack_version": "1.92.51.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 28,
    "rules": "97c1e5fe49607f73",
    "base": "e25997515cc071077313c6e2131ebc895af1bb3f",
    "registry": "e25997515cc071077313c6e2131ebc895af1bb3f",
    "gate_scan": {
      "tagged": 0,
      "head": "15b3b90e3a91a5d062d9ce1e4b72d900c237d18d"
    },
    "reasons": [
      "runtime=28"
    ],
    "risk": []
  },
  "pregate": "requires-remote cleared @a1e12991e39b (1 checks, current for 15b3b90e3a91)",
  "requires_remote": [
    "pregate.json/remote_gate: remote-gate tree=a1e12991e39b tests=407"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "AGENTS.md, CLAUDE.md, CONTRIBUTING.md, README.md, capy/, docs/ (Step 16 stage 3 docs freshness, the changelog row, troubleshooting and unattended docs)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 2,
    "deferred": 0,
    "noted": 2,
    "fixed": 2,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 3,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  },
  "review_targeted": {
    "classes": [
      "gate"
    ],
    "rules": "baeb8f7ef7da92d0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "cc49371a82aa832e043e4419e45b3dba1f7c8066",
    "status": "failed",
    "findings": 0,
    "raised_by": "targeted"
  }
}

What changed

gstack-ship-release finish (Step 16 stage 3, the docs check against the Step 14.5 post-audit snapshot) now treats a slot restamp after the audit as a restamp, not a docs change. docsFresh in lib/ship-release.ts reads the audited bytes with git cat-file blob using the snapshot's own blob id. A path the snapshot compare reports as changed is carried when it matches one of these:

  • The policy's changelog file, base unmoved. The CHANGELOG at the audit's merge base and at the current one is byte-equal, and the current file normalizes equal to the audited one (normalizeChangelog in lib/changelog-check.ts, the tree receipt's own rule). Only a heading move or re-heading passes.
  • The policy's changelog file after the slot merged main first. The audited copy is merged with main's CHANGELOG by the same call the restamp writer makes (mergeChangelogs(audited, CHANGELOG@current merge base, CHANGELOG@audit merge base), the argument order of lib/restamp.ts:765), and the result must normalize equal to the current file. The audited copy must also survive that merge against its own base unchanged. That way the merge can only add main's sections and never hides a line the audit saw.
  • The version file (versionAtRef(cwd, 'HEAD').rel), when both the audited and the current contents parse as a bare version.

Anything else still stales the audit: an entry edit, a dropped or edited main section, a dropped audited line, a CHANGELOG git can't read at either merge base, and audited bytes git never held (never committed or staged).

Before and after: finish's DOCS line (fixture runs from the GST-906 tests, captured in this run):

[Unreleased] re-headed after the audit, on main a563f4767:
  exit 3  DOCS: stale (CHANGELOG.md)
same case on this branch:
  exit 0  DOCS: fresh against the Step 14.5 post-audit snapshot ...

slot merges main (a sibling's release landed first), then re-heads to the next version, on cf39e6a30 (this PR's first commit):
  STATUS 3  DOCS: stale (CHANGELOG.md)
  STOP: documentation inputs changed since the accepted audit: use stage 3 recovery (the remaining re-audit, ...)
same case on this branch (15b3b90e3):
  STATUS 0  DOCS: fresh against the Step 14.5 post-audit snapshot (carried: tests=0 base=2 requested=0)

Why

GST-906, reported by GBRA-258 on gbrain #8372 (gstack 1.92.47.0). A PR that lost its merge slot after the Step 14.5 snapshot gets a new slot. Under the crew's slot rule, that slot merges main and then restamps. The CHANGELOG entry is re-headed (## [Unreleased] or the old version becomes ## [<version>] - <date>), main's newly released sections come in, and VERSION moves. finish then stopped with DOCS: stale (CHANGELOG.md). That left the lost-slot flow with only two ways out. One was a third docs audit, which the policy forbids, and the other was an owner-accepted named risk.

Root cause. The issue suggested fixing it in stampedFiles. But stampedFiles compares against the reviewed tree, which comes before Step 13, so it never holds the CHANGELOG entry at all, and no stampOnlyLine rule there could see a re-heading. The comparison that matters is against the audited bytes, which is what this PR adds. docs/ship-policy.md's changelog row already says the restamp re-heads the CHANGELOG, so carrying it matches the documented policy. The first version of the fix only covered a restamp with no main merge. Review round 1's Red Team showed the lost-slot path merges main first, so the second commit adds the merge case.

VERSION widening. The first test run showed that with only the CHANGELOG rule, the lost-slot case still stopped with DOCS: stale (VERSION), since VERSION moves in the same restamp. The version-file rule is that one-rule widening, and it only accepts a bare version before and after.

Proof, failing first. handoffs/GST-906/failing-first.txt in the GStack Minder drive holds three runs:

  • The re-heading test on main's code fails with DOCS: stale (CHANGELOG.md), the line GBRA-258 reported.
  • The main-merge test fails on cf39e6a with the same line.
  • The dropped-audited-line test reads DOCS: fresh on 6340025, the fail-open the outside voice found in round 2.

Blast radius

  • Code: docsFresh in lib/ship-release.ts, Step 16 stage 3 only, about 20 lines. It only adds carried paths, and only for the policy's changelog file and the version file. Every other path and every other stage behaves as before.
  • Tests: test/ship-rereview-triggers.test.ts gets a new describe, "a CHANGELOG re-heading after the docs audit (GST-906, GBRA-258, gbrain #8372)", with three tests and eleven fixture cases, fresh and stale controls both.
  • Security: none. It reads git blobs by the snapshot's own ids, git show <merge base>:<changelog> and local files. It adds no network calls, environment reads, permission changes, workflow, setup or install edits, or dependencies.
  • gbrain: nothing to declare. Rule 26 note: handoffs/GST-906/gbrain-note.md.

Approvals

This is a bug fix assigned by GStack Minder (GSTA-36) under GST-906, with failing-first proof and no autoplan (the Captain's ruling for a bug fix). After review round 1, the Captain approved widening the fix to the main-merge restamp ("Go with A"). After round 2, the Captain granted one scoped fix-check under rule 23 ("The Captain picked A ... One scoped fix-check on fixcheck-candidate.diff, with one reviewer reading only the touched hunks").

Documentation

Scope: GST-906's change to docsFresh in lib/ship-release.ts (a slot restamp of the CHANGELOG or VERSION after the Step 14.5 audit, including one that merges the base first, is carried instead of stale). I checked it against docs/ship-policy.md, docs/unattended.md, docs/troubleshooting.md, capy/skill/gstack/*.md and Step 16 stage 3 in ship/SKILL.md.tmpl. Result: current. No doc says what a post-audit restamp does to docs freshness, and the existing changelog-restamp and DOCS_AUDIT_BLOCKED text is still accurate. The changelog.d fragment covers the release note. Debt: none.

Pre-Landing Review

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

Gate edits: none detected (1 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none). No hunk was tagged. lib/ship-release.ts and the changelog fragment matched no gate pattern, so the scan says nothing about them. The review readers covered them, and the test hunks only add assertions.

Review notes

  • Round 1 ran at the planned depth (class gate, full): batched testing, security and state-machine specialists, then the Red Team. The Red Team's CRITICAL (confidence 7) found that the lost-slot restamp merges main first, so the first commit missed the reported case. I reproduced it, and the Captain chose to widen the fix (commit 6340025).
  • Round 2 (the R51 cap) reviewed the range, then Step 11's adversarial voice (Opus 5.5), outside voice (GPT-6.1 Sol) and targeted gate reader. The outside voice's CRITICAL was a fail-open, and I reproduced it: the merge takes main's header and shared sections, so a deleted audited line read fresh. The same design also failed closed on a pure re-heading when the branch had corrected a released entry or the header (Red Team, adversarial voice, outside voice). The Captain granted one scoped fix-check. Its fix (5ea38af) keeps the direct rule when main's CHANGELOG didn't move and requires the audited copy to survive its own-base merge unchanged. The fix-check reviewer reported no findings.
  • verify reports every brief and output matched in all three ledgers.
  • Bookkeeping: I wrote the changelog fragment while the fix-check reader was running, so that review row's start and end trees differ by the fragment alone. The targeted gate reader read 6340025's patch. The receipt binds its record to the final patch with status failed and findings 0, because the patch it read no longer matches. Its one INFORMATIONAL finding is the first open note below. The queue's REVIEW_TARGETED line may read missing. The product diff is unchanged since the fix-check: 15b3b90 adds only the fragment.
  • Exploratory QA (Step 9.2.1) was the before-and-after capture in What changed.

Open notes (below the rule 23 floor, not fixed here)

  • Renamed released headings carry (targeted reader). normalizeChangelog replaces every heading with a placeholder and sorts the sections, so renaming or re-dating a released main heading after the audit still reads fresh. That's the tree receipt's own rule, already used in this PR's first commit. At merge, the train's ownEntryAboveMain still catches a changed main section.
  • The gate-ahead restamp merges the predecessor PR, not main (adversarial voice). nowBase is the merge base with origin/main, so a gate-ahead slot's re-heading still reads stale. That gap predates this PR, and it fails closed.
  • A branch that edits base-owned CHANGELOG text and then merges main stays stale. The base-owned text is the header or a released entry. The own-base merge check refuses it on purpose so nothing the audit saw can be hidden. It fails closed: one re-audit.
  • A CHANGELOG missing at either merge base stays stale (testing specialist). Examples are a CHANGELOG new on the branch, or a shallow clone without the merge base. It fails closed, as the parent's brief asked.

Test plan

  • Failing first: the three GST-906 cases above fail on main a563f47, on cf39e6a and on 6340025 respectively, and pass at 15b3b90.
  • Focused lane, 6 files (ship-rereview-triggers, ship-release, ship-release-docs-exception, gstack-docs-candidate, module-size-ratchet, bun-entry-isolation) with the GSTACK_* launch variables unset: 64 tests, 0 failed at 15b3b90.
  • bun run typecheck clean at 15b3b90.
  • Remote pregate (Ubicloud, UBI_OWNER=gsta234) on submitted tree a1e12991 (head 15b3b90): 407 tests, 0 failed, $0.03. VM setup rebuilt two committed lib/diagram-render/dist build files before the run, the same rebuild the CI free lane does. The VM was destroyed (left=0).
  • gstack-ship-release finish at 15b3b90: exit 0, DOCS: fresh against the Step 14.5 post-audit snapshot, PREGATE: verify ok on the stamped tree.
  • Trial merge with v1.92.55.0 fix(ship): finish routes a restamped stale stamp as metadata after a lost slot (GST-895) #3827 (GST-895, pin 68548ce): clean. lib/ship-release.ts and test/ship-rereview-triggers.test.ts auto-merged, and ship-rereview-triggers plus ship-release on the merge ran 32 tests with 0 failed. The trial merge with origin/main e259975 was also clean.
  • CI at 15b3b90.

Disclosures

gstack is Garry Tan's own project.

garrytan and others added 4 commits November 2, 2026 02:18
…eck fresh (GST-906)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… main (red-team, ship round 1)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…an unmoved base keeps the direct rule (scoped fix-check)

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): a slot restamp after the docs audit keeps finish's docs check fresh (GST-906) v1.92.63.0 fix(ship): a slot restamp after the docs audit keeps finish's docs check fresh (GST-906) Nov 2, 2026
@capy-ai
capy-ai Bot merged commit e657fa0 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