test(session): continue catalog backfill after unavailable evidence

Isolated complete/incomplete-child tests did not distinguish skipping one child
from prematurely stopping the entire candidate loop. A stop could therefore
silently omit a later child's fully supported catalog fact.

Pair a complete child with an older unavailable child so deterministic ordering
processes the unavailable evidence first. Cover missing, unsupported-version,
and multiple-descriptor evidence, requiring exactly the complete child's fact
with the correct sequence and timestamp.

A temporary continue-to-break mutation failed all three new cases. Restoring
the implementation passed the focused 19 cases and the complete selected owner
run: 428 passed, one compression-specific skip, with 100% coverage on facts.ts
and migration.ts. This commit changes tests only.
This commit is contained in:
Tianyi Cui committed 2026-09-19 17:17:29 +08:00
1 parent e838401a9b
commit 869367d5d0
1 file changed
+10
@@ -142,6 +142,16 @@ describe('V3 parent catalog completion', () => {
expect(() => migrate(source, [{ ...evidence, childCreatedAt: 3 }])).toThrow('conflicts')
})
it.each(['missing', 'unknown', 'multiple'] as const)('continues catalog backfill after %s child evidence', (kind) => {
const descriptor: SessionFormatJsonValue = kind === 'missing' ? null : kind === 'unknown' ? { version: 99 }
: { version: 3, mode: 'one-shot', provider: 'spawn' }
const unavailable = { childId: 'unavailable', childCreatedAt: 1,
descriptorCount: kind === 'missing' ? 0 : kind === 'multiple' ? 2 : 1, descriptor }
expect(migrate([], [child, unavailable]).events).toEqual([
{ type: 'subagent/catalog', seq: 0, time: 1, data: child },
])
})
it('refuses malformed supplemental evidence and known descriptor conflicts', () => {
for (const source of [null, {}, { childId: 'child', childCreatedAt: 2, descriptor: null, descriptorCount: -1 }]) {
expect(() => migrate([], [source])).toThrow()