From 42ee0378286f52fe14778decf02af171008f81df Mon Sep 17 00:00:00 2001 From: garrytan Date: Tue, 3 Nov 2026 02:22:49 +0000 Subject: [PATCH] test(hooks): stop-hook test imports the state error line it pins (test-of-test ratchet) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- test/skill-contract-stop-hook.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/skill-contract-stop-hook.test.ts b/test/skill-contract-stop-hook.test.ts index 806d3e794..0e2996aed 100644 --- a/test/skill-contract-stop-hook.test.ts +++ b/test/skill-contract-stop-hook.test.ts @@ -7,6 +7,7 @@ import { afterEach, beforeEach, describe, expect, test } from 'bun:test'; import * as fs from 'node:fs'; import * as path from 'node:path'; +import { STATE_ERROR_DOC, stateErrorLine } from '../lib/skill-contract'; import { CONTRACT_HOOK, DEBUG_REPORT, INTERACTIVE_TURNS, J1_TRANSCRIPT, ROOT, hookEnv, result, runHook, say, skillsDir, slash, tmpDir, tool, user, } from './helpers/skill-contract-fixture'; @@ -14,6 +15,11 @@ import { const PINNED = fs.readFileSync(path.join(ROOT, 'test', 'fixtures', 'skill-contract', 'block-message.txt'), 'utf8').trimEnd(); const STATE_ERROR = /^gstack-skill-contract: SKILL_CONTRACT_STATE_ERROR .+: .+; stop allowed, miss not recorded \(see docs\/skill-routing-and-contracts\.md#state-error\)\n$/; +test('the state error line keeps its doc anchor (d9)', () => { + expect(STATE_ERROR_DOC).toBe('docs/skill-routing-and-contracts.md#state-error'); + expect(`${stateErrorLine('/x/y.json', 'corrupt record (not JSON)')}\n`).toMatch(STATE_ERROR); +}); + let state = '', skills = '', work = ''; beforeEach(() => { state = tmpDir('gstack-contract-state-');