From acb1f4ece9bac22984aad40d93982ad5ee7b9667 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Fri, 20 Nov 2026 11:59:55 -0800 Subject: [PATCH] Owner rulings close a stopped review whose findings were logged in a findings file (GST-3296) (#4568) When /ship's final review is logged with `--findings `, or the native reader's row lists no findings, the owner's `gstack-approvals rule` rows now close those rows at Step 11.5. Why: harness-evals#515 had all 12 rulings recorded and green CI, yet /ship stopped at Step 11.5 because the rulings had nothing to match. Nothing to do: rows that already work read the same, and an unruled blocker, a noted CRITICAL or an unfinished pass still refuses. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=specialist-batched --- bin/gstack-review-read | 15 ++- .../ruled-notes-bind-findings-file-rows.md | 1 + docs/ship-policy.md | 13 ++- lib/review-evidence.ts | 62 +++++++++-- test/ship-finish-ruled-notes.test.ts | 105 ++++++++++++++++++ 5 files changed, 182 insertions(+), 14 deletions(-) create mode 100644 changelog.d/ruled-notes-bind-findings-file-rows.md diff --git a/bin/gstack-review-read b/bin/gstack-review-read index a83c355f3..d67d32525 100755 --- a/bin/gstack-review-read +++ b/bin/gstack-review-read @@ -12,7 +12,10 @@ # those approval ids (lib/gate-dispositions.ts). review_freshness counts the owner's # gstack-approvals rule rows at a head in the row's range (ruledOn), and the row's `ruled_notes` # lists their approval ids; values the row itself carried are discarded. When a stopped pass stays -# UNVERIFIED, its reason names the findings no ruling covers yet (rulingGap, GST-3267). +# UNVERIFIED, its reason names the findings no ruling covers yet (rulingGap, GST-3267), or says the row +# lists no findings at all. A stopped row logged with --findings shows that file's findings, and a native +# row that lists none shows its pass's review-row findings, with `findings_from` naming the source +# (withCollectedFindings, GST-3296). set -euo pipefail GSTACK_BUN_CONFIG=/dev/null; case "${OSTYPE:-}" in msys*|cygwin*) if command -v cygpath >/dev/null 2>&1; then GSTACK_BUN_CONFIG=NUL; fi ;; esac SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" @@ -27,7 +30,7 @@ GSTACK_HOME="$_gstack_sr_root" WTREE=$("$SCRIPT_DIR/gstack-wtree" --review 2>/dev/null || echo "unknown") if [ -f "$GSTACK_HOME/projects/$SLUG/$BRANCH-reviews.jsonl" ]; then GSTACK_REVIEW_LIB="$SCRIPT_DIR/../lib/review-evidence.ts" GSTACK_GATE_LIB="$SCRIPT_DIR/../lib/gate-dispositions.ts" GSTACK_RULED_LIB="$SCRIPT_DIR/../lib/ruled-notes.ts" GSTACK_REVIEW_WTREE="$WTREE" bun --no-env-file --config="${GSTACK_BUN_CONFIG:-/dev/null}" -e ' - const { reviewFreshness, rulingGap } = await import(process.env.GSTACK_REVIEW_LIB); + const { reviewFreshness, rulingGap, withCollectedFindings } = await import(process.env.GSTACK_REVIEW_LIB); const { dispositionedOn, gateKey, readGateDispositions, ruledOn, showDispositioned } = await import(process.env.GSTACK_GATE_LIB); const { readRuledNotes } = await import(process.env.GSTACK_RULED_LIB); let dispositions = []; @@ -36,9 +39,13 @@ if [ -f "$GSTACK_HOME/projects/$SLUG/$BRANCH-reviews.jsonl" ]; then let rulings = []; try { rulings = readRuledNotes(process.cwd()); } catch (e) { console.error("gstack-review-read: rulings unreadable, none applied: " + e.message); } - for (const line of (await Bun.stdin.text()).split("\n").filter(Boolean)) { + const recs = (await Bun.stdin.text()).split("\n").filter(Boolean).map(line => { + try { const rec = JSON.parse(line); return rec && typeof rec === "object" && !Array.isArray(rec) ? rec : null; } catch { return null; } + }); + withCollectedFindings(recs.filter(Boolean)); + for (const rec of recs) { try { - const rec = JSON.parse(line); + if (!rec) throw new Error("malformed"); delete rec.review_freshness; delete rec.gate_dispositions; delete rec.ruled_notes; diff --git a/changelog.d/ruled-notes-bind-findings-file-rows.md b/changelog.d/ruled-notes-bind-findings-file-rows.md new file mode 100644 index 000000000..684adf5b7 --- /dev/null +++ b/changelog.d/ruled-notes-bind-findings-file-rows.md @@ -0,0 +1 @@ +- **Owner rulings now close a stopped review whose findings were logged in a findings file.** When /ship's final review was logged with `gstack-review-log --findings `, or the native reader's row listed no findings, `gstack-review-read` had nothing to match the owner's `gstack-approvals rule` rows against, so Step 11.5 stayed unverified even with every blocker ruled (harness-evals#515). It now reads the file's findings onto the row while the file still matches the counts the row recorded, and gives a native row with no findings the same pass's review findings, so the existing rulings bind both rows at the tree they read. A noted CRITICAL still needs its own ruling, an unruled blocker or a pass that didn't complete still refuses, and a row that claims issues but lists no findings now says so in its reason. diff --git a/docs/ship-policy.md b/docs/ship-policy.md index 21b90e133..4fed5fd61 100644 --- a/docs/ship-policy.md +++ b/docs/ship-policy.md @@ -1814,6 +1814,15 @@ closed. So a final review or native reader that stopped on findings the owner th ruled reads `CURRENT` at the one tree its `incomplete` binding names, while a ruling on another branch, at another head, for another finding or by gstack itself closes nothing (harness-evals#498). +A stopped Step 9 row logged with `--findings ` carries its findings in that +file, not on the row, so `gstack-review-read` shows the file's findings on the row +(`findings_from` names the file) while the file still derives the counts the row +recorded. A Step 11 native row that lists no findings shows the findings of the +Step 9 row of the same pass, commit and bound tree, because Step 9 carries Step +11's queued findings; rulings must then cover every blocker of that pass. A file +that is missing or changed attaches nothing, and any row that claims issues but +lists no findings reads `it lists no findings (fcount 0) but claims …` with the +cause (harness-evals#515, GST-3296). **Security findings stay private (GST-3076).** A PR body keeps every earlier @@ -1887,7 +1896,9 @@ finding as `kept` with `reason: owner disposition : ` and row as if the findings were kept, so /ship's gate rules (`--blocking-open`, `--gate-open`, the draft state, the `Gate edits:` counts) read them as kept once it reads the row again. As with rulings, a row derived from a findings file -(`status_source: derived`) is not cleared. Nothing is hidden: finish prints each as +(`status_source: derived`) is cleared only through the file's findings +`gstack-review-read` shows on it, so a missing or changed file clears nothing +(GST-3296). Nothing is hidden: finish prints each as `GATE_DISPOSITION: [gate ] at by at