Skip to content

fix(ship-receipt): derive carry.covers from the recorded review depth - #2

Draft
vorflux[bot] wants to merge 6 commits into
mainfrom
vorflux/derive-carry-covers-from-depth
Draft

vorflux[bot] wants to merge 6 commits into
mainfrom
vorflux/derive-carry-covers-from-depth

Conversation

@vorflux

@vorflux vorflux Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

A carried receipt claims only the checks its review depth requires

When /ship carries a review receipt to a new head, the receipt records a carry.covers list. Before this PR that list was fixed. A light docs-only review that skipped the adversarial pass still claimed "adversarial review" after a carry. This PR derives the list from the receipt's recorded review_depth, and keeps the first carry's list on later carries.

Human decision needed (safety-check area, #ab-gale). carry.covers lives in the ship receipt, next to the READY/train depth checks. This PR does not change those checks, and no code reads carry.covers for a decision. Please confirm in #ab-gale before this leaves draft. Also see "Decisions for a human" below.

Why — the carry over-claims for light reviews

lib/ship-receipt.ts set covers to the constant CARRY_COVERS = ['pre-landing review', 'adversarial review', 'gate integrity', 'documentation audit'] for every carry (planCarry and planTreeCarry). The review depth table (docs/review-policy.md#review-depth) says a light review with 0 runtime lines runs "the core checklist only": no specialists, no Red Team, no adversarial pass. The carry record therefore claimed a check that did not run. This is the TODOS.md P1 item "Derive carry.covers from depth".

Problem evidence 1 (single carry). The new test, run on the unchanged code (base ce3a093a), fails on a docs-only light receipt carried over a test-only commit:

error: expect(received).not.toContain(expected)

Expected to not contain: "adversarial review"
Received: [ "pre-landing review", "adversarial review", "gate integrity", "documentation audit" ]

      at <anonymous> (test/ship-receipt-depth.test.ts:157:28)
(fail) carry and the review depth > carry covers follow the recorded depth: light docs-only claims no adversarial review, light code claims it
 0 pass
 1 fail

Problem evidence 2 (chained carry, found in review round 1). A carry rebinds review_depth to the new head. With only the first fix, a second carry rebuilt covers from the rebound depth and claimed the adversarial review again. The chained-carry test fails without the second fix:

Expected: "pre-landing review at light depth (core checklist only)"
Received: "pre-landing review at light depth (core checklist and one batched specialist)" ... "adversarial review"

Upstream check. garrytan/gstack main (5532345a) still has the fixed CARRY_COVERS. Of its 49 open PRs, only garrytan#3611 touches lib/ship-receipt.ts. That PR makes an unrelated base_red change and is a possible merge-conflict neighbor only.

What — covers follows the recorded depth

Recorded depth Before (covers) After (covers)
light, runtime 0 pre-landing review, adversarial review, gate integrity, documentation audit pre-landing review at light depth (core checklist only), gate integrity, documentation audit
light, runtime 1–50 same fixed list pre-landing review at light depth (core checklist and one batched specialist), adversarial review, gate integrity, documentation audit
standard, class code/gate same fixed list pre-landing review at standard depth (specialists and Red Team by runtime-line thresholds), adversarial review, gate integrity, documentation audit
standard, class docs/tests same fixed list pre-landing review at standard depth (…), gate integrity, documentation audit
full same fixed list pre-landing review at full depth (every specialist and the Red Team), adversarial review, gate integrity, documentation audit
none recorded (legacy receipt) same fixed list pre-landing review (depth not recorded), gate integrity, documentation audit
second or later carry same fixed list the first carry's covers, unchanged
later carry of a receipt whose first carry recorded the old fixed list same fixed list read as no depth recorded: pre-landing review (depth not recorded), gate integrity, documentation audit
  • Gate integrity and the documentation audit run at every depth, so every row keeps them.
  • review_depth is the depth the head needed at write, which the review is expected to have met. It is not a record of what ran. A fail-closed full (dirty checkout, scan unavailable) can still name more than a light review ran. The code comments and docs/ship-policy.md now say this instead of calling the depth a lower bound.
  • --dry-run --json now reports the same merged covers that the real carry writes.
  • Scope limit: only the informational covers field changes. No refusal, no exit code and no depth check changes.

How

  1. Read: bin/gstack-ship-receipt passes the receipt's review_depth to planCarry and planTreeCarry (new optional depth input). The retarget path uses planCarry.
  2. Derive: the new exported carryCovers(depth) in lib/ship-receipt.ts builds the list from the table above.
  3. Keep: carryReceipt keeps the prior carry's covers when one exists. It reads a missing list, or the old fixed list, as no depth recorded.
  4. Report: the dry-run JSON prints the merged covers.

Commits: 72249eec (derive covers), f4dab966 (docs, TODO removed), f9248bd1 (second carry keeps covers), 3daf353a (docs), 4fb98d65 (dry-run reports merged covers), 7e0d48f3 (docs: legacy mapping).

Testing

Focused checks on 7e0d48f3:

  • bun test test/ship-receipt-depth.test.ts test/gstack-ship-receipt.test.ts test/ship-receipt-carry-rewrite.test.ts test/gstack-ship-receipt-docs.test.ts test/ship-receipt-carry-squash.test.ts test/ship-receipt-carry-pregate.test.ts test/module-size-ratchet.test.ts → 60 pass, 0 fail, 634 expect() calls.
  • Both new assertions (single carry, chained carry) fail without their fix (evidence above). The chained test also checks the dry-run JSON and the legacy fixed-list mapping.
  • bun run typecheck → 0 errors.
  • bun run typecheck:test → "814 known diagnostics, none new."

Full free suite (bun run test) on frozen 7e0d48f3: EXIT=1, not green.

  • Totals over 17 shards: 31,404 pass, 76 fail, 138 skip, plus 1 unhandled error between tests. 3 shards passed; 14 failed.
  • The 76 failures are in 35 files: 25 under browse/test/ (real Chromium), plus test/design-lint-render, make-pdf/test/e2e/format-gate, design/test/feedback-roundtrip, test/setup-gbrain-remote-caller, test/qa-only-cleanup, test/test-free-shards-settlement-lifecycle, test/setup-runtime-lib-command, test/pr-shots, test/cso-snapshot-state, test/claude-provider-keychain.
  • The main cause is the sandbox host: Chromium exits with No usable sandbox! ("Chromium sandboxing failed!"). Other failures are timeouts in the same browser/SDK fixtures.
  • The unhandled error (shard 2, test/remote-identity-vectors.test.ts) comes from bin/gstack-global-discover, a gitignored compiled ELF binary left in this checkout. Bun tried to parse it as a script.
  • None of the 36 files reference ship-receipt or ship-policy.

Blame check (same checkout, same 36 files, bun test <files>):

Revision pass fail errors
base ce3a093a 294 75 2
branch 7e0d48f3 294 75 3

The set of failing test names is identical on base and branch (comm shows no difference). The extra error on the branch is a late assertion from test/setup-gbrain-remote-caller.test.ts "late first completion …", which timed out on both revisions. These failures occur on base too, so this PR does not cause them. They were not repaired here, and no check was skipped or weakened.

Review

A separate Opus review ran twice.

  • Round 1: 3/10, Low, "Ship with mitigations." Findings: (1) a second carry rebuilt covers from the rebound depth and over-claimed again; (2) the "lower bound" comment was wrong, because a fail-closed full can over-claim; (3) no chained-carry test. Resolved: the first carry's covers are kept (f9248bd1), the comments and docs are reworded, and a chained-carry test is added.
  • Round 2: 2/10, Low, "Safe to ship." Findings: (1) --dry-run --json still reported per-hop covers; (2) the docs did not explain the legacy fixed-list mapping. Resolved: the dry-run prints merged covers (tested), and docs/ship-policy.md explains the mapping (7e0d48f3). One optional nit is open: there is no chained tree-carry E2E test. The reviewer judged this a small risk, because every carry path ends in carryReceipt.

Risks

  • Ship-queue READY/train gating: no change. Nothing outside lib/ship-receipt.ts and the tests reads carry.covers. READY and train gating use bindShippedReceipt and receiptDepthVerdict in lib/ship-receipt-depth.ts, which this PR does not touch. Both review rounds confirmed this. It is flagged for a human because the field sits beside a safety check.
  • Legacy receipts claim less. A receipt with no review_depth, or a receipt whose first carry recorded the old fixed list, records "pre-landing review (depth not recorded)" and no adversarial review on its next carry. A human or tool that string-matched the old list sees different text. No in-repo consumer was found.
  • A chained carry keeps the first carry's covers. The list describes the original review, not the latest head's class. This is intended, but it is a policy choice.
  • review_depth can still over-claim when the depth failed closed to full. This PR documents that; it does not fix it.
  • Merge-conflict neighbor: v1.91.374.0 ship: pause /ship on a red base instead of failing (gstack-base-red, conditional receipts) (GSTA-157 PR 1) garrytan/gstack#3611 also edits lib/ship-receipt.ts.
  • No VERSION/CHANGELOG bump: per repo convention those are written at /ship time.
  • Full free suite is red on this host (see Testing). The blame check shows identical failures on base, but the suite has not passed here.

Decisions for a human (#ab-gale)

  1. Confirm that a change next to the READY/train depth checks, with no gating change, is acceptable.
  2. Accept that legacy receipts' covers text changes to "depth not recorded" on their next carry.
  3. Accept that a chained carry keeps the first carry's covers.
  4. Decide how to treat the full-suite failures. They also happen on base and come from the sandbox host (no Chromium sandbox, a stray compiled binary). A run on a host with a working Chromium sandbox is needed for a green acceptance run.

Session Details

  • Session: View Session
  • Requested by: System User
  • Address comments on this PR. Add (aside) to your comment to have me ignore it.

vorflux Bot added 6 commits October 30, 2026 21:20
A carried receipt claimed the fixed list 'pre-landing review, adversarial
review, gate integrity, documentation audit' whatever depth the review ran.
A light review with no runtime lines runs no adversarial pass, so its carry
over-claimed. carryCovers derives the list from review_depth; a receipt
without a depth names no depth and claims no adversarial review.
A carry rebinds review_depth to its new head, so a later hop derived covers
from a depth the review never had (an e2e file adds runtime lines). Keep the
prior covers; read an inherited fixed list or a missing list as no depth
recorded. Word RecordedDepth as the depth the head needed at write.
@vorflux

vorflux Bot commented Nov 2, 2026

Copy link
Copy Markdown
Author

Drift check, 2026-11-02 (upstream garrytan/gstack main = dd9834d4, v1.92.61.0)

  • Re-apply: I squash-merged this PR (7e0d48f3) onto dd9834d4 on a local scratch branch. The scratch branch is not pushed. Conflict: yes, in 3 files:

    • bin/gstack-ship-receipt
    • lib/ship-receipt.ts
    • test/ship-receipt-depth.test.ts

    All 3 are adjacent-line conflicts with upstream v1.92.42.0 fix(ship): notes-only review passes bind; carry handles large diffs; scoped carry route (GST-430, GST-448, GST-442, GST-444) garrytan/gstack#3694 (new scopedReview carry input) and a new receiptDepthAtHead import. Keeping both sides resolves them. There is no logic change. TODOS.md, docs/ship-policy.md and test/gstack-ship-receipt.test.ts merged cleanly.

  • Upstream has not done this work. CARRY_COVERS is still a fixed list at lib/ship-receipt.ts:184 (used at :262 and :293). TODOS.md:17 still lists the P1 item "Derive carry.covers from depth."

  • Focused tests on the re-applied tree: 66 pass, 0 fail across 8 files (ship-receipt-depth, gstack-ship-receipt, carry-rewrite, carry-squash, carry-pregate, carry-large-diff, gstack-ship-receipt-docs, module-size-ratchet).

  • Upstream PR overlap:

PR State Overlap with this PR
garrytan#3611 merged 2026-10-31 No. Same files, but it is in dd9834d4 and caused no conflict.
garrytan#3706 merged 2026-11-01 No. Same files, but it is in dd9834d4 and caused no conflict.
garrytan#3737 merged 2026-11-02 No. It touches only docs/ship-policy.md, which merged cleanly.
garrytan#3705 open No. It does not touch the receipt files.
garrytan#3744 open No. It touches lib/ship-receipt.ts (1 line in KEY_ORDER) and bin/gstack-ship-receipt. A test merge with the re-applied tree adds no conflict, and it does not change covers.
garrytan#3795, garrytan#3838 open No. They touch only lib/ship-receipt-depth.ts. They add no conflict and do not change covers.

No open upstream PR changes CARRY_COVERS or carry.covers.

Next step: this PR needs a rebase onto current upstream before review. The rebase has 3 mechanical conflicts. I did not change or push this PR branch.

@vorflux

vorflux Bot commented Nov 2, 2026

Copy link
Copy Markdown
Author

Corrected copy of #2 (comment) with full upstream PR links. This comment replaces that one.

Drift check, 2026-11-02 (upstream garrytan/gstack main = dd9834d4, v1.92.61.0)

  • Re-apply: I squash-merged this PR (7e0d48f3) onto dd9834d4 on a local scratch branch. The scratch branch is not pushed. Conflict: yes, in 3 files:

    • bin/gstack-ship-receipt
    • lib/ship-receipt.ts
    • test/ship-receipt-depth.test.ts

    All 3 are adjacent-line conflicts with upstream v1.92.42.0 fix(ship): notes-only review passes bind; carry handles large diffs; scoped carry route (GST-430, GST-448, GST-442, GST-444) garrytan/gstack#3694 (new scopedReview carry input) and a new receiptDepthAtHead import. Keeping both sides resolves them. There is no logic change. TODOS.md, docs/ship-policy.md and test/gstack-ship-receipt.test.ts merged cleanly.

  • Upstream has not done this work. CARRY_COVERS is still a fixed list at lib/ship-receipt.ts:184 (used at :262 and :293). TODOS.md:17 still lists the P1 item "Derive carry.covers from depth."

  • Focused tests on the re-applied tree: 66 pass, 0 fail across 8 files (ship-receipt-depth, gstack-ship-receipt, carry-rewrite, carry-squash, carry-pregate, carry-large-diff, gstack-ship-receipt-docs, module-size-ratchet).

  • Upstream PR overlap:

PR State Overlap with this PR
garrytan#3611 merged 2026-10-31 No. Same files, but it is in dd9834d4 and caused no conflict.
garrytan#3706 merged 2026-11-01 No. Same files, but it is in dd9834d4 and caused no conflict.
garrytan#3737 merged 2026-11-02 No. It touches only docs/ship-policy.md, which merged cleanly.
garrytan#3705 open No. It does not touch the receipt files.
garrytan#3744 open No. It touches lib/ship-receipt.ts (1 line in KEY_ORDER) and bin/gstack-ship-receipt. A test merge with the re-applied tree adds no conflict, and it does not change covers.
garrytan#3795, garrytan#3838 open No. They touch only lib/ship-receipt-depth.ts. They add no conflict and do not change covers.

No open upstream PR changes CARRY_COVERS or carry.covers.

Next step: this PR needs a rebase onto current upstream before review. The rebase has 3 mechanical conflicts. I did not change or push this PR branch.

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.

0 participants