From 95ec7ed3e1afbd45c719de43de95707cca96156c Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 23 Nov 2026 16:21:57 +0000 Subject: [PATCH 1/9] Stop false phone-number holds on /ship run ids and name interactive /autoplan runs gstack-post read the run id on each line of a PR body's gstack-receipt-runs block as a phone number, so every /ship that rewrote a body holding earlier runs stopped for a confirmation (#4725). The run value of a well-formed runs line (canonical JSON, 40-hex head, a /ship session id) is now skipped, and a phone number anywhere else is still caught. gstack-approvals import --autoplan now records an interactive /autoplan run under the run id its gate rows carry instead of the folder name "autoplan" (#4402). Interactive run ids put "autoplan" between the branch name and the time stamp, so a branch name ending in digits no longer reads as a phone or card number. Co-authored-by: thomsjack <325974127+thomsjack@users.noreply.github.com> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- autoplan/SKILL.md | 2 +- autoplan/SKILL.md.tmpl | 2 +- changelog.d/privacy-check-skips-run-ids.md | 6 ++ lib/approval-record.ts | 19 ++++-- lib/gstack-post.ts | 19 +++++- lib/plan-record.ts | 8 ++- test/approval-record.test.ts | 67 ++++++++++++++++++++++ test/gstack-post.test.ts | 46 +++++++++++++++ test/plan-record.test.ts | 15 +++++ 9 files changed, 175 insertions(+), 9 deletions(-) create mode 100644 changelog.d/privacy-check-skips-run-ids.md diff --git a/autoplan/SKILL.md b/autoplan/SKILL.md index b20173b01ba..def10ad48dd 100644 --- a/autoplan/SKILL.md +++ b/autoplan/SKILL.md @@ -428,7 +428,7 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-') DATETIME=$(date +%Y%m%d-%H%M%S) echo "SLUG=$SLUG" echo "RESTORE_PATH=$_AP/${BRANCH}-autoplan-restore-${DATETIME}.md" -echo "RUN_ID=${BRANCH}-${DATETIME}"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run "${BRANCH}-${DATETIME}" --out "$_AP" +_RID=$BRANCH-autoplan-$DATETIME; echo "RUN_ID=$_RID"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run "$_RID" --out "$_AP" ``` Before scope/review: diff --git a/autoplan/SKILL.md.tmpl b/autoplan/SKILL.md.tmpl index 0491359aed0..212e0145f58 100644 --- a/autoplan/SKILL.md.tmpl +++ b/autoplan/SKILL.md.tmpl @@ -202,7 +202,7 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-') DATETIME=$(date +%Y%m%d-%H%M%S) echo "SLUG=$SLUG" echo "RESTORE_PATH=$_AP/${BRANCH}-autoplan-restore-${DATETIME}.md" -echo "RUN_ID=${BRANCH}-${DATETIME}"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run "${BRANCH}-${DATETIME}" --out "$_AP" +_RID=$BRANCH-autoplan-$DATETIME; echo "RUN_ID=$_RID"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run "$_RID" --out "$_AP" ``` Before scope/review: diff --git a/changelog.d/privacy-check-skips-run-ids.md b/changelog.d/privacy-check-skips-run-ids.md new file mode 100644 index 00000000000..cdd6567ce05 --- /dev/null +++ b/changelog.d/privacy-check-skips-run-ids.md @@ -0,0 +1,6 @@ +--- +important: blocker +--- +**Posting a PR body that lists earlier /ship runs no longer stops for a phone number that isn't there.** `gstack-post` read the run id on each line of the `gstack-receipt-runs` block (`4242424-1700000000-deadbeef`) as a phone number, so every /ship that rewrote a PR body with earlier runs waited for a confirmation. The run id on a well-formed line of that block is now skipped; a phone number anywhere else, including elsewhere on the same line, is still caught. Reported by @dgrant (#4725), fix idea from @thomsjack (#4729). + +**`gstack-approvals import --autoplan` records an interactive /autoplan run under its own run id.** Without a `run.json`, every interactive run was imported as `autoplan`, so the run id could not be cited and separate runs shared one gate state. A `Plan: approved:` line naming the run's folder resolves the same way. New interactive run ids put `autoplan` between the branch name and the time stamp, so a branch name ending in digits no longer turns the id into something the privacy check reads as a phone or card number. Reported by @exGeni (#4402). diff --git a/lib/approval-record.ts b/lib/approval-record.ts index 4b002d84f6e..b18dd874581 100644 --- a/lib/approval-record.ts +++ b/lib/approval-record.ts @@ -389,11 +389,21 @@ export function approvalsGrantStopSpans(text: string): Array<{ line: number; fro 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; +interface DecisionLike { id?: string; run?: 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 } const stripRef = (t: string) => t.replace(/\s*\[[^\]]*\]\s*$/, '').trim(); +/** + * The run id an autoplan run directory answers to: run.json's, else the newest run its gate rows carry (an interactive + * /autoplan writes no run.json and appends every run to the same directory, #4402), else the directory name. + */ +export function autoplanRunId(runDir: string, run: Record, rows: readonly { run?: unknown }[]): string { + if (run.run ?? run.id) return String(run.run ?? run.id); + const newest = [...rows].reverse().find(r => typeof r.run === 'string' && r.run.length > 0)?.run; + return typeof newest === 'string' ? newest : path.basename(runDir); +} + /** * Rows for every answered gate in an autoplan run: one row per answer event (gate_rev, time, answerer), covering * the items it settled. Item answers carried from an earlier revision were recorded when first given and are skipped; @@ -417,8 +427,9 @@ export function importAutoplan(runDir: string, branch: string, by?: string): App const plan = reviewedPlan(runDir, run); const planTitle = firstTitle(plan.text) ?? 'the plan'; const planSha = plan.sha; - const runId = String(run.run ?? run.id ?? path.basename(runDir)); - const answered = rows.filter(r => r.status && r.status !== 'pending' && r.answered_at && !r.carried_from); + const runId = autoplanRunId(runDir, run, rows); + const own = (run.run ?? run.id) || !rows.some(r => r.run === runId) ? rows : rows.filter(r => r.run === runId); + const answered = own.filter(r => r.status && r.status !== 'pending' && r.answered_at && !r.carried_from); if (!answered.length) return { code: 'APPROVAL_IMPORT_UNANSWERED', message: `no answered gate in ${runDir}` }; const groups = new Map(); for (const r of answered) { @@ -433,7 +444,7 @@ export function importAutoplan(runDir: string, branch: string, by?: string): App const outcome: Outcome = !p1 ? 'pending' : p1.chosen === 'a' || p1.chosen === 'b' ? 'approved' : p1.chosen === 'e' ? 'rejected' : 'pending'; const items = group.filter(r => r !== p1); const changed = items.filter(r => r.chosen && r.recommended && r.chosen !== r.recommended); - const stillPending = rows.filter(r => r.gate_rev === rev && r.status === 'pending'); + const stillPending = own.filter(r => r.gate_rev === rev && r.status === 'pending'); const answerer = first.answered_by ?? 'unknown'; const carried = p1?.carried_gate_from ? p1 : undefined; const relayed = carried?.carried_answered_by && carried.carried_answered_by !== 'human' ? `, relayed by ${carried.carried_answered_by}` : ''; diff --git a/lib/gstack-post.ts b/lib/gstack-post.ts index bc6eda8f188..89a203f7fda 100644 --- a/lib/gstack-post.ts +++ b/lib/gstack-post.ts @@ -577,7 +577,9 @@ const lineIdSpans = (text: string, line: number): Span[] => RECEIPT_LINE_IDS.fla * span of each value below. In every closed ```gstack-ship-receipt``` block whose JSON passes the receipt schema and is byte-identical to * renderReceiptBlock's rendering of it: each ci_carried[].run, flaky_exception[].runs[] and issues.flakes[].run value that is a run id (11 to 20 * digits, with an optional /attempt), the run value when it is a gstack-skill-start session id, and the RECEIPT_LINE_IDS values inside the - * pregate and requires_remote[] values. On every line outside a fenced code block that opens with a receipt-line prefix (RECEIPT_LINE), its RECEIPT_LINE_IDS values. Only + * pregate and requires_remote[] values. In every closed ```gstack-receipt-runs``` block (gstack#4725), the top-level run value of each line that is a + * JSON object byte-identical to its JSON.stringify rendering, with a 40-hex head and a run that is a gstack-skill-start session id. On every line + * outside a fenced code block that opens with a receipt-line prefix (RECEIPT_LINE), its RECEIPT_LINE_IDS values. Only * those writers' own output qualifies, so a hand-written, schema-invalid, malformed or unclosed block exempts nothing, and the same number in * prose, in any other code block (a receipt-prefixed line inside one included), on a line without a receipt prefix or under any other key still reports. */ @@ -626,6 +628,21 @@ function receiptIdSpans(text: string): Span[] { receipt.issues?.flakes?.forEach((_, i) => span(["issues", "flakes", i, "run"])); open = close; } + for (let open = 0; open < lines.length; open++) { + if (lines[open] !== "```" + RUNS_FENCE) continue; + const close = lines.indexOf("```", open + 1); + if (close < 0) break; + for (let i = open + 1; i < close; i++) { + let entry: Record; + try { entry = JSON.parse(lines[i]!); } catch { continue; } + if (entry === null || typeof entry !== "object" || Array.isArray(entry) || JSON.stringify(entry) !== lines[i]) continue; + if (typeof entry.head !== "string" || !/^[0-9a-f]{40}$/.test(entry.head) || typeof entry.run !== "string" || !SESSION_ID.test(entry.run)) continue; + const before = Object.keys(entry).slice(0, Object.keys(entry).indexOf("run")); + const from = JSON.stringify(Object.fromEntries(before.map(k => [k, entry[k]]))).length + (before.length ? 1 : 0) + '"run":'.length; + spans.push({ line: i + 1, from, to: from + JSON.stringify(entry.run).length - 1 }); + } + open = close; + } return spans; } diff --git a/lib/plan-record.ts b/lib/plan-record.ts index 7169ff2f0e6..06aa8412587 100644 --- a/lib/plan-record.ts +++ b/lib/plan-record.ts @@ -24,7 +24,7 @@ import { createHash } from 'node:crypto'; import * as fs from 'node:fs'; import * as path from 'node:path'; import { agentNotesOrBody } from './agent-notes'; -import { locate, type ApprovalRow, type Env } from './approval-record'; +import { autoplanRunId, locate, type ApprovalRow, type Env } from './approval-record'; import type { ResultCodeName } from './result-codes'; import { isUnavailable, loadPolicyFromBase, type ShipPolicy } from './ship-policy'; import { readConfigKeyWithRoot, resolveStateRoot } from './state-root'; @@ -147,7 +147,11 @@ const rowSha = (r: ApprovalRow) => createHash('sha256').update(JSON.stringify(r) function runIdFor(token: string, cwd: string): string { const dir = path.resolve(cwd, token.replace(/^~(?=\/)/, process.env.HOME ?? '~')); if (!token.includes('/')) return token; - try { return String(JSON.parse(fs.readFileSync(path.join(dir, 'run.json'), 'utf8')).run ?? path.basename(dir)); } catch { return path.basename(dir); } + let run: Record = {}; + try { run = JSON.parse(fs.readFileSync(path.join(dir, 'run.json'), 'utf8')); } catch {} + let rows: { run?: unknown }[] = []; + try { rows = fs.readFileSync(path.join(dir, 'decisions.jsonl'), 'utf8').split('\n').filter(l => l.trim()).map(l => JSON.parse(l)); } catch {} + return autoplanRunId(dir, run, rows); } /** Resolve a Plan line against the approval store; `changedOnly` lists the PR's changed paths for the changelog-only exemption. */ diff --git a/test/approval-record.test.ts b/test/approval-record.test.ts index 701d273b24f..1a8c54ffa1f 100644 --- a/test/approval-record.test.ts +++ b/test/approval-record.test.ts @@ -389,6 +389,73 @@ describe('import --autoplan', () => { expect(typed.status).not.toBe(0); }); + // Value: protects=an interactive /autoplan run (no run.json; its gate rows carry the run id) imports under that run id, + // so the id can be cited and two interactive runs never share one gate state; fails_when=the import falls back to the + // shared directory name "autoplan"; why_new=every answered-gate import case wrote run.json (#4402); seam=none + test('an interactive run without run.json imports under the run id its gate rows carry', () => { + const run = path.join(tmp('appr-run-'), 'autoplan'); + fs.mkdirSync(run); + const id = 'feature-x-20261122-104500'; + fs.writeFileSync(path.join(run, 'decisions.jsonl'), JSON.stringify({ schema_version: 1, run: id, id: `${id}-p1`, label: 'P1', title: 'Plan approval', + options: ['a', 'b'], recommended: 'a', kind: 'approval', status: 'approved', gate_rev: 1, chosen: 'a', answered_at: '2026-11-22T10:50:00.000Z', reply: 'a' }) + '\n'); + const rows = importAutoplan(run, 'b', 'owner'); + if ('code' in rows) throw new Error(rows.message); + expect(rows.map(r => r.source)).toEqual([`autoplan:${id}@gate_rev=1`]); + expect(rows[0]!.ask).toContain(`autoplan run ${id}`); + }); + + // Value: protects=a second interactive run appended to the same autoplan directory imports under its own run id with only + // its own answers; fails_when=mixed run ids fall back to the directory name and pool both runs' answers; why_new=the + // interactive case held a single run; seam=none + test('a second interactive run appended to the same directory imports under its own run id', () => { + const run = path.join(tmp('appr-run-'), 'autoplan'); + fs.mkdirSync(run); + const row = (id: string, at: string) => JSON.stringify({ schema_version: 1, run: id, id: `${id}-p1`, label: 'P1', title: 'Plan approval', + options: ['a', 'b'], recommended: 'a', kind: 'approval', status: 'approved', gate_rev: 1, chosen: 'a', answered_at: at, reply: 'a' }) + '\n'; + const a = 'feature-x-20261122-104500', b = 'feature-y-20261122-114500'; + fs.writeFileSync(path.join(run, 'decisions.jsonl'), row(a, '2026-11-22T10:50:00.000Z')); + const first = importAutoplan(run, 'b', 'owner'); + if ('code' in first) throw new Error(first.message); + expect(first.map(r => r.source)).toEqual([`autoplan:${a}@gate_rev=1`]); + fs.appendFileSync(path.join(run, 'decisions.jsonl'), row(b, '2026-11-22T11:50:00.000Z')); + const second = importAutoplan(run, 'b', 'owner'); + if ('code' in second) throw new Error(second.message); + expect(second.map(r => r.source)).toEqual([`autoplan:${b}@gate_rev=1`]); + }); + + // Value: protects=an abandoned older interactive run's pending rows do not mark a newer approved run as unanswered; + // fails_when=stillPending counts pending rows from every run in the directory; why_new=the newest-run selection + // left the pending count pooled; seam=none + test('an abandoned older run leaves no unanswered decisions on the newer approved run', () => { + const run = path.join(tmp('appr-run-'), 'autoplan'); + fs.mkdirSync(run); + const a = 'feature-x-20261122-104500', b = 'feature-y-20261122-114500'; + fs.writeFileSync(path.join(run, 'decisions.jsonl'), JSON.stringify({ schema_version: 1, run: a, id: `${a}-d1`, label: 'D1', title: 'Abandoned decision', status: 'pending', gate_rev: 1 }) + '\n' + + JSON.stringify({ schema_version: 1, run: b, id: `${b}-p1`, label: 'P1', title: 'Plan approval', options: ['a', 'b'], recommended: 'a', kind: 'approval', + status: 'approved', gate_rev: 1, chosen: 'a', answered_at: '2026-11-22T11:50:00.000Z', reply: 'a' }) + '\n'); + const rows = importAutoplan(run, 'b', 'owner'); + if ('code' in rows) throw new Error(rows.message); + expect(rows.map(r => [r.source, r.outcome, r.pending])).toEqual([[`autoplan:${b}@gate_rev=1`, 'approved', 'none']]); + }); + + // Value: protects=the run id interactive /autoplan mints (autoplan/SKILL.md.tmpl's RUN_ID line) imports on a branch whose name ends in + // digits; fails_when=the id puts those digits straight before the date stamp, which pii.phone.e164 and pii.cc read as a phone or card + // number, so the import is refused (#4402); why_new=the interactive cases above use branch names without digits; seam=none + test('the run id interactive /autoplan mints on a numbered branch imports', () => { + const tmpl = fs.readFileSync(path.join(ROOT, 'autoplan', 'SKILL.md.tmpl'), 'utf8'); + const stamp = /^DATETIME=\$\(date \+([^)]+)\)$/m.exec(tmpl)![1]!.replace(/%([YmdHMS])/g, (_, c: string) => ({ Y: '2026', m: '11', d: '22', H: '09', M: '33', S: '21' } as Record)[c]!); + const minted = (/^_RID=([^;\s]+);/m.exec(tmpl) ?? /^echo "RUN_ID=([^"]+)"/m.exec(tmpl))![1]!.replace(/\$\{?BRANCH\}?/, '').replace(/\$\{?DATETIME\}?/, stamp); + const run = path.join(tmp('appr-run-'), 'autoplan'); + fs.mkdirSync(run); + for (const branch of ['fix-4402', 'gsta-802', '4402']) { + const id = minted.replace('', branch); + fs.writeFileSync(path.join(run, 'decisions.jsonl'), JSON.stringify({ schema_version: 1, run: id, id: `${id}-p1`, label: 'P1', title: 'Plan approval', + options: ['a', 'b'], recommended: 'a', kind: 'approval', status: 'approved', gate_rev: 1, chosen: 'a', answered_at: '2026-11-22T10:50:00.000Z', reply: 'a' }) + '\n'); + const rows = importAutoplan(run, 'b', 'owner'); + expect([branch, 'code' in rows ? rows.message : rows.map(r => r.source)]).toEqual([branch, [`autoplan:${id}@gate_rev=1`]]); + } + }); + test('an unanswered gate imports nothing and says why', () => { const run = tmp('appr-run-'); fs.writeFileSync(path.join(run, 'decisions.jsonl'), JSON.stringify({ schema_version: 1, run: 'run-1', id: 'run-1-p1', label: 'P1', status: 'pending', gate_rev: 1 }) + '\n'); diff --git a/test/gstack-post.test.ts b/test/gstack-post.test.ts index 43c138a2d25..c203e99a6b9 100644 --- a/test/gstack-post.test.ts +++ b/test/gstack-post.test.ts @@ -413,6 +413,52 @@ describe("gstack-post owns the redaction scan", () => { } }); + // Value: protects=a gstack-receipt-runs block's session ids (/ship's earlier runs) post through pr-comment and pr-body without a pii.phone.e164 + // confirmation (gstack#4725), while a phone number in another field of the same line, a phone number, a truncated id or a session id under + // another key, a non-canonical line, a line whose head is missing or not a 40-hex sha, an unclosed block and the same id in prose still need + // one; fails_when=every /ship that rewrites a PR body holding earlier runs gets a false MEDIUM hold, or the exemption reaches past the exact + // run value of a canonical runs line; why_new=the #4480 test covers only the gstack-ship-receipt block; seam=fake gh; no_claim=real gh + test("a runs block's session ids are not phone numbers; a phone number anywhere else in or around the block still is", () => { + const HEAD_A = "abc123abc123abc123abc123abc123abc123abcd"; + const HEAD_B = "def456def456def456def456def456def456def0"; + const RUN_A = "4242424-1700000000-deadbeef"; + const RUN_B = "3454314-1795338725-c32255b8"; + const post = (args: string[], text: string, visibility: "public" | "private" = "private") => { + const f = fakeEnv({ files: { "/b": text }, visibility }); + return { code: run([...args, "--body-file", "/b"], f), phones: f.stdout().split("\n").filter(l => l.startsWith("RULE: pii.phone.e164 ")), f }; + }; + const runsBlock = (...lines: string[]) => `Body.\n\n\`\`\`gstack-receipt-runs\n${lines.join("\n")}\n\`\`\`\n`; + + const comment = post(["pr-comment", "1"], runsBlock(JSON.stringify({ head: HEAD_A, version: "1.0.0.0", run: RUN_A }), JSON.stringify({ run: RUN_B, head: HEAD_B, mark: "stop" }))); + expect([comment.phones, comment.code, comment.f.posts().length]).toEqual([[], EXIT.posted, 1]); + + const first = placeReceipt("## What changed\n\nFirst run.\n", orderReceipt({ schema_version: 1, pr: 4725, head: HEAD_A, base: "main", version: "1.0.0.0", run: RUN_A })); + const second = placeReceipt(first, orderReceipt({ schema_version: 1, pr: 4725, head: HEAD_B, base: "main", version: "1.0.0.0", run: RUN_B })); + expect(second).toContain("```gstack-receipt-runs\n"); + const body = post(["pr-body", "4725", "--replace"], second, "public"); + expect([body.phones, body.code, body.f.posts().length]).toEqual([[], EXIT.posted, 1]); + + const holds: Array<[string, string, string]> = [ + ["a phone number in reason on a line with a valid run", runsBlock(JSON.stringify({ head: HEAD_A, run: RUN_A, mark: "abandoned", by: "ops", reason: "call +14155552671" })), "call +14155552671"], + ["a phone number as the run", runsBlock(JSON.stringify({ head: HEAD_A, run: "+14155552671" })), '"+14155552671"'], + ["a truncated session id", runsBlock(JSON.stringify({ head: HEAD_A, run: "4242424-1700000000" })), '"4242424-1700000000"'], + ["a session id under another key", runsBlock(JSON.stringify({ head: HEAD_A, run: "ship-1", grant: RUN_A })), RUN_A], + ["a session id nested under review_loop", runsBlock(JSON.stringify({ head: HEAD_A, review_loop: { run: RUN_A } })), RUN_A], + ["a non-canonical spaced line", runsBlock(`{ "head": "${HEAD_A}", "run": "${RUN_A}" }`), RUN_A], + ["a duplicated run key", runsBlock(`{"head":"${HEAD_A}","run":"${RUN_A}","run":"${RUN_B}"}`), RUN_A], + ["a line missing head", runsBlock(JSON.stringify({ version: "1.0.0.0", run: RUN_A })), RUN_A], + ["a head that is not a 40-hex sha", runsBlock(JSON.stringify({ head: "main", run: RUN_A })), RUN_A], + ["an unclosed runs block", `Body.\n\n\`\`\`gstack-receipt-runs\n${JSON.stringify({ head: HEAD_A, run: RUN_A })}\n`, RUN_A], + ["a session id in prose after the block", runsBlock(JSON.stringify({ head: HEAD_A, run: RUN_B })) + `\nRun ${RUN_A} failed.\n`, `Run ${RUN_A}`], + ["a session id in a json block", `Body.\n\n\`\`\`json\n${JSON.stringify({ head: HEAD_A, run: RUN_A })}\n\`\`\`\n`, RUN_A], + ]; + for (const [name, text, needle] of holds) { + const { code, phones, f } = post(["pr-comment", "1"], text); + const line = text.split("\n").findIndex(l => l.includes(needle)) + 1; + expect([name, [...new Set(phones)], code, f.posts()]).toEqual([name, [`RULE: pii.phone.e164 LINE: ${line} PART: body`], EXIT.confirm, []]); + } + }); + // 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 diff --git a/test/plan-record.test.ts b/test/plan-record.test.ts index 84e300b6359..ccb6c11d335 100644 --- a/test/plan-record.test.ts +++ b/test/plan-record.test.ts @@ -41,6 +41,21 @@ function fixture(files: Record & { ask: strin return { cwd, env, ids }; } +describe('an interactive /autoplan run cited by its directory (#4402)', () => { + // Value: protects=a Plan line naming an interactive run's directory (no run.json) resolves through the run id its gate + // rows carry, the id the import now records; fails_when=the path token still resolves to the shared directory name + // "autoplan" and finds no row; why_new=path tokens were only resolved through run.json or the directory name; seam=none + test('a path token resolves through the run its decision rows carry', () => { + const id = 'feature-x-20261122-104500'; + const f = fixture({ b: [{ ask: `Approve the plan (autoplan run ${id}, 1 decisions)`, source: `autoplan:${id}@gate_rev=1` }] }); + const run = path.join(f.cwd, '.gstack', 'tmp', 'autoplan'); + fs.mkdirSync(run, { recursive: true }); + fs.writeFileSync(path.join(run, 'decisions.jsonl'), JSON.stringify({ run: id, id: `${id}-p1`, status: 'approved', gate_rev: 1 }) + '\n'); + const r = resolvePlan(parsePlanLine('Plan: approved: .gstack/tmp/autoplan'), { cwd: f.cwd, env: f.env }); + expect(r.ok ? 'resolved' : r.failure.message).toBe('resolved'); + }); +}); + describe('parsePlanLine', () => { test('reads approved, exempt and required, tolerating spacing and bold, and ignores fenced text', () => { expect(parsePlanLine('x\nPlan: approved: ap-20261107055041\n')).toEqual({ kind: 'approved', line: 'Plan: approved: ap-20261107055041', token: 'ap-20261107055041' }); From df45daf46df3bb43631a47d717de2264362c6e28 Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 23 Nov 2026 16:24:48 +0000 Subject: [PATCH 2/9] Keep the interactive /autoplan run id line within the skill's size pin Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- autoplan/SKILL.md | 2 +- autoplan/SKILL.md.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autoplan/SKILL.md b/autoplan/SKILL.md index def10ad48dd..f6115b237dc 100644 --- a/autoplan/SKILL.md +++ b/autoplan/SKILL.md @@ -428,7 +428,7 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-') DATETIME=$(date +%Y%m%d-%H%M%S) echo "SLUG=$SLUG" echo "RESTORE_PATH=$_AP/${BRANCH}-autoplan-restore-${DATETIME}.md" -_RID=$BRANCH-autoplan-$DATETIME; echo "RUN_ID=$_RID"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run "$_RID" --out "$_AP" +_RID=$BRANCH-autoplan-$DATETIME; echo "RUN_ID=$_RID"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run $_RID --out "$_AP" ``` Before scope/review: diff --git a/autoplan/SKILL.md.tmpl b/autoplan/SKILL.md.tmpl index 212e0145f58..9edc56c75a3 100644 --- a/autoplan/SKILL.md.tmpl +++ b/autoplan/SKILL.md.tmpl @@ -202,7 +202,7 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-') DATETIME=$(date +%Y%m%d-%H%M%S) echo "SLUG=$SLUG" echo "RESTORE_PATH=$_AP/${BRANCH}-autoplan-restore-${DATETIME}.md" -_RID=$BRANCH-autoplan-$DATETIME; echo "RUN_ID=$_RID"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run "$_RID" --out "$_AP" +_RID=$BRANCH-autoplan-$DATETIME; echo "RUN_ID=$_RID"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run $_RID --out "$_AP" ``` Before scope/review: From df616e8b07bb3f7b5a0241a266501d4290af9029 Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 23 Nov 2026 16:26:21 +0000 Subject: [PATCH 3/9] Keep the autoplan skill at its exact size pin Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- autoplan/SKILL.md | 2 +- autoplan/SKILL.md.tmpl | 2 +- test/approval-record.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autoplan/SKILL.md b/autoplan/SKILL.md index f6115b237dc..be18e58eb56 100644 --- a/autoplan/SKILL.md +++ b/autoplan/SKILL.md @@ -428,7 +428,7 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-') DATETIME=$(date +%Y%m%d-%H%M%S) echo "SLUG=$SLUG" echo "RESTORE_PATH=$_AP/${BRANCH}-autoplan-restore-${DATETIME}.md" -_RID=$BRANCH-autoplan-$DATETIME; echo "RUN_ID=$_RID"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run $_RID --out "$_AP" +_ID=${BRANCH}-autoplan-$DATETIME; echo "RUN_ID=$_ID"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run "$_ID" --out "$_AP" ``` Before scope/review: diff --git a/autoplan/SKILL.md.tmpl b/autoplan/SKILL.md.tmpl index 9edc56c75a3..5379bd499a6 100644 --- a/autoplan/SKILL.md.tmpl +++ b/autoplan/SKILL.md.tmpl @@ -202,7 +202,7 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-') DATETIME=$(date +%Y%m%d-%H%M%S) echo "SLUG=$SLUG" echo "RESTORE_PATH=$_AP/${BRANCH}-autoplan-restore-${DATETIME}.md" -_RID=$BRANCH-autoplan-$DATETIME; echo "RUN_ID=$_RID"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run $_RID --out "$_AP" +_ID=${BRANCH}-autoplan-$DATETIME; echo "RUN_ID=$_ID"; ~/.claude/skills/gstack/bin/gstack-autoplan-timing estimate --run "$_ID" --out "$_AP" ``` Before scope/review: diff --git a/test/approval-record.test.ts b/test/approval-record.test.ts index 1a8c54ffa1f..7d3c95fbbbe 100644 --- a/test/approval-record.test.ts +++ b/test/approval-record.test.ts @@ -444,7 +444,7 @@ describe('import --autoplan', () => { test('the run id interactive /autoplan mints on a numbered branch imports', () => { const tmpl = fs.readFileSync(path.join(ROOT, 'autoplan', 'SKILL.md.tmpl'), 'utf8'); const stamp = /^DATETIME=\$\(date \+([^)]+)\)$/m.exec(tmpl)![1]!.replace(/%([YmdHMS])/g, (_, c: string) => ({ Y: '2026', m: '11', d: '22', H: '09', M: '33', S: '21' } as Record)[c]!); - const minted = (/^_RID=([^;\s]+);/m.exec(tmpl) ?? /^echo "RUN_ID=([^"]+)"/m.exec(tmpl))![1]!.replace(/\$\{?BRANCH\}?/, '').replace(/\$\{?DATETIME\}?/, stamp); + const minted = (/^_ID=([^;\s]+);/m.exec(tmpl) ?? /^echo "RUN_ID=([^"]+)"/m.exec(tmpl))![1]!.replace(/\$\{?BRANCH\}?/, '').replace(/\$\{?DATETIME\}?/, stamp); const run = path.join(tmp('appr-run-'), 'autoplan'); fs.mkdirSync(run); for (const branch of ['fix-4402', 'gsta-802', '4402']) { From f4503b8ee321f670508971dfbb6713600f86fbea Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 23 Nov 2026 16:42:21 +0000 Subject: [PATCH 4/9] Tighten the run id exemptions after review The run history exemption now applies only to a block that opens outside any other code fence, and a line that cannot be re-serialized is skipped instead of stopping the post. A Plan line naming a shared interactive /autoplan folder that holds several runs no longer resolves to the newest one. Run ids that interactive /autoplan minted before this change still import on branch names ending in digits. Review-Finding: p1/outside-voice#1 reader=outside-voice Review-Finding: p1/outside-voice#2 reader=outside-voice Review-Finding: p1/outside-voice#3 reader=outside-voice Review-Finding: p1/outside-voice#4 reader=outside-voice Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- changelog.d/privacy-check-skips-run-ids.md | 2 +- lib/approval-record.ts | 11 +++++--- lib/gstack-post.ts | 17 +++++------- lib/plan-record.ts | 1 + test/approval-record.test.ts | 30 ++++++++++++++++++++++ test/gstack-post.test.ts | 1 + test/plan-record.test.ts | 15 +++++++++++ 7 files changed, 62 insertions(+), 15 deletions(-) diff --git a/changelog.d/privacy-check-skips-run-ids.md b/changelog.d/privacy-check-skips-run-ids.md index cdd6567ce05..b3f96ca0376 100644 --- a/changelog.d/privacy-check-skips-run-ids.md +++ b/changelog.d/privacy-check-skips-run-ids.md @@ -3,4 +3,4 @@ important: blocker --- **Posting a PR body that lists earlier /ship runs no longer stops for a phone number that isn't there.** `gstack-post` read the run id on each line of the `gstack-receipt-runs` block (`4242424-1700000000-deadbeef`) as a phone number, so every /ship that rewrote a PR body with earlier runs waited for a confirmation. The run id on a well-formed line of that block is now skipped; a phone number anywhere else, including elsewhere on the same line, is still caught. Reported by @dgrant (#4725), fix idea from @thomsjack (#4729). -**`gstack-approvals import --autoplan` records an interactive /autoplan run under its own run id.** Without a `run.json`, every interactive run was imported as `autoplan`, so the run id could not be cited and separate runs shared one gate state. A `Plan: approved:` line naming the run's folder resolves the same way. New interactive run ids put `autoplan` between the branch name and the time stamp, so a branch name ending in digits no longer turns the id into something the privacy check reads as a phone or card number. Reported by @exGeni (#4402). +**`gstack-approvals import --autoplan` records an interactive /autoplan run under its own run id.** Without a `run.json`, every interactive run was imported as `autoplan`, so the run id could not be cited and separate runs shared one gate state. A `Plan: approved:` line naming the run's folder resolves the same way while the folder holds one run; once it holds several, cite the run id instead. Approvals imported before this change under `autoplan` need importing again. New interactive run ids put `autoplan` between the branch name and the time stamp, so a branch name ending in digits no longer turns the id into something the privacy check reads as a phone or card number. Reported by @exGeni (#4402). diff --git a/lib/approval-record.ts b/lib/approval-record.ts index b18dd874581..9e03e38ac0d 100644 --- a/lib/approval-record.ts +++ b/lib/approval-record.ts @@ -186,10 +186,13 @@ function validDate(d: string): boolean { export interface NewRow { ask: string; words: string; by: string; scope: string; pending?: string; outcome?: string; date?: string; source?: string } -/** An autoplan run id as gstack-autoplan mints it: the run directory's name, a hyphen, six random letters (since GST-3015), a hyphen, then a 14-digit time stamp. */ -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 = /(?:(? RECEIPT_LINE_IDS.fla * span of each value below. In every closed ```gstack-ship-receipt``` block whose JSON passes the receipt schema and is byte-identical to * renderReceiptBlock's rendering of it: each ci_carried[].run, flaky_exception[].runs[] and issues.flakes[].run value that is a run id (11 to 20 * digits, with an optional /attempt), the run value when it is a gstack-skill-start session id, and the RECEIPT_LINE_IDS values inside the - * pregate and requires_remote[] values. In every closed ```gstack-receipt-runs``` block (gstack#4725), the top-level run value of each line that is a + * pregate and requires_remote[] values. In every closed ```gstack-receipt-runs``` block that opens outside any other fence (gstack#4725), the top-level run value of each line that is a * JSON object byte-identical to its JSON.stringify rendering, with a 40-hex head and a run that is a gstack-skill-start session id. On every line * outside a fenced code block that opens with a receipt-line prefix (RECEIPT_LINE), its RECEIPT_LINE_IDS values. Only * those writers' own output qualifies, so a hand-written, schema-invalid, malformed or unclosed block exempts nothing, and the same number in @@ -587,10 +587,11 @@ function receiptIdSpans(text: string): Span[] { const lines = text.split("\n"); const rows = (v: unknown): number => v !== null && typeof v === "object" && Object.keys(v).length ? 2 + Object.values(v).reduce((n: number, c) => n + rows(c), 0) : 1; let fence = ""; + const blocks: Array<{ open: number; close: number }> = []; const spans: Span[] = lines.flatMap((l, i) => { const f = /^ {0,3}(`{3,}|~{3,})(.*)$/.exec(l); - if (f && !fence) { fence = f[1]!; return []; } - if (f && f[1]![0] === fence[0] && f[1]!.length >= fence.length && !f[2]!.trim()) { fence = ""; return []; } + if (f && !fence) { fence = f[1]!; blocks.push({ open: i, close: -1 }); return []; } + if (f && f[1]![0] === fence[0] && f[1]!.length >= fence.length && !f[2]!.trim()) { fence = ""; blocks.at(-1)!.close = i; return []; } return !fence && RECEIPT_LINE.test(l) ? lineIdSpans(l, i + 1) : []; }); for (let open = 0; open < lines.length; open++) { @@ -628,20 +629,16 @@ function receiptIdSpans(text: string): Span[] { receipt.issues?.flakes?.forEach((_, i) => span(["issues", "flakes", i, "run"])); open = close; } - for (let open = 0; open < lines.length; open++) { - if (lines[open] !== "```" + RUNS_FENCE) continue; - const close = lines.indexOf("```", open + 1); - if (close < 0) break; + for (const { open, close } of blocks) { + if (close < 0 || lines[open] !== "```" + RUNS_FENCE) continue; for (let i = open + 1; i < close; i++) { let entry: Record; - try { entry = JSON.parse(lines[i]!); } catch { continue; } - if (entry === null || typeof entry !== "object" || Array.isArray(entry) || JSON.stringify(entry) !== lines[i]) continue; + try { entry = JSON.parse(lines[i]!); if (entry === null || typeof entry !== "object" || Array.isArray(entry) || JSON.stringify(entry) !== lines[i]) continue; } catch { continue; } if (typeof entry.head !== "string" || !/^[0-9a-f]{40}$/.test(entry.head) || typeof entry.run !== "string" || !SESSION_ID.test(entry.run)) continue; const before = Object.keys(entry).slice(0, Object.keys(entry).indexOf("run")); const from = JSON.stringify(Object.fromEntries(before.map(k => [k, entry[k]]))).length + (before.length ? 1 : 0) + '"run":'.length; spans.push({ line: i + 1, from, to: from + JSON.stringify(entry.run).length - 1 }); } - open = close; } return spans; } diff --git a/lib/plan-record.ts b/lib/plan-record.ts index 06aa8412587..9e54df80981 100644 --- a/lib/plan-record.ts +++ b/lib/plan-record.ts @@ -151,6 +151,7 @@ function runIdFor(token: string, cwd: string): string { try { run = JSON.parse(fs.readFileSync(path.join(dir, 'run.json'), 'utf8')); } catch {} let rows: { run?: unknown }[] = []; try { rows = fs.readFileSync(path.join(dir, 'decisions.jsonl'), 'utf8').split('\n').filter(l => l.trim()).map(l => JSON.parse(l)); } catch {} + if (!(run.run ?? run.id) && new Set(rows.map(r => r.run).filter(r => typeof r === 'string' && r)).size > 1) return path.basename(dir); return autoplanRunId(dir, run, rows); } diff --git a/test/approval-record.test.ts b/test/approval-record.test.ts index 7d3c95fbbbe..b13fe0705b7 100644 --- a/test/approval-record.test.ts +++ b/test/approval-record.test.ts @@ -389,6 +389,36 @@ describe('import --autoplan', () => { expect(typed.status).not.toBe(0); }); + // Value: protects=a run id interactive /autoplan minted before #4402 (-) imports on a branch whose name ends in + // digits, as the 14-digit minted shape does (GST-2047), while a phone number in the same row, a run id of another shape, a phone number + // in the name half of the id, or the same id typed into add --ask still refuses; fails_when=an approval answered before the upgrade cannot + // be imported after it, or the exemption reaches past the stamp; why_new=the GST-2047 test covers only the 14-digit stamp; seam=none + test('an interactive run id minted before #4402 imports on a numbered branch; a phone number elsewhere still refuses', () => { + const importWith = (o: { runId: string; words?: string }) => { + const run = tmp('appr-run-'); + autoplanRun(run, [{ by: 'agent:GSTA-36', words: o.words ?? 'do it', at: '2026-11-22T09:40:00.000Z', p1: 'a' }]); + fs.writeFileSync(path.join(run, 'run.json'), JSON.stringify({ run: o.runId, status: 'complete' })); + return importAutoplan(run, 'b', 'Garry'); + }; + for (const runId of ['fix-4402-20261122-093321', 'gsta-802-20261122-093321', 'fix-12-20261122-093321']) { + const rows = importWith({ runId }); + expect([runId, 'code' in rows ? rows.message : rows[0]!.source]).toEqual([runId, `autoplan:${runId}@gate_rev=1`]); + } + const refused: Array<[{ runId: string; words?: string }, string]> = [ + [{ runId: 'fix-4402-20261122-093321', words: 'do it, call 14155552671 if it breaks' }, 'words'], + [{ runId: 'fix-4402-20261122-0933' }, 'ask'], + [{ runId: 'call-415-555-2671-20261122-093321' }, 'ask'], + [{ runId: '14155552671-20261122-093321' }, 'source'], + ]; + for (const [o, field] of refused) { + const r = importWith(o); + expect([o, 'code' in r && r.code, 'code' in r && r.message.startsWith(`field ${field}: `) && r.message.includes('pii.phone.e164')]).toEqual([o, 'APPROVAL_RECORD_SECRET', true]); + } + const typed = bin(['add', '--ask', 'Approve the plan (autoplan run fix-4402-20261122-093321, 2 decisions)', '--words', 'do it', '--by', 'Garry', '--scope', 'the plan'], { cwd: repo(), env: { GSTACK_STATE_ROOT: tmp('appr-state-') } }); + expect(typed.status).not.toBe(0); + expect(typed.out + typed.err).toContain('field ask: pii'); + }); + // Value: protects=an interactive /autoplan run (no run.json; its gate rows carry the run id) imports under that run id, // so the id can be cited and two interactive runs never share one gate state; fails_when=the import falls back to the // shared directory name "autoplan"; why_new=every answered-gate import case wrote run.json (#4402); seam=none diff --git a/test/gstack-post.test.ts b/test/gstack-post.test.ts index c203e99a6b9..aee0d360dba 100644 --- a/test/gstack-post.test.ts +++ b/test/gstack-post.test.ts @@ -450,6 +450,7 @@ describe("gstack-post owns the redaction scan", () => { ["a head that is not a 40-hex sha", runsBlock(JSON.stringify({ head: "main", run: RUN_A })), RUN_A], ["an unclosed runs block", `Body.\n\n\`\`\`gstack-receipt-runs\n${JSON.stringify({ head: HEAD_A, run: RUN_A })}\n`, RUN_A], ["a session id in prose after the block", runsBlock(JSON.stringify({ head: HEAD_A, run: RUN_B })) + `\nRun ${RUN_A} failed.\n`, `Run ${RUN_A}`], + ["a runs block inside another fence", `Body.\n\n\`\`\`\`markdown\n\`\`\`gstack-receipt-runs\n${JSON.stringify({ head: HEAD_A, run: RUN_A })}\n\`\`\`\n\`\`\`\`\n`, RUN_A], ["a session id in a json block", `Body.\n\n\`\`\`json\n${JSON.stringify({ head: HEAD_A, run: RUN_A })}\n\`\`\`\n`, RUN_A], ]; for (const [name, text, needle] of holds) { diff --git a/test/plan-record.test.ts b/test/plan-record.test.ts index ccb6c11d335..d1ba801138f 100644 --- a/test/plan-record.test.ts +++ b/test/plan-record.test.ts @@ -54,6 +54,21 @@ describe('an interactive /autoplan run cited by its directory (#4402)', () => { const r = resolvePlan(parsePlanLine('Plan: approved: .gstack/tmp/autoplan'), { cwd: f.cwd, env: f.env }); expect(r.ok ? 'resolved' : r.failure.message).toBe('resolved'); }); + + // Value: protects=a Plan line naming a shared interactive folder that holds more than one run resolves to no run, so a later /autoplan in + // the same checkout never turns an unchanged PR body's citation into another plan's approval, while the run id still resolves; + // fails_when=the folder token follows whichever run was written last; why_new=the case above holds a single run; seam=none + test('a path token whose folder holds several runs resolves to none of them; the run id still does', () => { + const a = 'feature-x-autoplan-20261122-104500', b = 'feature-y-autoplan-20261122-114500'; + const f = fixture({ b: [{ ask: `Approve the plan (autoplan run ${a}, 1 decisions)`, source: `autoplan:${a}@gate_rev=1` }, { ask: `Approve the plan (autoplan run ${b}, 1 decisions)`, source: `autoplan:${b}@gate_rev=1` }] }); + const run = path.join(f.cwd, '.gstack', 'tmp', 'autoplan'); + fs.mkdirSync(run, { recursive: true }); + fs.writeFileSync(path.join(run, 'decisions.jsonl'), [a, b].map(id => JSON.stringify({ run: id, id: `${id}-p1`, status: 'approved', gate_rev: 1 })).join('\n') + '\n'); + const byFolder = resolvePlan(parsePlanLine('Plan: approved: .gstack/tmp/autoplan'), { cwd: f.cwd, env: f.env }); + expect(byFolder.ok ? 'resolved' : byFolder.failure.code).toBe('PLAN_UNRESOLVED'); + const byId = resolvePlan(parsePlanLine(`Plan: approved: ${a}`), { cwd: f.cwd, env: f.env }); + expect(byId.ok ? 'resolved' : byId.failure.message).toBe('resolved'); + }); }); describe('parsePlanLine', () => { From c2eb4bb12d38248144c94116eb1b280a7ed4159b Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 23 Nov 2026 16:47:44 +0000 Subject: [PATCH 5/9] fix: pre-landing review fixes A Plan line naming a shared interactive /autoplan folder that holds several runs now resolves to no run at all, so approvals imported before this change under the shared id autoplan cannot stand in for it. Review-Finding: p2/red-team#1 reader=red-team Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- lib/plan-record.ts | 4 ++-- test/plan-record.test.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/plan-record.ts b/lib/plan-record.ts index 9e54df80981..e5837e7c76a 100644 --- a/lib/plan-record.ts +++ b/lib/plan-record.ts @@ -150,8 +150,8 @@ function runIdFor(token: string, cwd: string): string { let run: Record = {}; try { run = JSON.parse(fs.readFileSync(path.join(dir, 'run.json'), 'utf8')); } catch {} let rows: { run?: unknown }[] = []; - try { rows = fs.readFileSync(path.join(dir, 'decisions.jsonl'), 'utf8').split('\n').filter(l => l.trim()).map(l => JSON.parse(l)); } catch {} - if (!(run.run ?? run.id) && new Set(rows.map(r => r.run).filter(r => typeof r === 'string' && r)).size > 1) return path.basename(dir); + try { rows = fs.readFileSync(path.join(dir, 'decisions.jsonl'), 'utf8').split('\n').filter(l => l.trim()).map(l => JSON.parse(l)).filter(r => r && typeof r === 'object'); } catch {} + if (!(run.run ?? run.id) && new Set(rows.map(r => r.run).filter(r => typeof r === 'string' && r)).size > 1) return ''; return autoplanRunId(dir, run, rows); } diff --git a/test/plan-record.test.ts b/test/plan-record.test.ts index d1ba801138f..c289090a0ea 100644 --- a/test/plan-record.test.ts +++ b/test/plan-record.test.ts @@ -56,11 +56,13 @@ describe('an interactive /autoplan run cited by its directory (#4402)', () => { }); // Value: protects=a Plan line naming a shared interactive folder that holds more than one run resolves to no run, so a later /autoplan in - // the same checkout never turns an unchanged PR body's citation into another plan's approval, while the run id still resolves; + // the same checkout, or an approval imported before #4402 under the shared id "autoplan", never turns an unchanged PR body's citation into + // another plan's approval, while the run id still resolves; // fails_when=the folder token follows whichever run was written last; why_new=the case above holds a single run; seam=none test('a path token whose folder holds several runs resolves to none of them; the run id still does', () => { const a = 'feature-x-autoplan-20261122-104500', b = 'feature-y-autoplan-20261122-114500'; - const f = fixture({ b: [{ ask: `Approve the plan (autoplan run ${a}, 1 decisions)`, source: `autoplan:${a}@gate_rev=1` }, { ask: `Approve the plan (autoplan run ${b}, 1 decisions)`, source: `autoplan:${b}@gate_rev=1` }] }); + const f = fixture({ b: [{ ask: `Approve the plan (autoplan run ${a}, 1 decisions)`, source: `autoplan:${a}@gate_rev=1` }, { ask: `Approve the plan (autoplan run ${b}, 1 decisions)`, source: `autoplan:${b}@gate_rev=1` }], + old: [{ ask: 'Approve the plan (autoplan run autoplan, 1 decisions)', source: 'autoplan:autoplan@gate_rev=1' }] }); const run = path.join(f.cwd, '.gstack', 'tmp', 'autoplan'); fs.mkdirSync(run, { recursive: true }); fs.writeFileSync(path.join(run, 'decisions.jsonl'), [a, b].map(id => JSON.stringify({ run: id, id: `${id}-p1`, status: 'approved', gate_rev: 1 })).join('\n') + '\n'); From 253c73c5d9b0c5c8525c868c7d5d66dc9d5dc67b Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 23 Nov 2026 16:53:35 +0000 Subject: [PATCH 6/9] fix: pre-landing review fixes An interactive run id minted before #4402 is exempt only when its stamp is a real calendar time, and a Plan line naming an interactive /autoplan folder whose decision log cannot be read resolves to no run. Review-Finding: p2/outside-voice#1 reader=outside-voice Review-Finding: p2/outside-voice#2 reader=outside-voice Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- lib/approval-record.ts | 5 +++-- lib/plan-record.ts | 12 +++++++----- test/approval-record.test.ts | 2 ++ test/plan-record.test.ts | 3 +++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/approval-record.ts b/lib/approval-record.ts index 9e03e38ac0d..ccda80af47e 100644 --- a/lib/approval-record.ts +++ b/lib/approval-record.ts @@ -188,9 +188,10 @@ export interface NewRow { ask: string; words: string; by: string; scope: string; /** * An autoplan run id as gstack-autoplan mints it: the run directory's name, a hyphen, six random letters (since GST-3015), a hyphen, then a - * 14-digit time stamp; or as interactive /autoplan minted it before #4402: the branch name, a hyphen, then a YYYYMMDD-HHMMSS stamp. + * 14-digit time stamp; or as interactive /autoplan minted it before #4402: the branch name, a hyphen, then a YYYYMMDD-HHMMSS stamp that is + * a real calendar time. */ -const MINTED_RUN_ID = /^[A-Za-z0-9._-]{1,64}-(?:\d{14}|\d{8}-\d{6})$/; +const MINTED_RUN_ID = /^[A-Za-z0-9._-]{1,64}-(?:\d{14}|\d{4}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])-(?:[01]\d|2[0-3])[0-5]\d[0-5]\d)$/; /** The part of a minted run id the exemption covers: the stamp and, when the name ends in a thread code or issue number, its digits. */ const RUN_ID_STAMP = /(?:(? = {}; try { run = JSON.parse(fs.readFileSync(path.join(dir, 'run.json'), 'utf8')); } catch {} - let rows: { run?: unknown }[] = []; - try { rows = fs.readFileSync(path.join(dir, 'decisions.jsonl'), 'utf8').split('\n').filter(l => l.trim()).map(l => JSON.parse(l)).filter(r => r && typeof r === 'object'); } catch {} - if (!(run.run ?? run.id) && new Set(rows.map(r => r.run).filter(r => typeof r === 'string' && r)).size > 1) return ''; - return autoplanRunId(dir, run, rows); + if (run.run ?? run.id) return String(run.run ?? run.id); + const file = path.join(dir, 'decisions.jsonl'); + if (!fs.existsSync(file)) return path.basename(dir); + let runs: Set; + try { runs = new Set(fs.readFileSync(file, 'utf8').split('\n').filter(l => l.trim()).map(l => JSON.parse(l)?.run).filter((r): r is string => typeof r === 'string' && !!r)); } catch { return ''; } + return runs.size === 1 ? [...runs][0]! : runs.size ? '' : path.basename(dir); } /** Resolve a Plan line against the approval store; `changedOnly` lists the PR's changed paths for the changelog-only exemption. */ diff --git a/test/approval-record.test.ts b/test/approval-record.test.ts index b13fe0705b7..e733fc54f24 100644 --- a/test/approval-record.test.ts +++ b/test/approval-record.test.ts @@ -407,6 +407,8 @@ describe('import --autoplan', () => { const refused: Array<[{ runId: string; words?: string }, string]> = [ [{ runId: 'fix-4402-20261122-093321', words: 'do it, call 14155552671 if it breaks' }, 'words'], [{ runId: 'fix-4402-20261122-0933' }, 'ask'], + [{ runId: 'fix-4402-20261399-093321' }, 'ask'], + [{ runId: 'fix-4402-20261122-993321' }, 'ask'], [{ runId: 'call-415-555-2671-20261122-093321' }, 'ask'], [{ runId: '14155552671-20261122-093321' }, 'source'], ]; diff --git a/test/plan-record.test.ts b/test/plan-record.test.ts index c289090a0ea..4f744f13a40 100644 --- a/test/plan-record.test.ts +++ b/test/plan-record.test.ts @@ -70,6 +70,9 @@ describe('an interactive /autoplan run cited by its directory (#4402)', () => { expect(byFolder.ok ? 'resolved' : byFolder.failure.code).toBe('PLAN_UNRESOLVED'); const byId = resolvePlan(parsePlanLine(`Plan: approved: ${a}`), { cwd: f.cwd, env: f.env }); expect(byId.ok ? 'resolved' : byId.failure.message).toBe('resolved'); + fs.writeFileSync(path.join(run, 'decisions.jsonl'), JSON.stringify({ run: a, id: `${a}-p1`, status: 'approved', gate_rev: 1 }) + '\n{"run": "torn'); + const torn = resolvePlan(parsePlanLine('Plan: approved: .gstack/tmp/autoplan'), { cwd: f.cwd, env: f.env }); + expect(torn.ok ? 'resolved' : torn.failure.code).toBe('PLAN_UNRESOLVED'); }); }); From f29ff9788a54edf2d1b22067170bd76b0061b976 Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 23 Nov 2026 17:11:30 +0000 Subject: [PATCH 7/9] Describe the new run id exemptions in the troubleshooting guide The privacy check's troubleshooting entries now say which run ids it skips in the run history block and which older interactive /autoplan run ids import, and that a run id that also reads as a card number still asks. The changelog entry says the same. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- changelog.d/privacy-check-skips-run-ids.md | 2 +- docs/troubleshooting.md | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/changelog.d/privacy-check-skips-run-ids.md b/changelog.d/privacy-check-skips-run-ids.md index b3f96ca0376..c7352c2115f 100644 --- a/changelog.d/privacy-check-skips-run-ids.md +++ b/changelog.d/privacy-check-skips-run-ids.md @@ -1,6 +1,6 @@ --- important: blocker --- -**Posting a PR body that lists earlier /ship runs no longer stops for a phone number that isn't there.** `gstack-post` read the run id on each line of the `gstack-receipt-runs` block (`4242424-1700000000-deadbeef`) as a phone number, so every /ship that rewrote a PR body with earlier runs waited for a confirmation. The run id on a well-formed line of that block is now skipped; a phone number anywhere else, including elsewhere on the same line, is still caught. Reported by @dgrant (#4725), fix idea from @thomsjack (#4729). +**Posting a PR body that lists earlier /ship runs no longer stops for a phone number that isn't there.** `gstack-post` read the run id on each line of the `gstack-receipt-runs` block (`4242424-1700000000-deadbeef`) as a phone number, so every /ship that rewrote a PR body with earlier runs waited for a confirmation. The run id on a well-formed line of that block is now skipped for that check; a phone number anywhere else, including elsewhere on the same line, is still caught. About 1 in 10 run ids also reads as a card number and still asks; a follow-up fixes that. Reported by @dgrant (#4725), fix idea from @thomsjack (#4729). **`gstack-approvals import --autoplan` records an interactive /autoplan run under its own run id.** Without a `run.json`, every interactive run was imported as `autoplan`, so the run id could not be cited and separate runs shared one gate state. A `Plan: approved:` line naming the run's folder resolves the same way while the folder holds one run; once it holds several, cite the run id instead. Approvals imported before this change under `autoplan` need importing again. New interactive run ids put `autoplan` between the branch name and the time stamp, so a branch name ending in digits no longer turns the id into something the privacy check reads as a phone or card number. Reported by @exGeni (#4402). diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 6c21d88f2d1..a9d2b7f12bb 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -2304,10 +2304,12 @@ ruling after the run stops. uses). The line names the field and the detector rule, never the matched text. Exit 3. Nothing was written, locally or to the Drive mirror. `import --autoplan` skips a `pii.phone.e164` or `pii.cc` finding that starts inside the autoplan run id's -14-digit stamp, or the thread-code digits right before it, where import places +time stamp, or the thread-code digits right before it, where import places the id (the ask's `autoplan run ` and the source's `autoplan:@`), when the id has the minted shape `-<14 digits>` (GST-2047; since GST-3015 the -name ends in six random letters); a phone number in +name ends in six random letters) or the shape interactive /autoplan minted +before #4402, `-YYYYMMDD-HHMMSS` with a real calendar date and time; +a phone number in the rest of the directory name, the same id anywhere else, and every other finding in the row still refuse. Likewise a `pii.phone.e164` finding that starts inside the `stop=` run id of a @@ -2430,8 +2432,10 @@ under `## Approvals`. A PR whose only changes are changelog fragments needs no l **Meaning.** `Plan: approved: ` names no approval row on this machine. A run id must match a row source `autoplan:@gate_rev=` in any branch's file of the repository's -approval store (the state root plus every Drive mirror); a row id must exist and be a plan -approval, not a `ruled_note`, `review_loop_grant` or `test_lane_exception` row. A public +approval store (the state root plus every Drive mirror); a run folder path resolves to the +run id in its `run.json`, else, for an interactive /autoplan folder with no `run.json`, to the +one run its `decisions.jsonl` records (a folder holding several runs resolves to none, so cite +the run id instead); a row id must exist and be a plan approval, not a `ruled_note`, `review_loop_grant` or `test_lane_exception` row. A public repo's `Plan: approved (record r-)` must hash from a row id this machine can read; when it is the redacted Approvals block's own id (a hash of a whole record), the message says so. @@ -3333,6 +3337,15 @@ exact tokens it finds in these positions: `1234567-1794900000-0a1b2c3d`), and the 12-hex shas in the `pregate` value (`@ ( checks, current for )`) and the `requires_remote` values (`heads=`, `tree=`) (#4480); +- in a closed `gstack-receipt-runs` block (the earlier /ship runs listed + under the receipt) that opens outside any other fenced code block, the + top-level `run` value of a line whose JSON matches its `JSON.stringify` + rendering byte for byte, with a 40-hex `head` and a `run` shaped like that + session id (#4725). A phone number in another field of the same line, a + `run` of any other shape, a session id under another key, a spaced or + reordered line, and a block inside another fence or left open still + report. Only `pii.phone.e164` is skipped there: a session id that also + reads as a card number still asks; - on a line outside any fenced code block that opens with `SHIP_RECEIPT:`, `CI_CARRY:`, `PREGATE:` or `READY_RECEIPT:` (bare, after `- `, `* ` or `> `, or after a backtick), the From 3f5286ca26486a178d123517902b495d39ee14d5 Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 23 Nov 2026 17:44:28 +0000 Subject: [PATCH 8/9] Skip the card-number check on /ship run ids in PR bodies About 1 in 10 /ship session ids passes the card-number checksum, so a PR body listing earlier runs, or carrying the /ship result record, still asked for a confirmation after the phone-number fix (#4725). The run value of a well-formed earlier-runs line and of the writer-rendered record now skips pii.cc too, only when the whole digit run lies inside it. A card number in any other field, or written as the run, is still caught. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- changelog.d/run-ids-not-card-numbers.md | 4 +++ docs/troubleshooting.md | 7 +++-- lib/gstack-post.ts | 17 +++++++----- test/gstack-post.test.ts | 36 +++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 8 deletions(-) create mode 100644 changelog.d/run-ids-not-card-numbers.md diff --git a/changelog.d/run-ids-not-card-numbers.md b/changelog.d/run-ids-not-card-numbers.md new file mode 100644 index 00000000000..f8b12cdf8db --- /dev/null +++ b/changelog.d/run-ids-not-card-numbers.md @@ -0,0 +1,4 @@ +--- +important: blocker +--- +**Posting a PR body that lists earlier /ship runs no longer stops for a card number that isn't there.** About 1 in 10 /ship run ids (`99999-1795338725-12345678`) also passes the card-number checksum, so `gstack-post` still asked for a confirmation on those bodies after the phone-number fix. The run id of a well-formed line in the earlier-runs block, and of the ship receipt itself, is now skipped for the card-number check too, only when the whole card-shaped number lies inside that run id; a card number in any other field, or written as the run id, is still caught. Reported by @dgrant (#4725). diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index a9d2b7f12bb..c4633c35baa 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -3344,8 +3344,11 @@ exact tokens it finds in these positions: session id (#4725). A phone number in another field of the same line, a `run` of any other shape, a session id under another key, a spaced or reordered line, and a block inside another fence or left open still - report. Only `pii.phone.e164` is skipped there: a session id that also - reads as a card number still asks; + report. About 1 in 10 session ids also passes the card-number checksum, so + this `run` value and the receipt's session-id `run` above also skip + `pii.cc`, but only when the whole card-shaped digit run lies inside the + value; a card number in another field, or as a `run` of any other shape, + still asks; - on a line outside any fenced code block that opens with `SHIP_RECEIPT:`, `CI_CARRY:`, `PREGATE:` or `READY_RECEIPT:` (bare, after `- `, `* ` or `> `, or after a backtick), the diff --git a/lib/gstack-post.ts b/lib/gstack-post.ts index 990060d8bc2..af65131540e 100644 --- a/lib/gstack-post.ts +++ b/lib/gstack-post.ts @@ -569,7 +569,7 @@ const RECEIPT_LINE_IDS = [ /(?<=(? RECEIPT_LINE_IDS.flatMap(re => [...text.matchAll(re)].flatMap(m => m.indices!.slice(1).flatMap(ix => ix ? [{ line, from: ix[0] + 1, to: ix[1] }] : []))); /** @@ -582,6 +582,8 @@ const lineIdSpans = (text: string, line: number): Span[] => RECEIPT_LINE_IDS.fla * outside a fenced code block that opens with a receipt-line prefix (RECEIPT_LINE), its RECEIPT_LINE_IDS values. Only * those writers' own output qualifies, so a hand-written, schema-invalid, malformed or unclosed block exempts nothing, and the same number in * prose, in any other code block (a receipt-prefixed line inside one included), on a line without a receipt prefix or under any other key still reports. + * The two session-id spans (the receipt's run and each runs line's run) are marked card: a pii.cc finding is skipped only when its whole digit + * run lies inside one of them (gstack#4725); every other span clears pii.phone.e164 only. */ function receiptIdSpans(text: string): Span[] { const lines = text.split("\n"); @@ -612,16 +614,16 @@ function receiptIdSpans(text: string): Span[] { } return { line, v }; }; - const span = (path: Array, shape = /^\d{11,20}(?:\/\d{1,4})?$/) => { + const span = (path: Array, shape = /^\d{11,20}(?:\/\d{1,4})?$/, card?: true) => { const { line, v } = at(path); if (!shape.test(typeof v === "number" ? String(v) : typeof v === "string" ? v : "")) return; const t = lines[line]!; const key = path.at(-1); const from = t.length - t.trimStart().length + (typeof key === "string" ? JSON.stringify(key).length + 2 : 0) + 1; - spans.push({ line: line + 1, from, to: from + JSON.stringify(v).length - 1 }); + spans.push({ line: line + 1, from, to: from + JSON.stringify(v).length - 1, ...(card ? { card } : {}) }); }; const ids = (path: Array) => { const { line } = at(path); spans.push(...lineIdSpans(lines[line]!, line + 1)); }; - span(["run"], SESSION_ID); + span(["run"], SESSION_ID, true); if (typeof receipt.pregate === "string") ids(["pregate"]); receipt.requires_remote?.forEach((_, i) => ids(["requires_remote", i])); receipt.ci_carried?.forEach((_, i) => span(["ci_carried", i, "run"])); @@ -637,7 +639,7 @@ function receiptIdSpans(text: string): Span[] { if (typeof entry.head !== "string" || !/^[0-9a-f]{40}$/.test(entry.head) || typeof entry.run !== "string" || !SESSION_ID.test(entry.run)) continue; const before = Object.keys(entry).slice(0, Object.keys(entry).indexOf("run")); const from = JSON.stringify(Object.fromEntries(before.map(k => [k, entry[k]]))).length + (before.length ? 1 : 0) + '"run":'.length; - spans.push({ line: i + 1, from, to: from + JSON.stringify(entry.run).length - 1 }); + spans.push({ line: i + 1, from, to: from + JSON.stringify(entry.run).length - 1, card: true }); } } return spans; @@ -650,9 +652,12 @@ 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), ...approvalsGrantStopSpans(text)] : []; + const runIds: Span[] = result.findings.some(f => f.id === "pii.phone.e164" || f.id === "pii.cc") ? [...receiptIdSpans(text), ...approvalsGrantStopSpans(text)] : []; + const lines = text.split("\n"); + const cardEnd = (f: Finding) => { const re = /\b(?:\d[ -]?){13,19}\b/y; re.lastIndex = f.col - 1; return re.exec(lines[f.line - 1] ?? "") ? re.lastIndex : Infinity; }; 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; + if (finding.id === "pii.cc" && runIds.some(s => s.card && s.line === finding.line && s.from <= finding.col && cardEnd(finding) <= s.to)) continue; found.push({ part, finding }); } } diff --git a/test/gstack-post.test.ts b/test/gstack-post.test.ts index aee0d360dba..b35a3f7cfb7 100644 --- a/test/gstack-post.test.ts +++ b/test/gstack-post.test.ts @@ -460,6 +460,42 @@ describe("gstack-post owns the redaction scan", () => { } }); + // Value: protects=a /ship session id that also reads as a Luhn-valid card number (about 1 in 10) posts without a pii.cc confirmation when it is + // the run of a runs-block line or of the ship receipt (gstack#4725, gstack#4480), while a card number in another field of the same line, a card + // number as the run, and the same id in prose or in a json block still need one; fails_when=about one /ship body in ten still gets a false + // MEDIUM hold, or the card exemption reaches past the exact run value; why_new=the runs-block and #4480 tests cover pii.phone.e164 only; + // seam=fake gh; no_claim=real gh + test("a session id that reads as a card number is skipped only as the run of a runs line or the receipt", () => { + const HEAD_A = "abc123abc123abc123abc123abc123abc123abcd"; + const CARD_RUN = "4242405-1795338725-c32255b8"; + const DIGIT_RUN = "99999-1795338725-12345678"; + const post = (args: string[], text: string) => { + const f = fakeEnv({ files: { "/b": text }, visibility: "public" }); + return { code: run([...args, "--body-file", "/b"], f), cards: () => f.stdout().split("\n").filter(l => l.startsWith("RULE: pii.cc ")), f }; + }; + const runsBlock = (...lines: string[]) => `Body.\n\n\`\`\`gstack-receipt-runs\n${lines.join("\n")}\n\`\`\`\n`; + const receiptBody = (runId: string) => placeReceipt("## What changed\n\nOne fix.\n", orderReceipt({ schema_version: 1, pr: 4725, head: HEAD_A, base: "main", version: "1.0.0.0", run: runId })); + + for (const text of [runsBlock(JSON.stringify({ head: HEAD_A, run: CARD_RUN }), JSON.stringify({ head: HEAD_A, run: DIGIT_RUN, mark: "stop" })), receiptBody(CARD_RUN), receiptBody(DIGIT_RUN)]) { + const p = post(["pr-body", "4725", "--replace"], text); + expect([p.cards(), p.code, p.f.posts().length]).toEqual([[], EXIT.posted, 1]); + } + + const holds: Array<[string, string, string]> = [ + ["a card number in reason on a line with a valid run", runsBlock(JSON.stringify({ head: HEAD_A, run: CARD_RUN, mark: "abandoned", by: "ops", reason: "card 4111111111111111" })), "card 4111111111111111"], + ["a card number as a runs line's run", runsBlock(JSON.stringify({ head: HEAD_A, run: "4111111111111111" })), '"4111111111111111"'], + ["a spaced card number as a runs line's run", runsBlock(JSON.stringify({ head: HEAD_A, run: "4111 1111 1111 1111" })), '"4111 1111'], + ["a card number as the receipt's run", receiptBody("4111111111111111"), '"run": "4111111111111111"'], + ["the session id in prose after the block", runsBlock(JSON.stringify({ head: HEAD_A, run: DIGIT_RUN })) + `\nRun ${CARD_RUN} failed.\n`, `Run ${CARD_RUN}`], + ["the session id in a json block", `Body.\n\n\`\`\`json\n${JSON.stringify({ head: HEAD_A, run: CARD_RUN })}\n\`\`\`\n`, CARD_RUN], + ]; + for (const [name, text, needle] of holds) { + const p = post(["pr-comment", "1"], text); + const line = text.split("\n").findIndex(l => l.includes(needle)) + 1; + expect([name, [...new Set(p.cards())], p.code, p.f.posts()]).toEqual([name, [`RULE: pii.cc LINE: ${line} PART: body`], EXIT.confirm, []]); + } + }); + // 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 From 0cf864230aa0c3fe44ad5057160ddd0250dc51b6 Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 23 Nov 2026 19:11:33 +0000 Subject: [PATCH 9/9] Describe the run id shape instead of quoting a card-shaped example in the release note Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- changelog.d/run-ids-not-card-numbers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/run-ids-not-card-numbers.md b/changelog.d/run-ids-not-card-numbers.md index f8b12cdf8db..22d831e1f37 100644 --- a/changelog.d/run-ids-not-card-numbers.md +++ b/changelog.d/run-ids-not-card-numbers.md @@ -1,4 +1,4 @@ --- important: blocker --- -**Posting a PR body that lists earlier /ship runs no longer stops for a card number that isn't there.** About 1 in 10 /ship run ids (`99999-1795338725-12345678`) also passes the card-number checksum, so `gstack-post` still asked for a confirmation on those bodies after the phone-number fix. The run id of a well-formed line in the earlier-runs block, and of the ship receipt itself, is now skipped for the card-number check too, only when the whole card-shaped number lies inside that run id; a card number in any other field, or written as the run id, is still caught. Reported by @dgrant (#4725). +**Posting a PR body that lists earlier /ship runs no longer stops for a card number that isn't there.** About 1 in 10 /ship run ids (`--<8 hex>`) also passes the card-number checksum, so `gstack-post` still asked for a confirmation on those bodies after the phone-number fix. The run id of a well-formed line in the earlier-runs block, and of the ship receipt itself, is now skipped for the card-number check too, only when the whole card-shaped number lies inside that run id; a card number in any other field, or written as a run id of any other shape, is still caught. Reported by @dgrant (#4725).