Skip to content

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

Merged
capy-ai[bot] merged 6 commits into
mainfrom
docs-audit-gate-doc-gets-one-reader
Nov 22, 2026
Merged

capy-ai[bot] merged 6 commits into
mainfrom
docs-audit-gate-doc-gets-one-reader

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

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

What changed
  • When the docs audit (Step 14.5) edits, after the review, a doc that the review kept for reviewers to read, and the audit's snapshots show that edit is the only change to what the review read, gstack-ship-receipt write now stops with RECEIPT_DOCS_AUDIT_READ and writes a short packet of just that change. This works even when the PR has used both review rounds.
  • One scoped reader reads the packet. It is not a review round and needs no grant. A clean read, passed back with --docs-audit-read <record.json>, is bound into the record as docs_audit_read. A reader's finding still refuses and goes to the owner. A stale record means rerunning the reader on the current packet. An edit too big for one reader, or a change git can show only as binary, refuses the way it did before this change.
  • The packet shows every changed line, including doc lines that start with -- or ++ , and it builds correctly when core.autocrlf is on.
  • The docs audit steps now say a re-audit passes one flag for its one earlier audit: --carry, or --carry-stopped when that audit stopped first.
Why

"The only route offered was another review round, which the cap forbids" (gbrain#10059). A one-line factual fix to a doc should cost one small read, not a waived record.

Blast radius

Only gstack-ship-receipt write's path for docs-audit edits changes. When a re-audit's first attempt doesn't match what the review read and a later attempt (without the oldest earlier audits) does, write now reports that later attempt's own refusal or packet instead of the first mismatch; both still refuse. The new test reproduces the gbrain#10059 case and fails on main with the old refusal. A docs-audit edit to a doc kept for its own content binds only after a clean read of a packet that shows the whole change; edits to docs the review hides, or keeps only because code names them, bind as before.

Test Coverage

The coverage audit read 10 changed paths at the first review. 7 have tests rated two or three stars and 3 had none (audit only, no tests generated): a kept reason outside the four read reasons, a doc the audit added, and a failed packet write. The review fixes since then added tests for doc lines that start with dashes, a CRLF checkout, and a change git shows only as binary (a NUL byte, or a file over core.bigFileThreshold). No test checks that a later matching attempt returns its own reader packet or refusal rather than the first mismatch.

Tests: one new test file, test/review-exclude-docs-audit-read.test.ts. Coverage: 70% (7 of 10 paths) at the first review.
Tests ran: tests reused from CI, run 45035930403 (1768 files, 39134 tests) at this head's tree.

Pre-Landing Review

Round 1 (full panel) found three notes and fixed all three: the packet dropped doc lines that start with -- or ++ , its starting content failed under autocrlf, and a later attempt's reader packet was thrown away. Round 2 (full, on the fix range) found two notes: the untested retry above, and an empty packet for a change git shows only as binary. The second-model review (GPT-6.2 Sol) found the same binary case and rated it blocking, because ordinary text over core.bigFileThreshold triggers it too; the Claude adversarial pass rated it low and also found a stale code comment. The owner granted one scoped recheck. The fix refuses the binary case and corrects the comment, and the recheck read it clean. The untested retry stays open as a note.

Review notes

Below the blocking floor; recorded here and not fixed in this PR.

  • lib/ship-receipt-depth.ts:471: test/review-exclude.test.ts covers a re-audit whose earlier audit a review already read when it binds, but no test checks that a later matching attempt returns its own reader packet or refusal. The change was checked by reading the code in round 2 and in the owner's scoped recheck.
Exploratory QA

Smoke: test/review-exclude-docs-audit-read.test.ts ran on the reviewed tree (4 pass, 0 fail). No plan checks; this is a bug fix with no plan.

Eval Results

The pull-request eval selection (bun run eval:select against origin/main) lists 106 behavioral probes and no judges, because the /ship record tool and its libraries are referenced by every dependent gate case. None ran on this PR; they run in the 8-hour paid gate on main after merge. The new docs-audit read path itself is covered by the free regression test, not by those probes.

Scope Drift

Scope Check: CLEAN. Intent: GST-3532, one scoped reader for a docs-audit edit to a reviewed doc after the round cap, plus the re-audit flag wording from #4703's trail read. Delivered: those, plus the review fixes above.

TODOS

No TODO items completed in this PR.

Documentation

Status: current. The docs audit found the branch's docs accurate and made no edits.

Scope: the branch docs-audit-gate-doc-gets-one-reader against base 45e33b5e, committed, staged, unstaged and new content. The audit read the GST-3532 changes to docs/review-policy.md, docs/ship-policy.md, docs/troubleshooting.md, the changelog.d fragment and the ship documentation and pr-body templates, and checked them against lib/docs-audit-read.ts, lib/ship-receipt-depth.ts, bin/gstack-ship-receipt and lib/result-codes-release.ts.

Documentation health

File Status
docs/review-policy.md Current
docs/ship-policy.md Current
docs/troubleshooting.md Current
changelog.d/docs-audit-gate-doc-gets-one-reader.md Current (not edited)
ship/sections/documentation.md.tmpl Current
ship/sections/pr-body.md.tmpl Current

Coverage debt: none found. The new refusal code, flag, record field and 20-line limit are each documented in the policy docs, the troubleshooting doc and the /ship prose. Diagram drift: none, since no diagrams cover this path.

Tests
  • Free suite in CI (run 45035930403 at 94fa9f8): pass
  • bun test test/review-exclude-docs-audit-read.test.ts at 20188be: 4 pass. Each review-fix case failed when its fix was reverted locally. The dash-line and CRLF cases failed against 2475f8c's library code and the binary case against 4eac25d's.
  • bun test test/size-ledger.test.ts test/test-of-test-ratchet.test.ts test/module-size-ratchet.test.ts test/spawnsync-timeout-tripwire.test.ts test/review-exclude-stopped-audit.test.ts test/review-exclude.test.ts test/docs-audit-result.test.ts at 4eac25d: 157 pass; the four size and test-guard files again at 20188be: 25 pass
  • bun run typecheck at 20188be: clean (CI typechecks the final head too)
  • Trial merge of The recommendation judge's calibration test checks two real captured questions (GST-3447) #4705 at ef66bba (shares docs/troubleshooting.md) onto 94fa9f8: no conflicts, typecheck clean, test/review-exclude-docs-audit-read.test.ts 4 pass
Agent notes

GST-3532, owned by GSTA-795, after #4703. Reported by GBRA-615, checked by GBRA-108 on gbrain#10059 (gstack 1.102.2.0). Also folds in the carry-flag wording note from #4703's cross-family trail read. Fix-check grant a-acca5dcf93c7 by GSTA-36 at stop 4eac25d: "A fail-open in merge-check code: a non-empty diff with no text hunk must refuse, never bind."

Approvals

Plan: exempt: bug fix with a failing test written first (GST-3532)

Gate edits: none detected (3 listed, 1 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

{
  "schema_version": 1,
  "pr": 4708,
  "head": "94fa9f811c5ed650e6e1861f46a8a92509d8ba62",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "tests": {
      "pass": 39134,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "tests",
      "run": 45035930403,
      "attempt": 1,
      "tree": "3e959b9cc0245354156bf1f353f223568b0dd940"
    }
  ],
  "calls": 34,
  "session_kind": "unattended",
  "run": "/home/user/.capy/work/gst3532/ship-4708-a",
  "head_tree": "3e959b9cc0245354156bf1f353f223568b0dd940",
  "product_patch_id": "9b05b0c2916f3f304e384b1476a7483538c2efe5",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 138,
    "rules": "33831f8248a814fd",
    "base": "45e33b5e7b13614cb89e7d6e155e349755dd1e8f",
    "registry": "45e33b5e7b13614cb89e7d6e155e349755dd1e8f",
    "gate_scan": {
      "tagged": 0,
      "head": "94fa9f811c5ed650e6e1861f46a8a92509d8ba62"
    },
    "reasons": [
      "gate-class",
      "runtime=138"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @3e959b9cc024 (8 checks, current for 94fa9f811c5e)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/45035930403/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/45035930403/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/45035163277/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=3e959b9cc024 tests=39134 skipped=105 runs=45035930403/1 profiles=ci-reuse/free-tests heads=94fa9f811c5e verified=2026-11-22T15:08:37.756Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "the committed diff 45e33b5e..94fa9f81: the docs-audit reader refusal and packet, the review fixes, the re-audit flag wording and the changelog fragment"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 1,
    "deferred": 0,
    "noted": 2,
    "fixed": 6,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 2,
    "dispatches": {
      "specialist": 2,
      "red-team": 2
    }
  },
  "review_round_grants": [
    {
      "kind": "fix-check",
      "head": "4eac25d9e64974a838c7c4eb3d10ecc18d59cdcc",
      "pr": 4708,
      "by": "GSTA-36",
      "reason": "A fail-open in merge-check code: a non-empty diff with no text hunk must refuse, never bind.",
      "at": "2026-11-22T14:44:05.347Z",
      "approval": "a-acca5dcf93c7",
      "stop_run": "ship-4708-a",
      "findings": [
        "p2/outside-voice#1",
        "p2/adversarial-native#1",
        "p2/adversarial-native#2"
      ]
    }
  ],
  "gate_dispositions": []
}
{"head":"94fa9f811c5ed650e6e1861f46a8a92509d8ba62","version":"1.102.2.0","gstack_version":"1.102.2.0","run":"/home/user/.capy/work/gst3532/ship-4708-a","review_loop":{"passes":2,"blocking_found":1,"deferred":0,"noted":2,"fixed":6,"scope":"frozen","fix_checks":1,"rounds":2,"dispatches":{"specialist":2,"red-team":2}},"depth":"full"}

garrytan and others added 3 commits November 22, 2026 14:00
…another review round, so /ship can finish (GST-3532)

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

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 22, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 3 commits November 22, 2026 14:34
…der autocrlf

The packet now reads only the diff's hunks, so a doc line that starts with
"-- " or "++ " is shown to the reader and counted against the size limit.
Its starting content comes from the same blob the reset uses, so a
snapshot hash of CRLF working-tree bytes no longer fails the diff. A
later attempt that matched the reviewed selection now reports its own
refusal or packet instead of the first attempt's mismatch.

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
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
When git shows a reviewed doc's audit change as binary (a NUL byte, or a
file over core.bigFileThreshold), the diff has no hunk to read. Write now
refuses instead of handing the reader an empty packet that a clean read
would bind. The comment above the retry loop now says a retry that matched
the reviewed selection returns its own refusal or packet.

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
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…till refuse

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 4ae9ec7 into main Nov 22, 2026
86 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