/ship can finish when its docs audit fixes a reviewed doc after the last review round (GST-3532) (#4708)

/ship no longer gets stuck when its last-step docs audit corrects a line
in a doc the review read, after the PR's last allowed review round.

Why: gbrain#10059 had to skip its /ship record to land, because the only
fix /ship offered was a third review round, which the two-round limit
forbids.

Nothing to do: the next /ship run asks for one small read of the audit's
change on its own.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: p2/outside-voice#1 reader=outside-voice
Review-Finding: p2/adversarial-native#1 reader=adversarial-native
Review-Finding: p2/adversarial-native#2 reader=adversarial-native
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-22 15:25:28 +00:00
1 parent a88cc7c1be
commit 4ae9ec7b00
18 files changed
+274 -21

No files matched your search

+18
View File
@@ -1022,6 +1022,24 @@ receipt carried across a base merge or a test-only fix
counters, because the reviewed product diff is unchanged or its only
difference passed a scoped review.
<a id="docs-audit-edits-to-reviewed-docs"></a>
### Docs-audit edits to reviewed docs (GST-3532)
The Step 14.5 docs audit runs after the review, so it can correct a line in a
doc the review read for its own content: a gate path, a doc with gate tags,
agent prose or a doc with a secret line, which `review_exclude_paths` keeps in
the review. When that edit changes the selection, receipt write refuses with
`RECEIPT_DOCS_AUDIT_READ` instead of asking for another review round, which the
round cap may forbid (gbrain#10059 had to waive its receipt). The refusal writes
a packet with the audit's change to those docs, at most 20 changed lines each,
and the targeted brief. One scoped reader reads it. Like the bounded read
above, that read is not a review round under R51 and needs no grant. Its clean
record (`head`, `paths`, `reviewer`, `verdict`, `packet_sha256`) goes back
to write with `--docs-audit-read`, and the receipt records it as
`docs_audit_read`. A finding, a record for another head or packet, and a
larger edit still refuse; a finding goes to the lane's Captain
([troubleshooting](troubleshooting.md#receipt-docs-audit-read)).
## The scope knob
`.gstack/ship-policy.json` `review_scope` ([ship-policy.md#review-scope](ship-policy.md#review-scope)):
+2
View File
@@ -1715,6 +1715,8 @@ the reviewers read that selection.
Write, carry and the queue make one exception (GST-1408, GST-1415, GST-1434, GST-1446): when the digests differ but the recorded selection and HEAD's give the PR's files the same selection, meaning the same applied patterns, the same excluded files and the same kept files with their reasons, write records HEAD's digest, carry carries the receipt and records HEAD's digest, and the queue (`ready`, train build, land) binds it. So a pattern the base gains, adds, removes or reverts that changes nothing about the PR's files does not void the review. No recorded selection (`none`) counts as the empty one. A receipt's record counts only when its digest is built from its list hash. Write gets only a digest, so it rebuilds the recorded selection: the digest binds when the `review_exclude_paths` the base held at some commit that changed the policy file, combined with HEAD's list hash, gives that digest. It prints `REVIEW_EXCLUDE_POLICY_MOVED:`. A digest no such policy gives, an omitted `--review-exclude`, a selection that differs over the PR's files and an unreadable base policy still refuse.
Write makes one exception for Step 14.5's docs audit, which runs after the review (GST-1429): with `--docs-post <audit-id>-post.json` it accepts the reviewed digest when that digest is HEAD's selection with every file under a pattern that changed since the snapshot's HEAD reset to it, each such file is uncommitted in the snapshot with the content HEAD holds, each is excluded or kept only because code names it, and every other file is excluded or kept alike on both sides. With `--docs-pre <Prepare snapshot>` only the files whose content changed between the audit's two snapshots reset, to their Prepare content, so uncommitted docs the reviewers read stay as they are; content compares as git stores it or as it checks out (autocrlf, filters). It prints `REVIEW_EXCLUDE_DOCS_AUDIT:` and records HEAD's digest. Any other change to the selection, an audit file the exclusion keeps for another reason, an edit after the snapshot and a missing or unreadable snapshot still refuse. When one `/ship` run audits twice (a re-audit after a base merge and restamp), every snapshot names the run (`--run <invocation record>`), each post snapshot names its Prepare snapshot (`--pre`, recording the files the audit edited), and the re-audit's post snapshot carries the earlier one (`--carry <earlier -post.json>`; GST-1616). Write then also resets each file an earlier audit of the run edited, to its content before that audit, when HEAD (or the re-audit's Prepare snapshot) holds what the audit left; a file no audit edited still refuses, and a carried audit of another run is refused by the snapshot and by write. When an earlier audit stopped as blocked before its post snapshot, the re-audit's post snapshot carries it with `--carry-stopped <its Prepare snapshot>`, taken at the same HEAD, and its edits are what changed between the two Prepare snapshots (GST-3502). After a base merge, write does not count a file under a pattern that only the merged base changed (the PR's own three-dot diff leaves it alone), a re-audit that edited nothing still binds through the audits it carries, and the rebuilt selection binds the reviewed digest even when the merge moved the base policy (for example, added a pattern); a docs file the PR itself changes after the last audit still refuses (GST-3260).
An audit file the review kept for its own content (a gate path, gate tags, agent prose or a secret line) is a doc the reviewers read, so the exception binds it only after one scoped reader reads the audit's change: write refuses with `RECEIPT_DOCS_AUDIT_READ`, writes the packet, and binds a clean `--docs-audit-read <record.json>` into the receipt as `docs_audit_read`. That read is not a review round (GST-3532, [review-policy.md](review-policy.md#docs-audit-edits-to-reviewed-docs)).
**Adopting it.** (1) Open a PR on the base that adds the patterns and
`min_gstack_version` at least `REVIEW_EXCLUDE_KEY_VERSION`, and ship it like any
policy change. (2) Once it merges, bring the base into the results branch (a
+17
View File
@@ -7856,6 +7856,23 @@ none of carry's other checks would refuse; carry without `--dry-run` writes it.
In /ship Step 1, `gstack-ship-preflight` prints the route as `NEXT: carry
route (Step 1.4)`.
<a id="receipt-docs-audit-read"></a>
### `RECEIPT_DOCS_AUDIT_READ`
**Meaning.** After the review, the Step 14.5 docs audit edited a doc the review
read for its own content (a gate path, gate tags, agent prose or a secret line),
and that edit changed the review selection. Write's docs-audit exception binds
only docs the reviewers never read, so this change needs one reader first
(GST-3532). It is not a review round, so the round cap doesn't stop it.
**Fix.** Give one reader the packet the refusal names. Save its clean verdict
outside the worktree as `{"head", "paths", "reviewer", "verdict": "clean",
"packet_sha256"}`, with the values the refusal prints, and rerun write with
`--docs-audit-read <record.json>`. The receipt records it as `docs_audit_read`.
A finding goes to the lane's Captain. An edit over 20 changed lines in one doc
is too large for one reader and still takes the review
([review-policy.md](review-policy.md#docs-audit-edits-to-reviewed-docs)).
<a id="receipt-carry-recheck"></a>
### Scoped re-check after `RECEIPT_CARRY_PRODUCT_CHANGED` (J1, advice only)