From a630174341ff843f92f3065d7aa61c3904ebeef8 Mon Sep 17 00:00:00 2001 From: Andrey Avtomonov Date: Mon, 18 May 2026 00:27:19 +0200 Subject: [PATCH] test(ingest): align textual conflict failure coverage --- .../src/ingest/ingest-bundle.runner.isolated-diff.test.ts | 4 ++++ .../context/src/ingest/isolated-diff/patch-integrator.test.ts | 4 ++-- .../ingest/isolated-diff/textual-conflict-resolver.test.ts | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/context/src/ingest/ingest-bundle.runner.isolated-diff.test.ts b/packages/context/src/ingest/ingest-bundle.runner.isolated-diff.test.ts index 5223099f..adfd26aa 100644 --- a/packages/context/src/ingest/ingest-bundle.runner.isolated-diff.test.ts +++ b/packages/context/src/ingest/ingest-bundle.runner.isolated-diff.test.ts @@ -486,6 +486,9 @@ describe('IngestBundleRunner isolated diff path', () => { return { toRuntimeTools: vi.fn(() => ({})) }; }); deps.agentRunner.runLoop = vi.fn(async (params: any) => { + if (params.telemetryTags.operationName === 'ingest-isolated-diff-textual-resolver') { + return { stopReason: 'natural' }; + } const suffix = params.telemetryTags.unitKey === 'orders-a' ? 'a' : 'b'; const root = rootOfConfig(currentSession.configService, runtime.configDir); await mkdir(join(root, 'semantic-layer/warehouse'), { recursive: true }); @@ -509,6 +512,7 @@ describe('IngestBundleRunner isolated diff path', () => { ).rejects.toThrow(/isolated diff textual conflict/); const trace = await readFile(join(runtime.configDir, '.ktx/ingest-traces/job-text-conflict/trace.jsonl'), 'utf-8'); expect(trace).toContain('patch_textual_conflict'); + expect(trace).toContain('textual_conflict_resolver_failed'); } finally { await rm(runtime.homeDir, { recursive: true, force: true }); } diff --git a/packages/context/src/ingest/isolated-diff/patch-integrator.test.ts b/packages/context/src/ingest/isolated-diff/patch-integrator.test.ts index c5d2e9b0..1af5b6fa 100644 --- a/packages/context/src/ingest/isolated-diff/patch-integrator.test.ts +++ b/packages/context/src/ingest/isolated-diff/patch-integrator.test.ts @@ -222,7 +222,7 @@ describe('integrateWorkUnitPatch', () => { }); await writeFile(join(configDir, 'wiki/global/a.md'), 'accepted\nproposal\n', 'utf-8'); return { - status: 'repaired', + status: 'repaired' as const, attempts: 1, changedPaths: ['wiki/global/a.md'], }; @@ -281,7 +281,7 @@ describe('integrateWorkUnitPatch', () => { allowedTargetConnectionIds: new Set(['warehouse']), validateAppliedTree: vi.fn(async () => {}), resolveTextualConflict: vi.fn(async () => ({ - status: 'failed', + status: 'failed' as const, attempts: 1, reason: 'resolver completed without editing an allowed path', })), diff --git a/packages/context/src/ingest/isolated-diff/textual-conflict-resolver.test.ts b/packages/context/src/ingest/isolated-diff/textual-conflict-resolver.test.ts index d96df329..ae5b4e21 100644 --- a/packages/context/src/ingest/isolated-diff/textual-conflict-resolver.test.ts +++ b/packages/context/src/ingest/isolated-diff/textual-conflict-resolver.test.ts @@ -60,7 +60,7 @@ describe('resolveTextualConflict', () => { path: 'wiki/global/account.md', content: 'accepted line\nproposal line\n', }); - return { stopReason: 'natural' }; + return { stopReason: 'natural' as const }; }), }; @@ -100,7 +100,7 @@ describe('resolveTextualConflict', () => { it('fails when the repair agent completes without editing any touched path', async () => { const { workdir, patchPath, trace } = await makeHarness(); const result = await resolveTextualConflict({ - agentRunner: { runLoop: vi.fn(async () => ({ stopReason: 'natural' })) }, + agentRunner: { runLoop: vi.fn(async () => ({ stopReason: 'natural' as const })) }, workdir, unitKey: 'wu-a', patchPath,