From 6a3db40e52285e793f7fd0e54a39ddcbb328b21a Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 27 Jul 2026 17:52:40 +0800 Subject: [PATCH] test(ci): register the inheritance fixture with knip; close two coverage gaps - knip: the subagent-inheritance resume fixture is a Loader-loaded entry (the semantic-checkpoint-agent precedent), invisible to import analysis. - coordinator coverage: a quiet-signal observation read pins the success arm of observeQueuedAbort, and an approval-only baseline pins the other arm of the seed-boundary guard's baseline disjunction. --- knip.json | 1 + .../session-persistence/tests/contract.ts | 16 +++++++++++++++ .../tests/coordinator-contract.ts | 20 +++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/knip.json b/knip.json index 110abb3a2b..adb7c65a8f 100644 --- a/knip.json +++ b/knip.json @@ -29,6 +29,7 @@ "entry": [ "headless-agent/tests/fixtures/cli-mock-llm.ts", "headless-agent/tests/fixtures/semantic-checkpoint-agent.ts", + "headless-agent/tests/fixtures/subagent-inheritance-agent.ts", "headless-agent/tests/fixtures/goal-domain/seed-goal.ts", "headless-agent/tests/fixtures/time-context-driver.ts", "headless-agent/tests/fixtures/time-context-mock-llm.ts", diff --git a/packages/session-persistence/session-persistence/tests/contract.ts b/packages/session-persistence/session-persistence/tests/contract.ts index 4508e0ccaa..61ddc12dfb 100644 --- a/packages/session-persistence/session-persistence/tests/contract.ts +++ b/packages/session-persistence/session-persistence/tests/contract.ts @@ -268,6 +268,22 @@ export function runPersistenceContract(name: string, make: () => Promise { + const { persistence, dispose } = await make() + try { + // The abort observer must not swallow an ordinary success: a signal + // that stays quiet leaves the queued operation's resolution intact. + const m = meta('signal-quiet-inspect', '/work') + await persistence.create(m) + await persistence.append(m.id, oneTurnLog()) + const controller = new AbortController() + await expect(persistence.inspect(m.id, controller.signal)) + .resolves.toMatchObject({ meta: { id: m.id } }) + } finally { + await dispose() + } + }) + it('rejects pre-aborted observation reads with the exact cancellation reason', async () => { const { persistence, dispose } = await make() try { diff --git a/packages/session-persistence/session-persistence/tests/coordinator-contract.ts b/packages/session-persistence/session-persistence/tests/coordinator-contract.ts index a82ef525ec..5c6d5bcf85 100644 --- a/packages/session-persistence/session-persistence/tests/coordinator-contract.ts +++ b/packages/session-persistence/session-persistence/tests/coordinator-contract.ts @@ -728,6 +728,26 @@ export function runCoordinatorContract(name: string, makeFixture: () => Promise< } }) + it('an approval-only baseline also pins the seed boundary (the other baseline arm)', async () => { + const fix = await makeFixture() + const { ctx, fiber } = await freshCtx(fix) + try { + // The boundary guard triggers off EITHER baseline: a stored header + // with only approvalPolicy (no sandboxMode, no seedLength) must still + // reject a live twin whose boundary differs. + await ctx.sessionPersistence.create({ ...meta('approval-boundary-conflict', WORK), approvalPolicy: 'never' }) + await ctx.sessionPersistence.append(SessionId('approval-boundary-conflict'), oneTurnLog()) + const live = ctx.sessions.create(SessionId('approval-boundary-conflict'), { + seed: oneTurnLog(), + meta: { cwd: WORK, approvalPolicy: 'never', seedLength: 2 }, + }) + await expect(ctx.sessions.flush(live)).rejects.toThrow(/seed boundary|id collision/) + } finally { + await fiber.dispose() + await fix.cleanup() + } + }) + it('a no-cwd ownerless state cannot be claimed by a live session WITH a cwd (cwd scope, undefined side)', async () => { const fix = await makeFixture() const { ctx, fiber } = await freshCtx(fix)