diff --git a/changelog.d/capy-fix-ship-queue-ready.md b/changelog.d/capy-fix-ship-queue-ready.md new file mode 100644 index 000000000..c48347417 --- /dev/null +++ b/changelog.d/capy-fix-ship-queue-ready.md @@ -0,0 +1 @@ +- **The free test suite is green on main again.** Two `gstack-ship-queue ready` tests still wrote a pre-merge check record with a single check, which `ready` has refused since the pre-merge check started requiring every registered check (GST-2194). Their fixtures now record every check, so the tests exercise what they were written for. No product behavior changed (GST-2282). diff --git a/crew/test/ship-queue-ready-notes-push.test.ts b/crew/test/ship-queue-ready-notes-push.test.ts index 51f5108d2..049beff12 100644 --- a/crew/test/ship-queue-ready-notes-push.test.ts +++ b/crew/test/ship-queue-ready-notes-push.test.ts @@ -9,10 +9,12 @@ import { afterEach, describe, expect, test } from 'bun:test'; import * as fs from 'node:fs'; import * as path from 'node:path'; import { EXIT } from '../../lib/headless-artifacts'; +import { CHECK_IDS } from '../../lib/pregate/index'; import { cleanup, runBin } from '../../test/helpers/restamp-fixture'; import { line, openPr, queue, repoKey, trainFixture, type TrainFixture } from '../../test/helpers/ship-queue-train-fixture'; const NOTES = 'refs/notes/gstack-trains'; +const FULL_CHECKS = CHECK_IDS.map(id => ({ id, status: 'pass' })); const fixtures: TrainFixture[] = []; afterEach(() => { while (fixtures.length) cleanup(fixtures.pop()!.repo); }); @@ -23,7 +25,7 @@ function readyFixture() { fx.write(d => { d.ci[head] = [{ status: 'completed', conclusion: 'success' }]; }); const tree = runBin(fx.repo, 'gstack-wtree', []).out.trim(); const pregate = path.join(fx.repo.root, 'pregate.json'); - fs.writeFileSync(pregate, JSON.stringify({ schema_version: 1, tree, head, verdict: 'pass', checks: [{ id: 'unit', status: 'pass' }] })); + fs.writeFileSync(pregate, JSON.stringify({ schema_version: 1, tree, head, verdict: 'pass', checks: FULL_CHECKS })); return { fx, head, pregate }; } diff --git a/test/ship-queue-ready-fresh-base.test.ts b/test/ship-queue-ready-fresh-base.test.ts index a03556269..ce4fde81d 100644 --- a/test/ship-queue-ready-fresh-base.test.ts +++ b/test/ship-queue-ready-fresh-base.test.ts @@ -8,6 +8,7 @@ import { afterEach, describe, expect, test } from 'bun:test'; import * as fs from 'node:fs'; import * as path from 'node:path'; import { EXIT } from '../lib/headless-artifacts'; +import { CHECK_IDS } from '../lib/pregate/index'; import { REVIEW_EXCLUDE_KEY_VERSION } from '../lib/ship-policy'; import { BASE_POLICY, cleanup, makeFixtureRepo, runBin, type FixtureRepo } from './helpers/restamp-fixture'; import { ghQueueShim } from './helpers/ship-queue-fixture'; @@ -17,6 +18,7 @@ const repos: FixtureRepo[] = []; afterEach(() => { while (repos.length) cleanup(repos.pop()!); }); const green = { check_runs: [{ status: 'completed', conclusion: 'success' }] }; +const FULL_CHECKS = CHECK_IDS.map(id => ({ id, status: 'pass' })); const queue = (repo: FixtureRepo, args: string[], env: Record) => runBin(repo, 'gstack-ship-queue', [...args, '--base', 'main'], env); function write(repo: FixtureRepo, files: Record, message: string): string { @@ -55,7 +57,7 @@ function stackedAfterParentLanded() { const landed = land(repo, 'parent'); const tree = runBin(repo, 'gstack-wtree', []).out.trim(); const pregate = path.join(repo.root, 'pregate.json'); - fs.writeFileSync(pregate, JSON.stringify({ schema_version: 1, tree, head, verdict: 'pass', checks: [{ id: 'unit', status: 'pass' }] })); + fs.writeFileSync(pregate, JSON.stringify({ schema_version: 1, tree, head, verdict: 'pass', checks: FULL_CHECKS })); const ready = (digest: string) => queue(repo, ['ready', '--pr', '2', '--pregate', pregate], ghQueueShim(repo, { prs: { '2': { headRefOid: head, url: 'https://github.com/o/r/pull/2', body: shippedBody('2', head, { review_exclude: { source: 'origin/main', patterns: ['fixtures/goldens/**'], applied: ['fixtures/goldens/**'], excluded: 1, excluded_bytes: 0, kept: 0, gate_tagged: [], patterns_sha256: 'b'.repeat(64), list_sha256: 'c'.repeat(64), digest } }) } }, checks: { [head]: green } })); const probe = ready('a'.repeat(64)); expect(probe.status, probe.out + probe.err).toBe(EXIT.refused);