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
gstack-pr-wait ignores cancelled checks a newer pass replaced, and the npm git-dependency hint names allow-git (#4832)
Garry Tan8aafd408e21f
diff --git a/bin/gstack-docs-candidate b/bin/gstack-docs-candidateindex 332ba377a..2013dec65 100755--- a/bin/gstack-docs-candidate+++ b/bin/gstack-docs-candidate@@ -48,7 +48,8 @@* attempt reads one audit child's output and says whether the launch counts* against Step 14.5's attempt budget. A launch the child's install check refused* (an `INSTALL: fail` row, its last GSTACK_RESULT line a document-release- * refusal, and no audit JSON) never audited, so it is not counted, once per+ * refusal, and no audit JSON beyond a blocked result that reviewed and updated+ * no file, CAPY-1) never audited, so it is not counted, once per* invocation (--state, the invocation's record); a second refusal is counted* and stops for the install fix (GST-391, gbrain #8084).*@@ -325,7 +326,8 @@ function main(argv: string[]): void {const lines = fs.readFileSync(file, 'utf8').split('\n').map(l => l.trim()).filter(Boolean);const last = lines.filter(l => l.startsWith('GSTACK_RESULT: ')).pop();const install = lines.find(l => /^INSTALL: fail\b/.test(l));- const audited = lines.some(l => { try { const v = JSON.parse(l); return !!v && typeof v === 'object' && 'schema_version' in v; } catch { return false; } });+ const empty = (a: unknown) => Array.isArray(a) && a.length === 0;+ const audited = lines.some(l => { try { const v = JSON.parse(l); return !!v && typeof v === 'object' && 'schema_version' in v && !(v.status === 'blocked' && empty(v.files_reviewed) && empty(v.files_updated)); } catch { return false; } });if (!last || !/^GSTACK_RESULT: skill=document-release status=refused\b/.test(last) || !install || audited) { console.log('ATTEMPT: counted'); return; }let seen = 0;try { seen = Number(JSON.parse(fs.readFileSync(state, 'utf8')).not_counted) || 0; } catch { seen = fs.existsSync(state) ? 1 : 0; }diff --git a/bin/gstack-install-verdict.sh b/bin/gstack-install-verdict.shindex 5714bf60a..2ef495b4a 100644--- a/bin/gstack-install-verdict.sh+++ b/bin/gstack-install-verdict.sh@@ -23,7 +23,9 @@# GSTACK_INSTALL_VERDICT, so a reviewer's install never shadows it (GST-1161).# Each workflow install also writes its own record, <verdict>.for/<workflow>.json,# which admission tries when the shared verdict does not admit that workflow, so-# another workflow's later install never drops it (GST-1233).+# another workflow's later install never drops it (GST-1233), then, when a+# review-voice install wrote the shared verdict, /ship's own record, which+# covers the workflows /ship launches (CAPY-1).## Admission (gstack-skill-start, after SESSION_KIND): an unattended session,# or an explicit GSTACK_SESSION_KIND=spawned session with GSTACK_CAPY=1,@@ -192,16 +194,25 @@ gstack_install_admission() {_gstack_ia_check# GST-1233: each install also keeps its own verdict per workflow, so when a# later install for another workflow replaced the shared one, this- # workflow's own record still admits it; never after a failed ./setup, which- # changed the checkout every record certified.- _ia_own="${file%.json}.for/$skill.json"- case "$skill" in ''|*[!A-Za-z0-9._-]*) _ia_own="" ;; esac- case "$trailer" in "gstack: fail setup"*) _ia_own="" ;; esac- if [ -n "$detail" ] && [ -n "$_ia_own" ] && [ -f "$_ia_own" ]; then+ # workflow's own record still admits it; when an install profile (a+ # reviewer's review-voice install) wrote the shared verdict, so does /ship's+ # own record, which a workflow /ship launches (document-release) runs under+ # (CAPY-1); never after a failed ./setup, which changed the checkout every+ # record certified.+ _ia_dir="${file%.json}.for"+ _ia_ship=""+ gstack_doctor_install_profile "$(gstack_install_verdict_field "$file" for)" && _ia_ship="$_ia_dir/ship.json"+ case "$skill" in ''|*[!A-Za-z0-9._-]*) _ia_dir="" ;; esac+ case "$trailer" in "gstack: fail setup"*) _ia_dir="" ;; esac+ if [ -n "$detail" ] && [ -n "$_ia_dir" ]; then_ia_m_file=$file _ia_m_detail=$detail _ia_m_fix=$fix _ia_m_code=$code _ia_m_status=$_ia_status _ia_m_trailer=$trailer- file=$_ia_own _ia_status=ok- _gstack_ia_check- [ -z "$detail" ] || { file=$_ia_m_file detail=$_ia_m_detail fix=$_ia_m_fix code=$_ia_m_code _ia_status=$_ia_m_status trailer=$_ia_m_trailer; }+ for _ia_own in "$_ia_dir/$skill.json" ${_ia_ship:+"$_ia_ship"}; do+ [ -f "$_ia_own" ] || continue+ file=$_ia_own _ia_status=ok+ _gstack_ia_check+ [ -n "$detail" ] || break+ file=$_ia_m_file detail=$_ia_m_detail fix=$_ia_m_fix code=$_ia_m_code _ia_status=$_ia_m_status trailer=$_ia_m_trailer+ donefi[ -n "$detail" ] || { _ia_line="INSTALL_VERDICT: ok $trailer"; return 0; }[ "$_ia_status" = runtime ] || _ia_status=verdictdiff --git a/bin/gstack-ship-receipt b/bin/gstack-ship-receiptindex 25ae7159c..fd3f36e1a 100755--- a/bin/gstack-ship-receipt+++ b/bin/gstack-ship-receipt@@ -196,7 +196,8 @@ function noStopArg(raw: string | undefined): ShipReceipt['no_stop'] {if (raw === undefined) return undefined;const parsed = JSON.parse(raw.startsWith('@') ? fs.readFileSync(raw.slice(1), 'utf8') : raw);if (!Array.isArray(parsed)) throw new Error('--no-stop expects a JSON array of {class, reason, evidence}');- const kept = parsed.filter(r => (NO_STOP_CLASSES as readonly string[]).includes(r?.class) || void process.stderr.write(`NO_STOP: dropped ${JSON.stringify(r?.class)} from --no-stop: not a current no-stop class (${NO_STOP_CLASSES.join(', ')}), so the receipt leaves it out (GST-2706)\n`));+ const current: readonly string[] = NO_STOP_CLASSES.filter(c => c !== 'scoped-fix-check');+ const kept = parsed.filter(r => current.includes(r?.class) || void process.stderr.write(`NO_STOP: dropped ${JSON.stringify(r?.class)} from --no-stop: not a current no-stop class (${current.join(', ')}), so the receipt leaves it out (GST-2706)\n`));return kept.length ? kept : undefined;}function git(args: string[], cwd?: string): string | undefined {diff --git a/changelog.d/fix-pr-wait-replaced-cancels-npm-allow-git-docs-admission.md b/changelog.d/fix-pr-wait-replaced-cancels-npm-allow-git-docs-admission.mdnew file mode 100644index 000000000..bd1f9a6fe--- /dev/null+++ b/changelog.d/fix-pr-wait-replaced-cancels-npm-allow-git-docs-admission.md@@ -0,0 +1,6 @@+### Fixed++- **`gstack-pr-wait` no longer blocks on a cancelled check that a newer passing run of the same check replaced.** In a repository whose workflows use `concurrency: cancel-in-progress`, the older run is cancelled when the next one starts; `gstack-ship-queue ready` already judged the check by the newer pass, but `gstack-pr-wait --until green` stopped with `PR_WAIT_BLOCKED`. It now waits while the newer run is going and goes green when it passes. A failed run beside a newer pass still blocks, and so does a cancel that is the newest run (#4807, reported by exGeni).+- **The `DEPS_MISSING` stop names npm's `allow-git` setting when the lockfile installs a package from git.** npm 12 refuses git packages by default, so the plain `npm ci` the stop suggested failed with `EALLOWGIT`. The hint still suggests `npm ci` and says to add `--allow-git=all` if you trust that source; gstack does not turn it on for you (#4815, reported by exGeni).+- **The docs audit /gstack-ship launches starts after a reviewer's install replaced the shared install verdict.** A `--for review-voice` install rewrote the shared verdict, so the `document-release` child was refused at start even though /gstack-ship's own install had certified the same checkout and HEAD. When a reviewer's install wrote the shared verdict, admission now also tries /gstack-ship's own record, with the same checks. A launch refused this way and reported as an empty blocked result no longer uses up the PR's one re-audit.+- **`gstack-ship-receipt write` leaves a retired `scoped-fix-check` row out of `--no-stop`,** as `gstack-no-stop` already refuses one.diff --git a/docs/capy-install.md b/docs/capy-install.mdindex 48bed5d87..e13694a75 100644--- a/docs/capy-install.md+++ b/docs/capy-install.md@@ -392,7 +392,10 @@ uses it to refuse a base merge under an open runverdict does not admit a workflow, admission and the pregate try theworkflow's own record with the same checks, so a later install for anotherworkflow on a shared machine (a /gstack-ship docs child resolving another Bun, or a- failed child install) never drops /gstack-ship's admission (GST-1233). A new HEAD+ failed child install) never drops /gstack-ship's admission (GST-1233). When a+ reviewer's review-voice install wrote the shared verdict, admission then tries+ /gstack-ship's own record with the same checks, so the docs audit+ /gstack-ship launches still starts (CAPY-1). A new HEADstill invalidates both, and a failed `./setup` (`gstack: fail setup`)invalidates every workflow's record. `--check --for <workflow>` keeps theBun that workflow's own record holds. The launch file and launch directorydiff --git a/docs/ship-policy.md b/docs/ship-policy.mdindex 196519c5a..7f1008dc4 100644--- a/docs/ship-policy.md+++ b/docs/ship-policy.md@@ -282,6 +282,10 @@ the same workflow replaced it; a run cancelled before any job is not counted.An unreadable list is unknown, never green. `gstack-pr-wait`, `gstack-ci-gate`and the release cut read CI through the same helper (`lib/ci-head-checks.ts`),on top of what they read before, so none of them calls such a head green.+The one row they drop from before is a cancelled run that a newer run of the+same check replaced while that run passed or still runs, which `ci:` already+judges by that newer run (`gstack-pr-wait`, #4807); any other older red run+still gates.When a check counts as passing only because a newer run from another checksuite replaced a red one (a branch-only `free-tests.yml` dispatch beside the reddiff --git a/docs/troubleshooting.md b/docs/troubleshooting.mdindex ddcdd064b..697424e77 100644--- a/docs/troubleshooting.md+++ b/docs/troubleshooting.md@@ -8180,7 +8180,10 @@ attempt of each check suite as `gstack-ship-queue ready` does: a failed checkwhose rerun attempt created no jobs (GitHub's default list then hides it) and aworkflow run that failed before creating any job (`check failed: <workflow>(run <id>, no jobs)`) block `green`, and a rerun that passed clears its-failure. A check the base+failure. `gstack-pr-wait` also judges a check by its newer run when that run+replaced a cancelled one (a workflow with `concurrency: cancel-in-progress`):+passing, or pending while it runs, as `ready` does; a failed run beside a newer+pass still blocks. A check the basebranch requires (rulesets and classic branch protection) counts as pendinguntil it appears. `--exclude <check,...>` leaves a named non-required checkout of the verdict, as `gstack-ci-gate --exclude` does: it neither holdsdiff --git a/lib/install-verdict.ts b/lib/install-verdict.tsindex 60f787cd2..a1edbbbfd 100644--- a/lib/install-verdict.ts+++ b/lib/install-verdict.ts@@ -148,13 +148,19 @@ export function verdictProblem(skill: string, gstackRoot: string, env: Env, bunP/*** The verdict file that admits `skill`: `file` itself, else the workflow's own record* <verdict>.for/<skill>.json that every install also writes, so a later install for another- * workflow never drops this one (GST-1233), except after a failed ./setup, which changed the- * checkout every record certified. When neither admits, `file` with its problem.+ * workflow never drops this one (GST-1233), and when an install profile (a reviewer's+ * review-voice install) wrote `file`, /ship's own record, which a workflow /ship launches+ * (document-release) runs under (CAPY-1); each record is checked for `skill` in full. Never after a failed ./setup, which changed the+ * checkout every record certified. When none admits, `file` with its problem.*/export function admittedVerdict(skill: string, src: string, file: string, project: string | null, bunPath: string, bunVersion: string): { file: string; problem: VerdictProblem | null } {const problem = verdictFileProblem(file, skill, src, project, bunPath, bunVersion);- const own = file.replace(/\.json$/, `.for/${skill}.json`);- if (problem && /^[A-Za-z0-9._-]+$/.test(skill) && !readInstallVerdict(file)?.trailer?.startsWith('gstack: fail setup') && fs.existsSync(own) && !verdictFileProblem(own, skill, src, project, bunPath, bunVersion)) return { file: own, problem: null };+ if (!problem || !/^[A-Za-z0-9._-]+$/.test(skill) || readInstallVerdict(file)?.trailer?.startsWith('gstack: fail setup')) return { file, problem };+ const records = INSTALL_PROFILES.includes(readInstallVerdict(file)?.for ?? '') ? new Set([skill, 'ship']) : [skill];+ for (const name of records) {+ const own = file.replace(/\.json$/, `.for/${name}.json`);+ if (fs.existsSync(own) && !verdictFileProblem(own, skill, src, project, bunPath, bunVersion)) return { file: own, problem: null };+ }return { file, problem };}diff --git a/lib/pr-wait-github.ts b/lib/pr-wait-github.tsindex 95b1862e4..c801095b2 100644--- a/lib/pr-wait-github.ts+++ b/lib/pr-wait-github.ts@@ -15,6 +15,7 @@import type { GhResult, GhRunner } from './ci-gate';import { headCheckRows } from './ci-head-checks';import { parseHeadChecks, parsePullState, rateLimitKind, type PullState } from './gh-poll';+import { replacedCancels } from './ship-queue';export class GhError extends Error {constructor(message: string, readonly transient: boolean) {@@ -183,12 +184,16 @@ function restList(env: GhEnv, path: string, key: string): unknown[] {* statuses (the same rows `gh pr checks` reads through GraphQL) plus CI at the* head as gstack-ship-queue ready reads it (lib/ci-head-checks.ts: a failed* check whose rerun attempt created no jobs, a workflow run that failed with- * no jobs), duplicates collapsed to the worst bucket. An unknown read is a+ * no jobs), duplicates collapsed to the worst bucket. A cancelled run that a+ * newer passing or still-running run of the same app and check name replaced is left out first,+ * as that reader leaves it out (replacedCancels, #4807). An unknown read is a* transient GhError, so the poll loop tries again.*/export function fetchChecks(env: GhEnv, repo: string, head: string): Map<string, Check> {+ const runs = restList(env, `repos/${repo}/commits/${head}/check-runs?per_page=100`, 'check_runs') as Array<Record<string, unknown>>;+ const replaced = replacedCancels(runs);const listed = parseHeadChecks(- restList(env, `repos/${repo}/commits/${head}/check-runs?per_page=100`, 'check_runs'),+ runs.filter(r => !replaced.has(r)),restList(env, `repos/${repo}/commits/${head}/status?per_page=100`, 'statuses'),);const ci = headCheckRows(args => runGh(env, args), repo, head);diff --git a/lib/ship-preflight.ts b/lib/ship-preflight.tsindex d6c947bea..dc4893c00 100644--- a/lib/ship-preflight.ts+++ b/lib/ship-preflight.ts@@ -221,7 +221,15 @@ function depsInstall(root: string): string | null {try { pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')); } catch { return null; }const has = (f: string) => fs.existsSync(path.join(root, f));if (!Object.keys({ ...pkg.dependencies, ...pkg.devDependencies }).length || has('node_modules') || has('.pnp.cjs') || has('.pnp.loader.mjs') || has('.pnp.js')) return null;- return has('bun.lock') || has('bun.lockb') ? 'bun install --frozen-lockfile' : has('pnpm-lock.yaml') ? 'pnpm install --frozen-lockfile' : has('yarn.lock') ? 'yarn install --frozen-lockfile' : has('package-lock.json') || has('npm-shrinkwrap.json') ? 'npm ci' : 'bun install';+ return has('bun.lock') || has('bun.lockb') ? 'bun install --frozen-lockfile' : has('pnpm-lock.yaml') ? 'pnpm install --frozen-lockfile' : has('yarn.lock') ? 'yarn install --frozen-lockfile' : has('npm-shrinkwrap.json') ? npmCi(root, 'npm-shrinkwrap.json') : has('package-lock.json') ? npmCi(root, 'package-lock.json') : 'bun install';+}++/** npm ci, with a note naming npm's allow-git setting when the lockfile resolves a package from git, which npm 12 refuses by default (#4815). */+function npmCi(root: string, lock: string): string {+ let text = '';+ try { text = fs.readFileSync(path.join(root, lock), 'utf8'); } catch { /* plain npm ci */ }+ if (!/"(?:resolved|version)"\s*:\s*"(?:git\+|git:\/\/|github:)/.test(text)) return 'npm ci';+ return `npm ci (${lock} resolves a package from git, which npm 12 and later install only when npm's allow-git setting permits it: add --allow-git=all if you trust that source)`;}async function tests(cwd: string, base: string, list: { label: string; command: string }[], policyFrom: string, timeout: string | undefined, step: { seconds: number; source: string }, run: { concurrency: number; line: string; hold: boolean; testsOnly: boolean }, r: Report): Promise<void> {diff --git a/lib/ship-queue.ts b/lib/ship-queue.tsindex 5bdab70ec..b8f2989ba 100644--- a/lib/ship-queue.ts+++ b/lib/ship-queue.ts@@ -160,6 +160,21 @@ export function latestRunPerName<T extends CheckRun>(runs: T[]): T[] {const suiteOf = (r: Record<string, unknown>) => String((r.check_suite as { id?: unknown } | null | undefined)?.id ?? '');const PASSING = ['success', 'skipped', 'neutral'];+/**+ * The cancelled runs latestRunPerName judges by a newer run of the same app and check name that passed or is still+ * running, such as a pull_request run that concurrency: cancel-in-progress cancelled when the next run on the same head+ * started (#4807). gstack-pr-wait leaves these out before keeping the worst bucket per name, so the check reads as that+ * newer run (pass or pending), as ready reads it; every other older run still gates there.+ */+export function replacedCancels<T extends CheckRun & { conclusion?: unknown }>(runs: T[]): Set<T> {+ const winners = new Map(latestRunPerName(runs).map(r => [checkKey(r), r] as const).filter(([k]) => k !== null));+ return new Set(runs.filter(r => {+ const key = checkKey(r);+ const by = key === null ? undefined : winners.get(key);+ return r.status === 'completed' && r.conclusion === 'cancelled' && !!by && by !== r && (by.status !== 'completed' || PASSING.includes(String(by.conclusion)));+ }));+}+/*** A CI_SUPERSEDED line for each red run whose check counts by a passing newer run from another check suite, such as a* branch-only dispatch that replaced a red pull_request run, which tested the merge with the base (reports/GSTA-461.mddiff --git a/test/gh-poll.test.ts b/test/gh-poll.test.tsindex f1c5084fc..410d3870a 100644--- a/test/gh-poll.test.ts+++ b/test/gh-poll.test.ts@@ -12,7 +12,7 @@ import { readFileSync } from 'node:fs';import { join } from 'node:path';import type { GhResult } from '../lib/ci-gate';import { MAX_LIMIT_WAITS, MIN_POLL_MS, parseHeadChecks, parsePullState, pollDelayMs, rateLimitKind, rateLimitWaitMs, withRateLimit } from '../lib/gh-poll';-import { GhError, fetchChecks, runGh } from '../lib/pr-wait-github';+import { GhError, bucketClass, fetchChecks, runGh } from '../lib/pr-wait-github';import { waitForRun } from '../lib/ci-carry';import { ciRest } from './helpers/ci-attempts-fixture';@@ -188,6 +188,23 @@ describe('REST replies parse from recorded fixtures', () => {]);expect(calls.some(c => c[0] === 'pr' || c[1] === 'graphql')).toBe(false);});++ // Value: protects=gstack-pr-wait agrees with gstack-ship-queue ready on a cancelled run that a newer passing run of the same app and+ // check name replaced (concurrency: cancel-in-progress), pending while that run is still going, and every other duplicate keeps+ // the worst bucket (#4807, exGeni's repro); fails_when=the replaced cancel blocks with PR_WAIT_BLOCKED, or a cancel that is newest, a failure, or another app's pass stops+ // gating; seam=fetchChecks over the shared REST fake; no_claim=the CLI exit+ test("fetchChecks drops a cancelled run that a newer passing or running run of the same check replaced, and nothing else (#4807)", () => {+ const app = { id: 15368 };+ const run = (id: number, suite: number, conclusion: string, done: string, appId = app): Record<string, unknown> =>+ ({ id, name: 'title-check', status: 'completed', conclusion, completed_at: done, check_suite: { id: suite }, app: appId });+ const bucket = (check_runs: Array<Record<string, unknown>>) => fetchChecks({ gh: (args: string[]) => ciRest(args, { check_runs }) ?? ok(''), sleep: () => {}, log: () => {} }, 'owner/repo', 'a'.repeat(40)).get('title-check')!.bucket;+ expect(bucket([run(1, 100, 'cancelled', '2026-01-01T10:00:10Z'), run(2, 200, 'success', '2026-01-01T10:00:50Z')])).toBe('pass');+ expect(bucketClass(bucket([run(1, 100, 'cancelled', '2026-01-01T10:00:50Z'), run(2, 200, 'success', '2026-01-01T10:00:10Z')]))).toBe('fail');+ expect(bucketClass(bucket([run(1, 100, 'failure', '2026-01-01T10:00:10Z'), run(2, 200, 'success', '2026-01-01T10:00:50Z')]))).toBe('fail');+ expect(bucketClass(bucket([run(1, 100, 'cancelled', '2026-01-01T10:00:10Z'), run(2, 200, 'success', '2026-01-01T10:00:50Z', { id: 99 })]))).toBe('fail');+ expect(bucketClass(bucket([run(1, 100, 'cancelled', '2026-01-01T10:00:10Z'), run(2, 200, 'failure', '2026-01-01T10:00:50Z')]))).toBe('fail');+ expect(bucketClass(bucket([run(1, 100, 'cancelled', '2026-01-01T10:00:10Z'), { ...run(2, 200, 'success', '2026-01-01T10:00:50Z'), status: 'in_progress', conclusion: null, completed_at: null }]))).toBe('pending');+ });});describe('waits sleep at least the floor', () => {diff --git a/test/install-verdict.test.ts b/test/install-verdict.test.tsindex 3c4bb0050..bcd7aaad4 100644--- a/test/install-verdict.test.ts+++ b/test/install-verdict.test.ts@@ -176,6 +176,30 @@ describe('install verdict keyed by (checkout, project): both twins', () => {expect(bashAdmit('ship', proj, { _GH: sr, ...env }).line).toBe(without.line);});+ // Value: protects=a document-release audit that /ship launches after a reviewer's review-voice install rewrote the shared verdict+ // is admitted by /ship's own passing record for this checkout and HEAD (CAPY-1, yc-software/qm#3974), in both twins;+ // fails_when=it refuses with INSTALL_UNVERIFIED, or a /ship record for another HEAD or one that skipped claude admits it;+ // seam=gstack_install_admission and checkInstallAdmission on fixture verdicts+ test("CAPY-1: a review-voice install rewrote the launched verdict; document-release admits from /ship's own record, never from a stale or narrower one", () => {+ const sr = tmp();+ const proj = project('qm');+ const shared = writeVerdict(sr, { project: proj, bun_path: BUN, bun_version: '1.4.2', schema_version: 2, for: 'review-voice',+ required: ['patch', 'runtime', 'helpers', 'state-root', 'privacy', 'cores', 'revision'], trailer: 'gstack: ok 9.9.9.9 for=review-voice' });+ const env = { GSTACK_STATE_ROOT: sr, GSTACK_INSTALL_VERDICT: shared };+ const without = both('document-release', proj, env);+ expect(without).toMatchObject({ refuse: true, status: 'verdict', code: 'INSTALL_UNVERIFIED' });+ expect(without.detail).toContain('certified for=review-voice, which does not cover claude that document-release needs');+ const ship = shared.replace(/\.json$/, '.for/ship.json');+ const shipVerdict = { project: proj, bun_path: BUN, bun_version: '1.4.2', schema_version: 2, for: 'ship', trailer: 'gstack: ok 9.9.9.9 for=ship' };+ writeVerdict(sr, shipVerdict, ship);+ expect(both('document-release', proj, env)).toMatchObject({ refuse: false, status: 'ok' });+ expect(bashAdmit('document-release', proj, { _GH: sr, ...env }).line).toBe('INSTALL_VERDICT: ok gstack: ok 9.9.9.9 for=ship');+ writeVerdict(sr, { ...shipVerdict, head: 'f'.repeat(40) }, ship);+ expect(both('document-release', proj, env)).toMatchObject({ refuse: true, status: 'verdict', detail: without.detail });+ writeVerdict(sr, { ...shipVerdict, required: ['codex', 'patch', 'runtime', 'pins', 'state-root', 'privacy', 'cores', 'revision'] }, ship);+ expect(both('document-release', proj, env)).toMatchObject({ refuse: true, status: 'verdict', detail: without.detail });+ });+test('a running Bun other than the recorded one refuses with BUN_RESOLUTION_DRIFT and names both', () => {const sr = tmp();const a = project('a');diff --git a/test/ship-preflight-carry-bound-and-deps.test.ts b/test/ship-preflight-carry-bound-and-deps.test.tsindex fcf5328cf..8b439b0e9 100644--- a/test/ship-preflight-carry-bound-and-deps.test.ts+++ b/test/ship-preflight-carry-bound-and-deps.test.ts@@ -91,6 +91,25 @@ describe('preflight Step 5: a worktree with no installed packages stops with theexpect(testsOnly(plain).stdout).not.toContain('DEPS_MISSING');});+ // Value: protects=a lockfile with a git-resolved package gets a hint that names npm's allow-git setting and its flag, since plain+ // npm ci fails with EALLOWGIT under npm 12 (#4815, exGeni), while the suggested command stays plain npm ci (no default+ // --allow-git=all); fails_when=the hint is plain npm ci for a git package, or a registry-only lockfile gets the note;+ // seam=bin/gstack-ship-preflight --tests-only, depsInstall+ test('a lockfile that resolves a package from git names allow-git and its flag, never as the default command (#4815)', () => {+ const pkg = '{"name":"fx","version":"1.0.0","dependencies":{"dep":"git+https://github.com/o/dep.git#abc"}}\n';+ const lock = (resolved: string) => JSON.stringify({ lockfileVersion: 3, packages: { 'node_modules/dep': { version: '1.0.0', resolved } } }) + '\n';+ const git = shipFixture({ 'package.json': pkg, 'package-lock.json': lock('git+ssh://[email protected]/o/dep.git#abc') });+ fixtures.push(git);+ const stop = lineOf(testsOnly(git).stdout, 'STOP');+ expect(stop).toContain(`&& npm ci (package-lock.json resolves a package from git, which npm 12 and later install only when npm's allow-git setting permits it: add --allow-git=all if you trust that source), then rerun this command`);+ const v1 = shipFixture({ 'package.json': pkg, 'npm-shrinkwrap.json': JSON.stringify({ lockfileVersion: 1, dependencies: { dep: { version: 'github:o/dep#abc' } } }) });+ fixtures.push(v1);+ expect(lineOf(testsOnly(v1).stdout, 'STOP')).toContain("&& npm ci (npm-shrinkwrap.json resolves a package from git");+ const registry = shipFixture({ 'package.json': pkg, 'package-lock.json': lock('https://registry.npmjs.org/dep/-/dep-1.0.0.tgz') });+ fixtures.push(registry);+ expect(lineOf(testsOnly(registry).stdout, 'STOP')).toContain('&& npm ci, then rerun this command');+ });+// Value: protects=an installed Yarn Plug'n'Play checkout, which never has node_modules, runs Step 5 instead of stopping on an// install that cannot clear the stop; fails_when=depsInstall checks node_modules alone; seam=bin/gstack-ship-preflight --tests-onlytest('a Yarn PnP checkout (.pnp.cjs, no node_modules) never stops on DEPS_MISSING', () => {diff --git a/test/ship-receipt-runs.test.ts b/test/ship-receipt-runs.test.tsindex 3becc3201..032897e86 100644--- a/test/ship-receipt-runs.test.ts+++ b/test/ship-receipt-runs.test.ts@@ -92,4 +92,17 @@ describe('no_stop receipt field (K1)', () => {expect(extractReceipt(fs.readFileSync(body, 'utf8')).receipt!.no_stop).toEqual([{ class: 'pregate-flake-rerun', reason: 'r', evidence: 'run 1' }]);} finally { cleanup(repo); }});++ // Value: protects=write leaves out a retired scoped-fix-check row as gstack-no-stop (checkNoStop) refuses one (#4829 notes);+ // fails_when=the receipt records a scoped-fix-check no-stop; seam=none (the real bin on a fixture repo); no_claim=the gh round trip+ test('write drops a scoped-fix-check row from --no-stop, as gstack-no-stop refuses one', () => {+ const repo = makeFixtureRepo();+ try {+ const body = path.join(repo.root, 'body.md');+ const rows = JSON.stringify([{ class: 'scoped-fix-check', reason: 'r', evidence: 'commit abc' }, { class: 'pregate-flake-rerun', reason: 'r', evidence: 'run 1' }]);+ const w = runBin(repo, 'gstack-ship-receipt', ['write', '--pr', '9', '--base', 'main', '--version', '1.0.0', '--session-kind', 'unattended', '--no-stop', rows, '--body', body]);+ expect([w.status, w.err], w.out).toEqual([EXIT.ok, expect.stringContaining('NO_STOP: dropped "scoped-fix-check"')]);+ expect(extractReceipt(fs.readFileSync(body, 'utf8')).receipt!.no_stop).toEqual([{ class: 'pregate-flake-rerun', reason: 'r', evidence: 'run 1' }]);+ } finally { cleanup(repo); }+ });});diff --git a/test/ship-rereview-triggers.test.ts b/test/ship-rereview-triggers.test.tsindex 708590406..b35592ead 100644--- a/test/ship-rereview-triggers.test.ts+++ b/test/ship-rereview-triggers.test.ts@@ -623,6 +623,21 @@ describe('test-only and audit-requested edits after the docs audit (GST-391, gbrconst reset = f.run(path.join(BIN, 'gstack-docs-candidate'), ['attempt', refused, '--state', corrupt]);expect([reset.status, reset.stdout.includes('ATTEMPT: counted (a second install refusal in this invocation)')]).toEqual([3, true]);});++ // Value: protects=a child whose install check refused document-release and that then reported the refusal as a blocked result+ // (no file reviewed or updated, as Step 14.5's contract asks) does not spend the PR's re-audit (CAPY-1, yc-software/qm#3974);+ // fails_when=that blocked line reads as an audit, or a blocked result that reviewed or updated a file stops counting; seam=none+ test('gstack-docs-candidate attempt does not count an install refusal reported as an empty blocked result', () => {+ const f = fx();+ const out = (name: string, text: string) => { const p = path.join(f.root, name); fs.writeFileSync(p, text); return p; };+ const attempt = (file: string, state: string) => f.run(path.join(BIN, 'gstack-docs-candidate'), ['attempt', file, '--state', path.join(f.root, state)]).stdout.trim();+ const refusal = 'SESSION_KIND: spawned\nINSTALL: fail verdict — the install verdict certified for=review-voice, which does not cover claude that document-release needs; fix: run the installer (INSTALL_UNVERIFIED)\nGSTACK_RESULT: skill=document-release status=refused run=-\n';+ const blocked = (reviewed: string[], updated: string[]) => JSON.stringify({ schema_version: 1, audit_id: 'a1', status: 'blocked', files_updated: updated, files_reviewed: reviewed, blockers: ['install admission refused document-release'], decisions: [], documentation_section: 'blocked' }) + '\n';+ expect(attempt(out('empty.txt', refusal + blocked([], [])), 's1.json')).toBe("ATTEMPT: not-counted (the audit child's install check refused document-release)");+ expect(attempt(out('reviewed.txt', refusal + blocked(['README.md'], [])), 's2.json')).toBe('ATTEMPT: counted');+ expect(attempt(out('updated.txt', refusal + blocked([], ['README.md'])), 's3.json')).toBe('ATTEMPT: counted');+ expect(attempt(out('current.txt', refusal + JSON.stringify({ schema_version: 1, audit_id: 'a1', status: 'current', files_updated: [], files_reviewed: [] }) + '\n'), 's4.json')).toBe('ATTEMPT: counted');+ });});describe('preflight carry route for a spliced hunk (GST-442)', () => {