Skip to content

fix(ship-receipt): carry survives a base policy change that selects no PR file (GST-1415) - #4030

Merged
capy-ai[bot] merged 1 commit into
mainfrom
capy/gst-1415-carry-exclude-selection
Nov 5, 2026
Merged

capy-ai[bot] merged 1 commit into
mainfrom
capy/gst-1415-carry-exclude-selection

Conversation

@garrytan

@garrytan garrytan commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 4030,
  "head": "5c6dd155396c7c9c75d61c16241d5015f8853e02",
  "version": "1.96.0.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1589,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 41984069461,
      "attempt": 1,
      "tree": "e09936e2113dd3c874a67538b8981535ee01922c"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "e09936e2113dd3c874a67538b8981535ee01922c",
  "product_patch_id": "77b92bb22383bd723241e222c8714088af29cc07",
  "gstack_version": "1.96.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 30,
    "rules": "70895942bb8a8ee2",
    "base": "549b9a86609474e7218b4c82fdfcc5aba8b820fa",
    "registry": "549b9a86609474e7218b4c82fdfcc5aba8b820fa",
    "gate_scan": {
      "tagged": 0,
      "head": "5c6dd155396c7c9c75d61c16241d5015f8853e02"
    },
    "reasons": [
      "gate-class",
      "risk:money",
      "runtime=30"
    ],
    "risk": [
      "money"
    ],
    "mode": "panel"
  },
  "pregate": "pass @e09936e2113d (7 checks, current for 5c6dd155396c)",
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, AGENTS.md, CONTRIBUTING.md (ship-policy.md and review-policy.md read for the GST-1415 carry change)"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 1,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "ledgers_read": 2,
    "dispatches": {
      "specialist": 1,
      "red-team": 1
    }
  },
  "review_targeted": {
    "classes": [
      "money"
    ],
    "rules": "30e6bce187be0d59",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "77b92bb22383bd723241e222c8714088af29cc07",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}

What changed

docs/ship-policy.md: carry now binds when neither the recorded nor HEAD's review_exclude selection holds a PR file (GST-1415)

docs/ship-policy.md: carry now binds when neither the recorded nor HEAD's review_exclude selection holds a PR file (GST-1415).

Before/after as text: docs/ship-policy.md: carry now binds when neither the recorded nor HEAD's review_exclude selection holds a PR file (GST-1415)
--- Before · before.txt · captured output
+++ After · after.txt · captured output
@@ ⋯ 3 unchanged ⋯ @@
 The queue makes one exception (GST-1408): a receipt with no `review_exclude`, written before the 
 base gained the key, still binds when no file the head changes matches any current pattern, 
 excluded or kept, because its reviewers read the same full diff; a recorded digest that differs, a 
+matched file and an unreadable base policy still refuse.
+Carry makes the same exception in both directions (GST-1415): when the digests differ but neither 
+the receipt's recorded selection (no `review_exclude`, or one whose list hash is the empty 
+selection's and whose digest is built from it) nor HEAD's holds a file the PR changed, the receipt 
+carries and records HEAD's digest, so a pattern the base gains, adds, removes or reverts does not 
+void it; a selection that holds a PR file, excluded or kept, and an unreadable base policy still 
+refuse.
-matched file and an unreadable base policy still refuse, and carry still compares digests.
 

gstack-ship-receipt carry no longer refuses with review_exclude changed just because main's review_exclude_paths digest moved. When neither the receipt's recorded selection nor HEAD's holds a file the PR changed, every reviewer read the full diff and still would, so the receipt carries and records HEAD's digest (which the queue then binds exactly).

  • lib/ship-receipt-depth.ts: the GST-1408 predicate ("no file the head changed matches any current pattern") is now one shared selectsNoFile, used unchanged by the queue's excludeMismatch and by the new carryExcludeBinds.
  • lib/review-exclude.ts: recordSelectsNoFile decides the recorded side from the receipt's hashes, not its counts: the list hash must be the empty selection's and the digest must be built from it.
  • bin/gstack-ship-receipt carry calls carryExcludeBinds; the refusal text, help and docs/ship-policy.md say what carry now compares.

Why

HARN-1's harness-evals #263 was forced into a full five-reader re-review of an unchanged product after main's exclude patterns changed. GST-1408 (#4018) fixed the same thing for ship-queue ready, but carry kept comparing digests. Now a pattern change on main that touches none of the PR's files no longer voids a carried receipt.

Blast radius

Carry only. The queue's behavior is unchanged. Its GST-1408 tests, including "a recorded digest that differs still refuses", pass as before (CI Free Tests run 41984069461 at this tree). Still refused: a pattern change that selects a PR file (excluded or kept), in either direction, and an unreadable or malformed base policy (script ran: the GST-1415 refusal cases in test/review-exclude.test.ts).

Tests

Failing first in test/review-exclude.test.ts ("carry after a base policy change (GST-1415)"): on main the "selects no PR file" case refused with RECEIPT_CARRY_REFUSED review_exclude changed: recorded=none now=68bc66cf…; with the fix it carries for a pattern gained, added beside another, removed beside another and reverted, and the queue binds each carried receipt. The refusal cases (excluded and kept PR files, both directions; malformed and unparseable policy) pass before and after.

Closes GST-1415.

Approvals

No approvals recorded for branch capy/gst-1415-carry-exclude-selection.

Summary

Receipt carry used to refuse whenever main's review_exclude digest moved, even when no PR file fell under any pattern, which forced full re-reviews of unchanged products. Carry now binds in that case and records HEAD's digest so the queue binds the carried receipt exactly.

Test Coverage

All new code paths have test coverage. Failing first in test/review-exclude.test.ts ("carry after a base policy change (GST-1415)"): on main the "selects no PR file" case refused with RECEIPT_CARRY_REFUSED review_exclude changed: recorded=none now=68bc66cf…; with the fix it carries for a pattern gained, added beside another, removed beside another and reverted, and the queue binds each carried receipt. The refusal cases (excluded and kept PR files, both directions; malformed and unparseable policy) pass before and after.

Tests ran: free 1589 (files; carried from CI Free Tests run 41984069461/1 at tree e09936e2113d)

Pre-Landing Review

Pre-Landing Review: 2 issues — 0 auto-fixed, 1 asked (0 fixed, 1 skipped), 0 deferred, 1 noted

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

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)

Full panel (R51, gate class): batched specialist (testing, security, state-machines), red team, native adversarial, targeted (money) and an outside voice (openai/gpt-6.1-sol, completed: approve, no findings). No finding met the blocking floor.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL lib/ship-receipt-depth.ts:280 The new selectsNoFile and carryExcludeBinds were inserted between excludeMismatch's JSDoc and its function, so that doc block now sits above selectsNoFile (core and native adversarial).
  • INFORMATIONAL lib/ship-receipt-depth.ts:304 (red team, skipped as below the floor and outside GST-1415's carry scope) The queue's excludeMismatch still makes the no-file exception only for a receipt with no review_exclude. A receipt whose recorded selection is the empty one, on a head that does not move, still refuses after a base pattern change that selects no PR file, because carry returns CARRY: current before it reaches carryExcludeBinds. Follow-up: let excludeMismatch accept (recorded none or recordSelectsNoFile) && selectsNoFile, with a queue test.
  • INFORMATIONAL lib/ship-receipt-depth.ts:289 (native adversarial) exclusionAt returns state none when the base sha or merge base cannot be resolved, and selectsNoFile reads none as "no PR file", so a future caller of carryExcludeBinds could carry without reading the base policy. Unreachable today: cmdCarry refuses first when git merge-base origin/<base> HEAD fails (bin/gstack-ship-receipt:683). Follow-up: return refused from exclusionAt when the base or merge base is missing.

Exploratory QA

Smoke (report-only): bun test test/review-exclude.test.ts -t GST-1415 ran the real gstack-ship-receipt carry binary on fixture repositories: 3 pass, 0 fail (the success case and the two refusal edges). QA method sections were not loaded; no browser surface.

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

Scope Drift

Scope Check: CLEAN

Plan Completion

Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches). Fix: add "Plan: " to the PR body, or run /autoplan.

TODOS

No TODO items completed in this PR.

Documentation

Scope: I audited the branch diff against base 549b9a8. It covers carry's handling of review_exclude in bin/gstack-ship-receipt, lib/review-exclude.ts and lib/ship-receipt-depth.ts, plus docs/ship-policy.md and the changelog.d fragment. I also grepped the docs tree, including nested docs and templates, for other mentions of review_exclude with carry.

Result: The docs are current. docs/ship-policy.md already describes the GST-1415 carry exception, which matches the code in carryExcludeBinds. The --review-exclude help text in bin/gstack-ship-receipt is updated to match. The changelog fragment is present. docs/review-policy.md describes the digest only generically, which stays accurate.

Debt: None found. The earlier sentence in docs/ship-policy.md that says carry refuses on a different digest is qualified by the exception paragraph right after it, so I left it alone.

Test plan

  • bun run test (free suite): carried from CI Free Tests run 41984069461/1 at tree e09936e2113d, 1589 files, 0 failed; pregate pass (CI_CARRY accepted, 105 of 105 selected files)
  • bun test test/review-exclude.test.ts -t GST-1415: 3 pass, 0 fail

Closes GST-1415.

Open in Capy

…o PR file (GST-1415)

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

trunk-io Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@capy-ai
capy-ai Bot merged commit 5297ddf into main Nov 5, 2026
43 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 5, 2026
…lds a PR file; name scan greps consumers only (GST-1434, GST-1435) (#4036)

* fix(review-exclude): ready binds an older digest when no selection holds a PR file; the name scan greps consumers only (GST-1434, GST-1435)

GST-1434: gstack-ship-queue ready (and train build, land) refused any receipt whose
recorded review_exclude digest differed from the base policy's, so a policy edit on
main voided every receipted PR even when no PR file fell under a pattern
(harness-evals #274, #276 after #278). excludeMismatch now uses carryExcludeBinds,
the predicate carry uses since #4030: a digest change binds when neither the recorded
selection nor HEAD's holds a file the PR changed; anything else still refuses.

GST-1435: the named-by-code scan ran git grep over the whole tree, so on
harness-evals #269 it searched 30 MB of receipts for 4,354 candidate paths, ran
278 s past its 120 s limit and kept every file. It now lists each tree, keeps the
consumer files (code and tests outside the candidates) and greps only those through
literal pathspecs in 24 KB chunks. A git failure or timeout still keeps every
candidate.

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

* fix: pre-landing review fixes

grepFixed keeps every candidate when a consumer's name does not survive UTF-8 decoding, since its literal pathspec would match nothing.

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

* docs: the queue's review_exclude check follows carry's rule (GST-1434)

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>
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