Skip to content

review-plan: a docs claim added after the loop plans one targeted-only reader (GST-1598) - #4062

Merged
capy-ai[bot] merged 6 commits into
mainfrom
gst-1598-targeted-delta
Nov 6, 2026
Merged

capy-ai[bot] merged 6 commits into
mainfrom
gst-1598-targeted-delta

Conversation

@garrytan

@garrytan garrytan commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

After a finished review loop, a docs change with a money, security or numeric claim (a changelog fragment with dollar figures, harness-evals #225) left no way through: gstack-ship-receipt write would not carry the targeted record across it, and gstack-review-plan printed done, so nothing could dispatch the reader the receipt asked for (--grant only acts on a stop, --force targeted dispatched nothing, and the brief renders only inside a pass manifest).

{
  "schema_version": 1,
  "pr": 4062,
  "head": "3b971e0890d19804dc01c1fa848774017aaa6403",
  "version": "1.96.0.0",
  "base": "main",
  "gate": {
    "targeted": {
      "pass": 496,
      "fail": 0,
      "skip": 0
    },
    "parity": {
      "pass": 2,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "f3358396f794a324b2e8460cd9c50dcfe7cf7962",
  "product_patch_id": "336376cb5f5e28dcb834a99190262c029f1788e9",
  "gstack_version": "1.96.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 122,
    "rules": "70895942bb8a8ee2",
    "base": "f7015fa72c5111ebb32891e1fcaffdc43e6be23a",
    "registry": "f7015fa72c5111ebb32891e1fcaffdc43e6be23a",
    "gate_scan": {
      "tagged": 0,
      "head": "3b971e0890d19804dc01c1fa848774017aaa6403"
    },
    "reasons": [
      "gate-class",
      "risk:security",
      "runtime=122"
    ],
    "risk": [
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @f3358396f794 (7 checks, current for 3b971e0890d1)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/42208683797/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/42208684161/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=f3358396f794 tests=35901 skipped=111 runs=42208683797/1 profiles=ci-reuse/free-tests heads=3b971e0890d1 verified=2026-11-06T11:20:12.826Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [
      225,
      4058
    ],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, AGENTS.md, CLAUDE.md and ship/sections templates over origin/main f7015fa..3b971e0 (13 files)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 1,
    "deferred": 0,
    "noted": 5,
    "fixed": 1,
    "scope": "frozen",
    "rounds": 2,
    "ledgers_read": 4,
    "unbound": 1,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  }
}

What changes

  • NEXT: targeted. When the loop is done, --range-base names the commit the targeted reader read and --targeted-ran is that commit's targeted patch-id, and the only change to the branch's own patch since then (compared on each side's merge base) is non-binary docs that is not plain docs (plainDocsSince false), the plan dispatches exactly one targeted reader for the head's targeted classes and prints TARGETED_DELTA: range_base=<sha> paths=<paths> classes=<classes> (targeted_delta in --json). The reader reads the whole merge-base diff at HEAD like every targeted reader, so its record binds the receipt with no receipt change. It applies no fix, so it is not a review round and needs no grant; a --grant the approval record does not hold still refuses (exit 3).
  • Everything else keeps done with SKIP: targeted-only read (<reason>): a code or binary change (the review loop, as today), plain docs (the record carries), a range_base the --targeted-ran patch does not match, uncommitted edits.
  • --force targeted refuses (exit 2) and names the route instead of dispatching nothing.
  • gstack-review-dispatch pass builds the one-reader manifest (voices stage, merge base, the TARGETED_DELTA line in its plan lines).
  • /ship Step 19 names the route when write refuses review_targeted; docs/review-policy.md gains "Targeted-only read after the loop".
  • lib/review-depth.ts gains one Step member, 'targeted', repinned under replay GST-1598: planReview never returns it, and the GST-967, GST-972 and section grids hash unchanged.

Tests

test/review-plan-targeted-delta.test.ts: the #225 shape dispatches one targeted reader, then plans done once its id comes back, and parseReviewTargeted refuses the pre-claim record and binds the one read at HEAD; a code delta keeps done; plain docs and a mismatched range_base dispatch nothing; a fabricated grant refuses; --force targeted refuses; pass builds the manifest and its voices stage renders the brief on the merge base at HEAD. Five of the six failed on main 01572de before the change.

What changed

--force targeted now refuses and names the post-loop route (--range-base plus --targeted-ran) instead of planning as if targeted were a specialist

--force targeted now refuses and names the post-loop route (--range-base plus --targeted-ran) instead of planning as if targeted were a specialist.

Before/after as text: --force targeted now refuses and names the post-loop route (--range-base plus --targeted-ran) instead of planning as if targeted were a specialist
--- Before · before.txt · captured output
+++ After · after.txt · captured output
+$ ./bin/gstack-review-plan --base main --force targeted   # this branch
+gstack-review-plan: --force targeted: the targeted reader is no specialist; the plan dispatches it whenever the diff has a targeted class, and after a finished loop for a docs claim added since its read: pass --range-base <the commit it read> --targeted-ran <the targeted_patch_id it read> (docs/review-policy.md#targeted-only-read-after-the-loop)
+(exit 2)
-$ gstack-review-plan --base main --force targeted   # main f7015fa
-REVIEW_CLASS: gate (code: bin/gstack-review-dispatch; gate path: bin/gstack-review-plan; risk: security line: lib/review-targeted-delta.ts)
-REVIEW_DEPTH: full runtime_lines=122 rules=70895942bb8a8ee2 reasons=gate-class,risk:security,runtime=122 codes=none
-GATE_SCAN: tagged=0 head=3b2577b3d7f9b609d5a40715d0d4a4961d975cae
-REVIEW_BASE: origin/main f7015fa72c51
-TARGETED: classes=none rules=30e6bce187be0d59 brief=7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5 targeted_patch_id=62b9045e82fde783fb9aac71b0d4bf94c27af712
-READERS: default (fetch rule only)
-REVIEW_MODE: panel panel=all reader_model=lane platform=off
-REVIEW_PLAN: class=gate pass=1 next=full dispatches=4 numbers=no fingerprint=none reason="pass 1 reviews the whole diff"
-NEXT: full (pass 1 reviews the whole diff)
-DISPATCH: specialist batched effort=medium checklists=testing,security,state-machines
-DIFF_CMD: batched git diff <diff-base>
-DIFF_EXCLUDE: batched none
-... (exit 0: plans as if targeted were a specialist)
 

Why

On harness-evals #225 a changelog fragment with dollar figures, added after the review loop had finished, left /ship stuck: the receipt refused the old targeted record, and the plan printed NEXT: done, so nothing could run the reader the receipt asked for. Now, when the loop is done and the only change since the targeted read is docs with a money, security or numeric claim, the plan prints NEXT: targeted and dispatches one targeted reader on HEAD. A main merge that only edits lines next to a reviewed hunk no longer counts as a branch change.

Blast radius

The change touches gstack-review-plan (one new NEXT: value and a new refusal for --force targeted), gstack-review-dispatch pass (builds the one-reader manifest) and the Step type in lib/review-depth.ts. It is safe because the new branch runs only when --range-base and --targeted-ran are both passed and the loop already says done, and Step 9 never passes --targeted-ran. The adversarial reviewer read that path and confirmed it (file:line read), and test/review-plan-targeted-delta.test.ts covers it (7 tests ran green).

Approvals

APPROVALS_RENDER: redacted (repository visibility public); gstack-approvals list shows the full record

No approvals recorded for branch gst-1598-targeted-delta.

Summary

After a finished review loop, a docs-only claim had no route to the targeted reader the receipt needs. This PR adds that route (NEXT: targeted with a TARGETED_DELTA: line), keeps done with a stated reason for every other delta, and makes --force targeted refuse and point at the route. This /ship run added two commits. 39165d4 fixes a pre-landing review blocker: targetedDelta counted comparePath's context verdict (the base moved lines next to an unchanged branch hunk) as a branch change, so a main merge recreated the dead end. A failing-first test covers it. 3b971e0 adds the changelog.d fragment.

Test Coverage

Coverage audit (Step 7, audit-only, at 3b2577b): 9/17 paths (53%). QUALITY: ★★★ 4, ★★ 5. GAPS: 8 (0 E2E, 0 eval).
Tests: 6 → 7 (+1 new: the context-only base merge case, added with the review fix in 39165d4).
Coverage: 53% value-weighted (53% including 0 weakly covered paths)
Test value: 1 test written, 2 rejected by the authoring gate, 0 existing tests extended, 0 paths weakly covered (weak = ★, gate-failing or unrated).
Remaining gaps the audit proposed (not written; audit-only): an uncommitted-edits skip, an off-branch range_base skip, an unchanged-patch skip and a binary docs skip in targetedDelta.
Tests ran: targeted 496
Tests ran: parity 2
Tests ran: typecheck count unavailable

Pre-Landing Review

Pre-Landing Review: 8 issues — 1 fixed (outside voice and native adversarial, the same defect), 0 asked, 0 deferred, 7 noted
REVIEW_LOOP: passes=2 blocking_found=1 deferred=0 noted=5 fixed=1 scope=frozen unbound=1 ledgers_read=4 dispatches=8
Gate edits: none detected (4 listed, 1 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Outside review: openai/gpt-6.1-sol (host subagent, certified configuration) completed. It found one finding marked blocking, fixed in 39165d4.
Review plan: full panel (gate class, full depth). Pass 1 ran the batched specialist (testing, security, state-machines), red team, native adversarial and outside voice. Pass 2 ran the specialist and red team on the fix range 3b2577b..39165d4 and found nothing blocking.
The unbound=1 is the fix commit's second Review-Finding: p1/adversarial-native#2 trailer. That finding is the same defect as p1/outside-voice#1, and no review row holds it because Step 11 logs voices without findings.

Review notes

Below the blocking floor ("would fail a test, break production, or lose data or secrets"). These are notes, not fixed here:

  • lib/review-targeted-delta.ts:41 (adversarial-native, Medium): --range-base doubles as the fix-range base. After a main merge that touched a gate path, the plan prints NEXT: stop instead of targeted. It fails closed, but it sends the lane to a grant ask. A possible fix is a dedicated --targeted-read <sha> flag.
  • lib/review-targeted-delta.ts:34 (red team): the read-side patch id runs git diff under core.quotePath=false, while targetedPatchId uses git's default. On a branch with a non-ASCII path the ids never match, and the skip blames --targeted-ran. It fails closed. (The native adversarial voice reported the ids match byte for byte on ASCII paths.)
  • lib/review-targeted-delta.ts:40 (red team): comparePath runs on every branch path, without the touchedPaths prefilter the receipt uses. A branch with thousands of paths could hit the 180 s plan timeout.
  • lib/review-targeted-delta.ts:40 (testing, pass 2): the new context filter also accepts comparePath's baseEditOnly context (the base rewrote the lines a reviewed hunk replaces), and no test covers it. The red team found no unreviewed path through it, because the targeted reader reads the whole merge-base diff at HEAD.
  • lib/review-targeted-delta.ts:40 (testing, pass 1): untested guards in targetedDelta: binary docs, an off-branch range_base, uncommitted edits, an unchanged patch.
  • ship/sections/pr-body.md.tmpl:213 (red team): the targeted-only read's prose never says how its findings are judged, logged or acted on.
  • lib/review-targeted-delta.ts:28 (adversarial-native, Low, not investigated): the plan resolves merge bases from the plan's base ref, while the receipt uses origin/. A stale local base could make them disagree.
  • ship/sections/review-army.md.tmpl:244 (docs audit): the NEXT-to-decision mapping has no entry for targeted.

Exploratory QA

Functional CLI smoke on the branch binary (300 s / 12-probe budget). On 3b2577b, ./bin/gstack-review-plan --base main exited 0 with NEXT: full, and --force targeted exited 2 and named the route. One capture ran the installed main binary by mistake; it was superseded, so that probe dir's verdict reads inconclusive. Revalidated on the fixed tree 39165d4: both probes pass (evidence verdict: pass). The post-loop NEXT: targeted dispatch is covered by the test file, not by a live probe.

Design Review

No frontend files changed — design review skipped.

Eval Results

No PR-pass evals were selected. The selector at origin/main f7015fa chose no quality judges, and its 152 selected behaviors remain scheduled or release coverage, not PR passes. Evals skipped.

Review bot comments

No review bot comments.

Scope Drift

Scope Check: CLEAN
Intent: give a docs claim added after a finished review loop a targeted-only read (GST-1598).
Delivered: the NEXT: targeted route, its skip reasons, the --force targeted refusal, docs and tests, plus one review fix to the same module.

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.

Issues

Refs #225
Refs #4058
Refs p1/adversarial-native#2
Refs p1/outside-voice#1

Verification Results

No plan-specific verification items (no plan bound): VERIFY_RESULT=skipped.

Remote pregate

CI_CARRY: accepted ci-carry tree=f3358396f794 tests=35901 runs=42208683797/1 profiles=ci-reuse/free-tests heads=3b971e0890d1 verified=2026-11-06T11:13:56.337Z
PREGATE: verify ok on the stamped tree (requires-remote cleared: macos-named-regressions run 42208683797/1, windows-smoke run 42208684161/1, remote_gate carried from run 42208683797/1)

TODOS

No TODO items completed in this PR.

Documentation

Status: current. No edits were needed, and I changed no files.

Scope: audited the candidate's base f7015fa through head 3b971e0 on branch gst-1598-targeted-delta. It has 13 committed files and no staged, unstaged or untracked ones. I read the bin, lib, ship, docs and changelog-fragment changes and grepped the docs and templates for the review plan's NEXT: values and flags. The repo keeps no banned-terms list.

Documentation health:

  • docs/review-policy.md: current. It documents the targeted-only read, the NEXT: targeted step, the TARGETED_DELTA line, the --range-base and --targeted-ran flags and the --force targeted refusal, matching the code.
  • ship/sections/pr-body.md.tmpl and ship/sections/pr-body.md: current. They carry the receipt-refusal guidance, and the generated file matches its template.
  • changelog.d/gst-1598-targeted-delta.md: current.
  • docs/inventory.md: current, with no change needed.
  • ship/sections/review-army.md.tmpl: debt. Line 244 omits targeted from its NEXT-to-Step mapping. It is skill-prompt prose, so I left it for the parent or author.

Coverage debt: the NEXT: targeted route has reference and how-to coverage in review-policy.md and pr-body.md, with no tutorial or explanation. I did not fill the gap. Diagram drift: none found.

Test plan

  • targeted lane (14 review-plan, depth, dispatch and targeted test files plus module-size-ratchet): 496 tests ran, exit 0
  • bun test test/parity-suite.test.ts: 2 tests ran, exit 0
  • bun run typecheck: exit 0
  • CI at 3b971e0: 31 checks passed, 0 failed, 0 pending (free-tests run 42208683797)

🤖 Generated with Claude Code

Open in Capy

garrytan and others added 4 commits November 6, 2026 07:51
…has no targeted-only reader)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…y reader (GST-1598)

After a finished review loop, a docs change with a money, security or numeric
claim left the receipt unable to carry the targeted record and the plan at
done, so nothing could dispatch the reader the receipt asks for (harness-evals
#225). With --range-base naming the commit the targeted reader read and
--targeted-ran its patch, a docs-only change since then now plans NEXT:
targeted: one targeted reader on HEAD for the head classes, with
TARGETED_DELTA printed. Code changes keep done; --force targeted refuses and
names the route; gstack-review-dispatch pass builds the one-reader manifest.

Repins lib/review-depth.ts under replay GST-1598 (one Step union member;
the GST-967 and GST-972 grids hash unchanged).

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

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

trunk-io Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 6, 2026 11:04
targetedDelta counts a path whose branch hunks are unchanged and only the base moved lines beside them (comparePath context) as unchanged, so a main merge next to a reviewed hunk no longer hides the targeted-only read (GST-1598).

Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/adversarial-native#2 reader=adversarial-native
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>
@capy-ai
capy-ai Bot merged commit 937b360 into main Nov 6, 2026
43 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