From 3081672256d072a68aad379fb3fd8ce35cd761c1 Mon Sep 17 00:00:00 2001 From: garrytan Date: Tue, 13 Oct 2026 01:50:21 +0000 Subject: [PATCH] test(autoplan): pin CLI refusals to the result-code registry's fix text Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- test/autoplan-admission.test.ts | 2 ++ test/autoplan-capy-e2e.test.ts | 5 ++++- test/autoplan-record.test.ts | 2 ++ test/autoplan-revise.test.ts | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/test/autoplan-admission.test.ts b/test/autoplan-admission.test.ts index 27e7a9d74..fe833df49 100644 --- a/test/autoplan-admission.test.ts +++ b/test/autoplan-admission.test.ts @@ -11,6 +11,7 @@ import { afterAll, describe, expect, test } from 'bun:test'; import * as fs from 'node:fs'; import * as path from 'node:path'; +import { RESULT_CODES } from '../lib/result-codes'; import { ROOT } from './helpers/autoplan-run-fixture'; import { HEAD, capyRunner, readRunJson, writePlan } from './helpers/autoplan-capy'; @@ -29,6 +30,7 @@ describe('admission', () => { const { out, res } = first(r, 'none'); expect(res.status).toBe(3); expect(res.stderr).toMatch(/no install verdict at .*\(INSTALL_UNVERIFIED\)$/m); + expect(res.stderr).toContain(`; fix: ${RESULT_CODES.INSTALL_UNVERIFIED.fix} (INSTALL_UNVERIFIED)`); expect(res.stdout).toContain('GSTACK_RESULT: skill=autoplan status=refused'); expect(fs.existsSync(path.join(out, 'run.json'))).toBe(false); }); diff --git a/test/autoplan-capy-e2e.test.ts b/test/autoplan-capy-e2e.test.ts index f1ef7de0f..25602282e 100644 --- a/test/autoplan-capy-e2e.test.ts +++ b/test/autoplan-capy-e2e.test.ts @@ -11,6 +11,7 @@ import { afterAll, describe, expect, test } from 'bun:test'; import * as fs from 'node:fs'; import * as path from 'node:path'; +import { RESULT_CODES } from '../lib/result-codes'; import { ROOT, SMALL_PLAN } from './helpers/autoplan-run-fixture'; import { capyRunner, phaseVia, readJsonl, readRunJson, writePlan, type CapyRunner } from './helpers/autoplan-capy'; @@ -151,7 +152,9 @@ describe('conformance: one run through every mechanism', () => { expect(ok(c.ap(['answer', '--out', s.out, '--gate-rev', '1', '--reply', `${accept}b`])).stdout).toMatch(/^GATE_PENDING: p1/m); const full = ok(c.ap(['answer', '--out', s.out, '--gate-rev', '1', '--reply', 'all'])); expect(full.stdout).toMatch(new RegExp(`^APPLY: ${run}-${accept} `, 'm')); - expect(c.ap(['next', '--out', s.out]).stderr).toMatch(/\(PLAN_AMEND_PENDING\)$/m); + const pendingNext = c.ap(['next', '--out', s.out]).stderr; + expect(pendingNext).toMatch(/\(PLAN_AMEND_PENDING\)$/m); + expect(pendingNext).toContain(`; fix: ${RESULT_CODES.PLAN_AMEND_PENDING.fix} (PLAN_AMEND_PENDING)`); const v2 = path.join(s.dir, 'plan-v2.md'); fs.writeFileSync(v2, SMALL_PLAN.replace('Tests cover', 'Ship behind RETRY_BACKOFF=1, default off. Tests cover')); expect(ok(c.ap(['revise', '--out', s.out, '--plan', v2, '--incorporates', `${run}-${accept}`])).stdout).toMatch(/^AMENDMENTS: pending=none$/m); diff --git a/test/autoplan-record.test.ts b/test/autoplan-record.test.ts index 6d3d43459..9de8316c6 100644 --- a/test/autoplan-record.test.ts +++ b/test/autoplan-record.test.ts @@ -12,6 +12,7 @@ import { afterAll, describe, expect, test } from 'bun:test'; import * as fs from 'node:fs'; import * as path from 'node:path'; +import { RESULT_CODES } from '../lib/result-codes'; import { capyRunner, readJsonl, readRunJson, writePlan } from './helpers/autoplan-capy'; const r = capyRunner(); @@ -92,6 +93,7 @@ describe('submit --record', () => { const prose = submit(`INPUT: ceo ${snapshotOf(out)}\n\nThe plan looks fine overall but I have concerns.\n`); expect(prose.status).toBe(1); expect(prose.stderr).toMatch(/table.*list.*No findings\..*\(RESULT_FINDINGS_MISSING\)$/m); + expect(prose.stderr).toContain(`; fix: ${RESULT_CODES.RESULT_FINDINGS_MISSING.fix} (RESULT_FINDINGS_MISSING)`); const two = submit(`${list(snapshotOf(out))}\n${TABLE}`); expect(two.status).toBe(1); expect(two.stderr).toMatch(/more than one findings shape.*\(RESULT_FINDINGS_MISSING\)$/m); diff --git a/test/autoplan-revise.test.ts b/test/autoplan-revise.test.ts index 55c920c40..1f7034536 100644 --- a/test/autoplan-revise.test.ts +++ b/test/autoplan-revise.test.ts @@ -12,6 +12,7 @@ import { afterAll, describe, expect, test } from 'bun:test'; import * as fs from 'node:fs'; import * as path from 'node:path'; +import { RESULT_CODES } from '../lib/result-codes'; import { SMALL_PLAN } from './helpers/autoplan-run-fixture'; import { capyRunner, phaseVia, readJsonl, readRunJson, writePlan } from './helpers/autoplan-capy'; @@ -131,6 +132,7 @@ describe('revise', () => { const res = r.ap(['revise', '--out', s.out, ...args]); expect(res.status).toBe(3); expect(res.stderr).toMatch(/d1b is not a pending amendment \(pending: none\).*\(AMENDMENT_UNKNOWN\)$/m); + expect(res.stderr).toContain(`; fix: ${RESULT_CODES.AMENDMENT_UNKNOWN.fix} (AMENDMENT_UNKNOWN)`); expect(res.stderr).not.toContain('PLAN_AMEND_PENDING'); expect(res.stderr).not.toContain('edit the plan'); }