From 869367d5d07dca82f110c7e0b9dcbd2f1d227ec0 Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Sat, 19 Sep 2026 14:16:36 +0800 Subject: [PATCH] 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. --- .../tests/catalog-completion.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/session/session-format-v3-to-v4/tests/catalog-completion.spec.ts b/packages/session/session-format-v3-to-v4/tests/catalog-completion.spec.ts index bac89800bf..7b1ad7e3c0 100644 --- a/packages/session/session-format-v3-to-v4/tests/catalog-completion.spec.ts +++ b/packages/session/session-format-v3-to-v4/tests/catalog-completion.spec.ts @@ -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()