Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA
TypeScript
Run ids in /ship's follow-up review approvals are no longer flagged as phone numbers, and teams named GStack can record rulings (GST-3246) (#4549)
Garry Tan1bd86d9a4547
diff --git a/bin/gstack-approvals b/bin/gstack-approvalsindex 362def8b0..4cbc11378 100755--- a/bin/gstack-approvals+++ b/bin/gstack-approvals@@ -29,7 +29,7 @@ import { spawnSync } from 'node:child_process';import * as path from 'node:path';import { EXIT, exitTableHelp } from '../lib/headless-artifacts';import { appendRows, branchExists, buildRow, importAutoplan, locate, readRecord, renderMode, renderRecord, repoVisibility, syncRecord, type RecordError, type StoreLocation } from '../lib/approval-record';-import { GSTACK_ACTOR, isGstackActorName, openShipRun, OWNER_REF, RULED_NOTE_SCOPE, ruledNoteRow, ruledNoteSource, ruledNotes, ruledNoteText } from '../lib/ruled-notes';+import { isGstackActor, isGstackActorName, openShipRun, OWNER_REF, RULED_NOTE_SCOPE, ruledNoteRow, ruledNoteSource, ruledNotes, ruledNoteText } from '../lib/ruled-notes';import { resultLine } from '../lib/result-codes';import { parsePlanLine, publicPlanLine, resolvePlan } from '../lib/plan-record';import { TEST_LANE_EXCEPTION_SCOPE, testLaneExceptionRow } from '../lib/test-lane-exception';@@ -195,7 +195,7 @@ function main(argv: string[]): number {if (!files.length || files.some(f => /\s/.test(f)) || !reason || /[\x00-\x1f\x7f]/.test(reason)) return invalid('lane-exception needs --files <the uncovered inventory files, comma-separated, no spaces> and --reason <why, one line>');const head = spawnSync('git', ['rev-parse', '--verify', '--quiet', `${flags['--head'] ?? ''}^{commit}`], { encoding: 'utf8', timeout: 10_000 });if (!flags['--head'] || head.status !== 0) return invalid('lane-exception needs --head <the pushed head the owner granted at, a commit in this repository>');- if (GSTACK_ACTOR.test((flags['--by'] ?? '').trim())) return invalid('--by names gstack; a test-lane exception is the owner\'s, so --by names who granted it');+ if (isGstackActor(flags['--by'] ?? '')) return invalid('--by names gstack; a test-lane exception is the owner\'s, so --by names who granted it');const open = openShipRun(process.cwd());if (open) return invalid(`/ship run ${open} is open on this checkout: a test-lane exception is the owner's, never the lane's own runner's; record it from the owner's session`);const built = buildRow({ ...testLaneExceptionRow(head.stdout.trim(), files, reason), words: flags['--words'] ?? '', by: flags['--by'] ?? '', date: flags['--date'] }, loc.branch);@@ -208,7 +208,7 @@ function main(argv: string[]): number {if (/[\x00-\x1f\x7f]/.test(reason)) return invalid('--reason is one line: no newline or control character');const head = spawnSync('git', ['rev-parse', '--verify', '--quiet', `${flags['--head'] ?? ''}^{commit}`], { encoding: 'utf8', timeout: 10_000 });if (!flags['--head'] || head.status !== 0) return invalid('rule needs --head <the stop head the owner ruled at, a commit in this repository>');- if (GSTACK_ACTOR.test((flags['--by'] ?? '').trim())) return invalid('--by names gstack; a ruling is the owner\'s, so --by names who ruled');+ if (isGstackActor(flags['--by'] ?? '')) return invalid('--by names gstack; a ruling is the owner\'s, so --by names who ruled');const ownerRef = flags['--owner-ref']?.trim(), notSecurity = bools.has('--not-security');if (ownerRef !== undefined && (!OWNER_REF.test(ownerRef) || !(flags['--words'] ?? '').trim() || !(flags['--by'] ?? '').trim())) return invalid('--owner-ref relays the owner\'s ruling: <thread code>:<message id or timestamp> (GSTA-36:2026-11-19T12:29:59Z), with --by <the owner> and --words <their exact words>');if (notSecurity && !/:red-team$/i.test(finding)) return invalid('--not-security is the owner\'s call on a red-team finding (path:line:red-team); a security, auth or secret finding is security class by its category');@@ -226,7 +226,7 @@ function main(argv: string[]): number {if (!ONE_LINE.test(reason) || !ONE_LINE.test(words) || !ONE_LINE.test(by)) return invalid('--reason, --words and --by are one line each: no newline or control character');const head = spawnSync('git', ['rev-parse', '--verify', '--quiet', `${flags['--head'] ?? ''}^{commit}`], { encoding: 'utf8', timeout: 10_000 });if (!flags['--head'] || head.status !== 0) return invalid('gate needs --head <the stop head the owner answered at, a commit in this repository>');- if (GSTACK_ACTOR.test(by)) return invalid('--by names gstack; a gate disposition is the owner\'s, so --by names who recorded it');+ if (isGstackActor(by)) return invalid('--by names gstack; a gate disposition is the owner\'s, so --by names who recorded it');const built = buildRow({ ...gateDispositionRow(finding, gateId, head.stdout.trim(), reason), words, by, date: flags['--date'], source: GATE_SOURCE }, loc.branch);if ('code' in built) return fail(cmd, built);const res = recordGateDisposition(process.cwd(), loc, built);diff --git a/changelog.d/approval-run-ids-and-gstack-named-teams.md b/changelog.d/approval-run-ids-and-gstack-named-teams.mdnew file mode 100644index 000000000..d2631a80e--- /dev/null+++ b/changelog.d/approval-run-ids-and-gstack-named-teams.md@@ -0,0 +1 @@+**Two /ship approval records stop needing workarounds.** A run id like `507-7192673` in an approval for a follow-up review is no longer read as a phone number, either when it is recorded or when the Approvals table is posted to a private PR; the same digits anywhere else are still caught. And a team named "GStack …" (like `GStack Minder (GSTA-36)`) can record rulings, gate answers and test exceptions, while gstack's own names are still refused.diff --git a/docs/ship-policy.md b/docs/ship-policy.mdindex 54d65b3bf..d439be466 100644--- a/docs/ship-policy.md+++ b/docs/ship-policy.md@@ -1765,7 +1765,9 @@ and ask `ruled_note <fingerprint> at <head>: <reason>`, with the head's full shatwo findings ruled with the same reason in one reply get two rows, and a ruling ata later head is a new row. Its `by` is the ruler and its `recorded_at` the time.`rule` refuses a `--head` that is not a commit in the repository, a reason with a-newline or control character, a `--by` naming gstack, and a ruling while this+newline or control character, a `--by` naming gstack (any `--by` that starts with+`gstack`, except a crew named `GStack <Name>` such as `GStack Minder`, which is a+person's crew; `gstack` and `gstack no-stop default (K1)` are always refused), and a ruling while thischeckout holds an open /ship run's marker (the lane's own runner) unless the lanerelays the owner's words with `--owner-ref <thread code>:<message id or timestamp>`(on Capy the owner, a Captain, has no session on the lane's checkout). A relayed row's@@ -1845,7 +1847,8 @@ The row is an approved `gstack-approvals` row with scope `gate_disposition<head>: <reason>` and the owner's words in `words` (`lib/gate-dispositions.ts`).`gate` refuses a missing `--gate-id` (or a literal `undefined` or `null`), empty`--words`, a reason, words or `--by` with a newline or control character (each is-trimmed first), a `--head` that is not a commit, a `--by` naming gstack, a row that+trimmed first), a `--head` that is not a commit, a `--by` naming gstack (as for+`rule`: a `GStack <Name>` crew may record), a row that`dispositions` would not list (a head that is not 40 hex, for one), and any callwhile a /ship run is open on the branch in any worktree of the repository: itsmarker counts while its lease is open, the same test preflight uses, so a run parked@@ -1939,7 +1942,8 @@ gstack-approvals lane-exception --head <pushed head> --files <f1,f2> \The row is an approved `gstack-approvals` row with scope `test_lane_exception <head><files>` and ask `test_lane_exception at <head>: <files>: <reason>`(`lib/test-lane-exception.ts`). `lane-exception` refuses a head that is not a-commit, a file with whitespace, a multi-line reason, a `--by` naming gstack and+commit, a file with whitespace, a multi-line reason, a `--by` naming gstack (as+for `rule`: a `GStack <Name>` crew may grant) andany grant while this checkout holds an open /ship run's marker, and `add` refusesthe scope, so the lane's own runner cannot write one; a row by gstack is ignoredwherever it came from. `gstack-evidence record-ci` binds a grant only when itsdiff --git a/docs/troubleshooting.md b/docs/troubleshooting.mdindex 36e14b707..beafe6159 100644--- a/docs/troubleshooting.md+++ b/docs/troubleshooting.md@@ -2240,7 +2240,8 @@ a `--date` that is not a real `YYYY-MM-DD` day) or exceeds a length cap (ask, scpending 300 characters, words 2,000). Exit 2. Nothing was written.`rule` and `lane-exception` refuse with this code too: a `--head` that is nota commit in the repository, a reason that is missing or holds a newline or-control character, a `--by` naming gstack, any record while this checkout+control character, a `--by` naming gstack (a crew named `GStack <Name>`, such as+`GStack Minder`, is not gstack and may record), any record while this checkoutholds an open /ship run, and for `lane-exception` a `--files` list that isempty or holds whitespace. `add` refuses a `ruled_note` or`test_lane_exception` scope ([ruled notes](ship-policy.md#ruled-notes),@@ -2277,6 +2278,10 @@ the id has the minted shape `<name>-<14 digits>` (GST-2047; since GST-3015 thename ends in six random letters); a phone number inthe rest of the directory name, the same id anywhere else, and every otherfinding in the row still refuse.+Likewise a `pii.phone.e164` finding that starts inside the `stop=` run id of a+fix-check round grant's scope (`review_round_grant <sha> pr=<n> kind=fix-check+stop=507-7192673 findings=…`) is skipped (GST-3246); the same digits in the+reason, the words or any other field still refuse.**Fix.** Record the words with the secret replaced by `[redacted]`, or ask the person torestate them. Rotate the secret if it was real.@@ -3305,6 +3310,11 @@ exact tokens it finds in these positions:shape above (#4480). The same value on a line without that prefix, on areceipt-prefixed line inside a hand-written or non-receipt code block, or aphone number elsewhere on a receipt line still reports.+- in a rendered `## Approvals` table (the header, its rule line and the+ closing `Source: gstack-approvals record for …` footer `render` writes),+ the `stop=` run id of a row whose Covers cell is a whole fix-check round+ grant scope (GST-3246). The same digits in another cell, in prose or in a+ table without that footer still report.A bare 11-digit number with none of that context, a 10-digit national numberand an E.164 `+14155551234` still report, so the finding means the id standsdiff --git a/lib/approval-record.ts b/lib/approval-record.tsindex 015dea559..4b002d84f 100644--- a/lib/approval-record.ts+++ b/lib/approval-record.ts@@ -191,6 +191,16 @@ const MINTED_RUN_ID = /^[A-Za-z0-9._-]{1,64}-\d{14}$/;/** The part of a minted run id the exemption covers: the 14-digit stamp and, when the name ends in a thread code, its digits. */const RUN_ID_STAMP = /(?:(?<!\d)\d{1,6}-)?\d{14}$/;+/**+ * A fix-check round grant's scope as gstack-approvals round-grant writes it (lib/review-round-grant.ts): its stop= token is the+ * /ship run id, often a PR number, a dash and a short sha (`507-7192673`), which pii.phone.e164 reads as a phone number+ * (harness-evals #507). Only a phone finding that starts inside that token of the scope field is skipped; the reason, the words+ * and every other field, a grant-shaped excerpt pasted into them included, are scanned as usual.+ */+const GRANT_STOP_SCOPE = /^review_round_grant [0-9a-f]{40} pr=[1-9]\d* kind=fix-check stop=([\w.:-]{1,120}) findings=\S+$/;+/** A rendered table row whose Covers cell, the one before Still pending, is a whole GRANT_STOP_SCOPE. */+const GRANT_STOP_ROW = /^\| .* \| (review_round_grant [0-9a-f]{40} pr=[1-9]\d* kind=fix-check stop=)([\w.:-]{1,120}) findings=[^\s|]+ \| (?:[^|\\]|\\.)* \|$/d;+/*** Validate and secret-scan one row; the error names the field and rule, never the text. `runId` (import only) is a* minted autoplan run id and the offset where the importer placed it in each field: pii.phone.e164 and pii.cc read its@@ -214,7 +224,10 @@ export function buildRow(input: NewRow, branch: string, now = new Date(), runId?const at = runId && MINTED_RUN_ID.test(runId.id) ? runId.at[k as 'ask' | 'source'] : undefined;const stamp = at === undefined ? 0 : RUN_ID_STAMP.exec(runId!.id)![0].length;const inRunId = (f: Finding) => at !== undefined && (f.id === 'pii.phone.e164' || f.id === 'pii.cc') && f.line === 1 && f.col - 1 >= at + runId!.id.length - stamp && f.col - 1 < at + runId!.id.length;- const hits = s.findings.filter(f => (f.severity === 'HIGH' || f.severity === 'MEDIUM') && !inRunId(f));+ const stop = k === 'scope' ? GRANT_STOP_SCOPE.exec(v) : null;+ const stopAt = stop ? v.indexOf(' stop=') + ' stop='.length : -1;+ const inStopRun = (f: Finding) => !!stop && f.id === 'pii.phone.e164' && f.line === 1 && f.col - 1 >= stopAt && f.col - 1 < stopAt + stop[1]!.length;+ const hits = s.findings.filter(f => (f.severity === 'HIGH' || f.severity === 'MEDIUM') && !inRunId(f) && !inStopRun(f));if (s.oversize || hits.length) return { code: 'APPROVAL_RECORD_SECRET', message: `field ${k}: ${s.oversize ? 'oversize input' : [...new Set(hits.map(f => f.id))].join(', ')}` };}const id = 'a-' + createHash('sha256').update([fields.source, date, fields.ask, fields.words, fields.by].join('\u0000')).digest('hex').slice(0, 12);@@ -352,6 +365,30 @@ export function renderRecord(read: ReadResult, loc: StoreLocation, o: { heading?return [...head, ...lines, '', `Source: gstack-approvals record for ${cell(loc.branch)} ${APPROVALS_FOOTER_END}`, ''].join('\n');}+/**+ * Where a rendered Approvals table shows a fix-check grant's stop= run id (GST-3246): the 1-based line and column span of that token in+ * each row whose Covers cell is a whole GRANT_STOP_SCOPE, inside a table that opens with APPROVALS_TABLE_HEADER and its rule line and+ * closes on renderRecord's Source footer. gstack-post skips a pii.phone.e164 finding only inside such a span, so the same digits in any+ * other cell, in prose or in a table without that footer still report.+ */+export function approvalsGrantStopSpans(text: string): Array<{ line: number; from: number; to: number }> {+ const lines = text.split('\n');+ const spans: Array<{ line: number; from: number; to: number }> = [];+ for (let i = 0; i < lines.length; i++) {+ if (lines[i] !== APPROVALS_TABLE_HEADER || lines[i + 1] !== '|---|---|---|---|---|---|') continue;+ let end = i + 2;+ while (end < lines.length && lines[end]!.startsWith('| ')) end++;+ const footer = lines[end + 1] ?? '';+ if (lines[end] !== '' || !footer.startsWith('Source: gstack-approvals record for ') || !footer.endsWith(APPROVALS_FOOTER_END)) continue;+ for (let j = i + 2; j < end; j++) {+ const m = GRANT_STOP_ROW.exec(lines[j]!);+ if (m) spans.push({ line: j + 1, from: m.indices![2]![0] + 1, to: m.indices![2]![1] });+ }+ i = end + 1;+ }+ return spans;+}+interface DecisionLike { id?: string; title?: string; status?: string; chosen?: string | null; recommended?: string | null; gate_rev?: number; answered_at?: string; answered_by?: string; reply?: string; owner_reply?: string; answer_words?: string; words_by?: string; carried_from?: string; label?: string; chosen_text?: string;carried_gate_from?: string; carried_gate_rev?: number; carried_answered_by?: string; carried_under?: string; carry_check?: string }diff --git a/lib/gate-dispositions.ts b/lib/gate-dispositions.tsindex 809e987d8..f423d1fe8 100644--- a/lib/gate-dispositions.ts+++ b/lib/gate-dispositions.ts@@ -19,7 +19,7 @@ import * as path from 'node:path';import { appendRows, locate, readRecord, type ApprovalRow, type Env, type RecordError, type StoreLocation } from './approval-record';import type { ShipReceipt } from './headless-artifacts';import type { ResultCodeName } from './result-codes';-import { GSTACK_ACTOR } from './ruled-notes';+import { isGstackActor } from './ruled-notes';import { isSecurityFinding, REDACTED_FINDING, REDACTED_REASON, REDACTED_WORDS } from './security-findings';import { BIN_DIR, runScriptSync } from './script-invocation';@@ -42,7 +42,7 @@ export const gateDispositionDigest = (r: Record<string, unknown>) => 'sha256:' +function writerShaped(r: Record<string, any>, branch: string): boolean {const str = (v: unknown) => typeof v === 'string' && v.trim() === v && v !== '';return r.schema_version === 1 && typeof r.id === 'string' && APPROVAL_ID.test(r.id) && r.source === GATE_SOURCE && r.outcome === 'approved' &&- r.pending === 'none' && str(r.by) && ONE_LINE.test(r.by) && !GSTACK_ACTOR.test(r.by) && str(r.words) && ONE_LINE.test(r.words) && typeof r.date === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(r.date) &&+ r.pending === 'none' && str(r.by) && ONE_LINE.test(r.by) && !isGstackActor(r.by) && str(r.words) && ONE_LINE.test(r.words) && typeof r.date === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(r.date) &&typeof r.recorded_at === 'string' && ISO_TIME.test(r.recorded_at) && r.branch === branch && typeof r.ask === 'string' && typeof r.scope === 'string' &&r.id === 'a-' + createHash('sha256').update([r.source, r.date, r.ask, r.words, r.by].join('\u0000')).digest('hex').slice(0, 12) &&r.digest === gateDispositionDigest(r);diff --git a/lib/gstack-post.ts b/lib/gstack-post.tsindex 91c67691d..bc6eda8f1 100644--- a/lib/gstack-post.ts+++ b/lib/gstack-post.ts@@ -42,6 +42,7 @@ import { canonicalRemote } from "./remote-identity";import { parseChangelog } from "./changelog-check";import { versionWidth } from "./version-source";import { securityFingerprints } from "./security-findings";+import { approvalsGrantStopSpans } from "./approval-record";export const OPS = ["pr-comment", "issue-comment", "reply", "pr-title", "pr-body", "pr-create", "issue-create", "fold"] as const;export type Op = (typeof OPS)[number];@@ -635,7 +636,7 @@ function scanParts(parts: Array<[Part, string]>, vis: RepoVisibility, selfEmail:for (const [part, text] of parts) {const result = scan(text, { repoVisibility: vis, allowlist, ...(selfEmail ? { selfEmail } : {}) });oversize ||= result.oversize;- const runIds = result.findings.some(f => f.id === "pii.phone.e164") ? receiptIdSpans(text) : [];+ const runIds = result.findings.some(f => f.id === "pii.phone.e164") ? [...receiptIdSpans(text), ...approvalsGrantStopSpans(text)] : [];for (const finding of result.findings) {if (finding.id === "pii.phone.e164" && runIds.some(s => s.line === finding.line && s.from <= finding.col && finding.col <= s.to)) continue;found.push({ part, finding });diff --git a/lib/ruled-notes.ts b/lib/ruled-notes.tsindex f84cc2166..28008d5ab 100644--- a/lib/ruled-notes.ts+++ b/lib/ruled-notes.ts@@ -16,10 +16,17 @@ export interface RuledNote { finding: string; head: string; by: string; reason:const SCOPE = /^ruled_note (\S+) ([0-9a-f]{40})$/;const ASK = /^ruled_note (\S+) at ([0-9a-f]{40}): (\S(?:.*\S)?)$/;/** A ruler gstack names for itself (the no-stop default's `gstack no-stop default (K1)`) is no owner. */-export const GSTACK_ACTOR = /^gstack\b/i;+const GSTACK_ACTOR = /^gstack\b/i;+/**+ * A crew named after gstack, in its brand capitals with a capitalised word after it (`GStack Minder (GSTA-36)`), is a person's+ * crew: GSTACK_ACTOR's prefix match refused it as --by on every owner record. gstack writes each name of its own in lower case+ * (GSTACK_ACTOR_NAMES, bin/gstack-no-stop), so this exemption on top of the catch admits none of them.+ */+const GSTACK_NAMED_CREW = /^GStack [A-Z]/;/** The names gstack itself writes as `by`, matched whole: `gstack-evals Captain` or `GStack Minder` is a person's crew, not gstack. */export const GSTACK_ACTOR_NAMES: readonly string[] = ['gstack', 'gstack no-stop default (K1)'];export const isGstackActorName = (by: string) => GSTACK_ACTOR_NAMES.some(n => n.toLowerCase() === by.trim().toLowerCase());+export const isGstackActor = (by: string) => GSTACK_ACTOR.test(by.trim()) && !(GSTACK_NAMED_CREW.test(by.trim()) && !isGstackActorName(by));export const RULED_NOTE_SCOPE = /^\s*ruled_note\b/;export const ruledNoteRow = (finding: string, head: string, reason: string) => ({ scope: `ruled_note ${finding} ${head}`, ask: `ruled_note ${finding} at ${head}: ${reason}` });@@ -34,7 +41,7 @@ export function ruledNotes(rows: readonly ApprovalRow[]): RuledNote[] {const byFinding = new Map<string, RuledNote>();for (const r of rows) {const scope = SCOPE.exec(r.scope), ask = ASK.exec(r.ask);- if (r.outcome !== 'approved' || !scope || !ask || ask[1] !== scope[1] || ask[2] !== scope[2] || GSTACK_ACTOR.test(r.by)) continue;+ if (r.outcome !== 'approved' || !scope || !ask || ask[1] !== scope[1] || ask[2] !== scope[2] || isGstackActor(r.by)) continue;const finding = scope[1]!, head = scope[2]!, key = `${finding} ${head}`;byFinding.delete(key);const source = r.source.split(' ');diff --git a/lib/test-lane-exception.ts b/lib/test-lane-exception.tsindex 4f233fe60..92d7f6b7f 100644--- a/lib/test-lane-exception.ts+++ b/lib/test-lane-exception.ts@@ -10,7 +10,7 @@* lane that needs the exception cannot write it for itself.*/import { locate, readRecord, type ApprovalRow, type Env } from './approval-record';-import { GSTACK_ACTOR } from './ruled-notes';+import { isGstackActor } from './ruled-notes';export interface TestLaneException { head: string; files: string[]; by: string; reason: string; at: string; approval: string }/** What the ledger's CI row and the receipt's ci_carried entry keep: the grant plus the preflight that backed it. */@@ -28,7 +28,7 @@ export function testLaneExceptions(rows: readonly ApprovalRow[]): TestLaneExceptconst byGrant = new Map<string, TestLaneException>();for (const r of rows) {const scope = SCOPE.exec(r.scope), ask = ASK.exec(r.ask);- if (r.outcome !== 'approved' || !scope || !ask || ask[1] !== scope[1] || ask[2] !== scope[2] || GSTACK_ACTOR.test(r.by)) continue;+ if (r.outcome !== 'approved' || !scope || !ask || ask[1] !== scope[1] || ask[2] !== scope[2] || isGstackActor(r.by)) continue;const files = scope[2]!.split(',').filter(Boolean).sort(), key = `${scope[1]} ${files.join(',')}`;byGrant.delete(key);byGrant.set(key, { head: scope[1]!, files, by: r.by, reason: ask[3]!, at: r.recorded_at, approval: r.id });diff --git a/test/gstack-post.test.ts b/test/gstack-post.test.tsindex 41ee0c0c0..43c138a2d 100644--- a/test/gstack-post.test.ts+++ b/test/gstack-post.test.ts@@ -15,6 +15,8 @@ import { extractReceipt, orderReceipt, placeReceipt, receiptRuns, receiptSummaryimport { runReceiptFields, type RunEvidence } from "../lib/run-evidence";import type { ShipReceipt } from "../lib/headless-artifacts";import { foldSections, unfoldSections } from "../lib/pr-body-shape";+import { buildRow, renderRecord, type ApprovalRow, type StoreLocation } from "../lib/approval-record";+import { reviewRoundGrantRow } from "../lib/review-round-grant";interface Call { cmd: string; args: string[]; input?: string }@@ -411,6 +413,43 @@ describe("gstack-post owns the redaction scan", () => {}});+ // Value: protects=a private PR's Approvals table (renderRecord, full mode) posts through pr-body without a pii.phone.e164 confirmation when a+ // fix-check grant row's Covers cell names a run id like 507-7192673 (GST-3246, trail-read row 8), while the same digits in that row's+ // Asked or Exact words cell, in prose, or in a table no Source footer closes still need one; fails_when=every private /ship body with such a+ // grant needs --confirm, or the exemption reaches past the stop= token of a renderer-shaped table; seam=fake run; no_claim=real gh+ test("a fix-check grant's run id in a rendered Approvals table is no phone number; the same digits anywhere else still are", () => {+ const HEAD = "2294465066182c2f99d64ba0016213463aaa0c14";+ const loc: StoreLocation = { file: "/x", branch: "fix-undo-line", slug: "acme-widget", ephemeral: false };+ const grant = (reason: string, words = "one fix round") => {+ const row = buildRow({ ...reviewRoundGrantRow(HEAD, 507, "fix-check", reason, { run: "507-7192673", findings: ["p2/outside-voice#3"] }), words, by: "GStack Minder (GSTA-36)" }, loc.branch);+ if ("code" in row) throw new Error(row.message);+ return row;+ };+ const table = (rows: ApprovalRow[]) => renderRecord({ rows, state: "present", restored: false }, loc, { mode: "full" });+ const post = (text: string) => {+ const f = fakeEnv({ files: { "/b": text }, visibility: "private" });+ return { code: run(["pr-body", "507", "--replace", "--body-file", "/b"], f), phones: f.stdout().split("\n").filter(l => l.startsWith("RULE: pii.phone.e164 ")), f };+ };+ const lineOf = (text: string, needle: string) => text.split("\n").findIndex(l => l.includes(needle)) + 1;+ const ok = `## What changed\n\nFixes the undo line.\n\n${table([grant("the undo line names the wrong migration")])}`;+ expect(ok).toContain("stop=507-7192673 findings=p2/outside-voice#3 |");+ const clean = post(ok);+ expect([clean.phones, clean.code]).toEqual([[], EXIT.posted]);+ expect(clean.f.posts()).toHaveLength(1);++ const footerless = table([grant("the undo line names the wrong migration")]).replace(/\nSource: gstack-approvals record for .*\n/, "\n");+ const holds: Array<[string, string, string]> = [+ ["the digits in prose", ok + "\nCall 507-7192673 for the on-call.\n", "Call 507-7192673"],+ ["the digits in the Asked cell", ok.replace("the undo line names the wrong migration", "call 507-7192673 later"), "call 507-7192673"],+ ["a table no Source footer closes", `## What changed\n\n${footerless}`, "stop=507-7192673"],+ ];+ for (const [name, text, needle] of holds) {+ const { code, phones, f } = post(text);+ expect([name, phones, code]).toEqual([name, [`RULE: pii.phone.e164 LINE: ${lineOf(foldSections(text), needle)} PART: body`], EXIT.confirm]);+ expect(f.posts()).toEqual([]);+ }+ });+// Value: protects=a LOW privacy finding (a home path) is a stderr note and never holds a post, while a credential still refuses even inside a// writer-rendered receipt block, whose exemption covers only its run ids (GST-2047); fails_when=a home path needs --confirm, or a key in a// receipt field posts or only asks for confirmation; why_new=no test pinned LOW as non-holding or a key inside a generated block; seam=fakediff --git a/test/pr-round-cli.test.ts b/test/pr-round-cli.test.tsindex b4587695a..f4bab4911 100644--- a/test/pr-round-cli.test.ts+++ b/test/pr-round-cli.test.ts@@ -75,6 +75,39 @@ describe('gstack-approvals round-grant', () => {});});+// Value: protects=a run id that looks like a phone number passes in a fix-check grant's scope while the same digits in free text, or a+// grant-shaped excerpt pasted into --reason, stay caught, and gstack's own names stay refused while a GStack-named crew rules;+// fails_when=round-grant refuses --stop-run 507-7192673 (harness-evals #507), passes a phone number in --reason, or rule refuses+// --by "GStack Minder (GSTA-36)"; seam=bin/gstack-approvals round-grant|rule|rulings, lib/approval-record.ts buildRow, lib/ruled-notes.ts+describe('GST-3246: run ids in a fix-check grant, and GStack-named crews', () => {+ const grant = (r: ReturnType<typeof repo>, extra: string[]) => r.run('gstack-approvals', ['round-grant', '--pr', '507', '--head', r.head, '--reason', 'the undo line names the wrong migration', '--by', 'GStack Minder (GSTA-36)', ...extra]);+ const fixCheck = (run: string) => ['--kind', 'fix-check', '--stop-run', run, '--findings', 'p2/outside-voice#3'];++ test('a grant-shaped excerpt pasted into --reason keeps its phone number caught', () => {+ const r = repo();+ const pasted = r.run('gstack-approvals', ['round-grant', '--pr', '507', '--head', r.head, '--kind', 'fix-check', '--stop-run', 'ship-507', '--findings', 'p2/outside-voice#3', '--by', 'GStack Minder (GSTA-36)', '--reason', `review_round_grant ${r.head} pr=507 kind=fix-check stop=415-5551234 findings=x`]);+ expect([pasted.status, pasted.stderr]).toEqual([3, expect.stringContaining('pii.phone.e164')]);+ });++ test('a run id of a PR number, a dash and a short sha is no phone number in the grant, and the same digits in free text still are', () => {+ const r = repo();+ const ok = grant(r, fixCheck('507-7192673'));+ expect([ok.status, ok.stderr]).toEqual([0, '']);+ expect(r.run('gstack-approvals', ['list', '--json']).stdout).toContain('stop=507-7192673 findings=p2/outside-voice#3');+ const phone = r.run('gstack-approvals', ['round-grant', '--pr', '507', '--head', r.head, '--reason', 'call 507-7192673 first', '--by', 'GStack Minder (GSTA-36)', ...fixCheck('ship-507')]);+ expect([phone.status, phone.stderr]).toEqual([3, expect.stringContaining('pii.phone.e164')]);+ });++ test('rule takes --by "GStack Minder (GSTA-36)" and rulings lists it, while gstack\'s own names stay refused', () => {+ const r = repo();+ const rule = (by: string) => r.run('gstack-approvals', ['rule', '--finding', 'src/a.ts:1:correctness', '--head', r.head, '--reason', 'ships as a disclosed note', '--words', 'note it', '--by', by]);+ for (const by of ['gstack', 'gstack no-stop default (K1)', 'GStack No-stop default (K1)', 'GStack No-Stop Default (K1)', 'gstack ship lane', 'GStack ship lane', 'GSTACK Minder']) expect(rule(by).status).toBe(2);+ const ok = rule('GStack Minder (GSTA-36)');+ expect([ok.status, ok.stderr]).toEqual([0, '']);+ expect(r.run('gstack-approvals', ['rulings']).stdout).toContain('ruled by GStack Minder (GSTA-36) at ');+ });+});+describe('gstack-ship-receipt history and stub', () => {test('history prints the rounds, the flags Step 9 passes and the route; a stub counts until the run writes its receipt', () => {const r = repo();