Sfoglia il codice sorgente

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.
kingwl 2 mesi fa
parent
commit
6a3db40e52

+ 1 - 0
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",

+ 16 - 0
packages/session-persistence/session-persistence/tests/contract.ts

@@ -268,6 +268,22 @@ export function runPersistenceContract(name: string, make: () => Promise<Contrac
       }
     })
 
+    it('resolves an observation read normally when its signal never aborts', async () => {
+      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 {

+ 20 - 0
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)