test(ingest): align textual conflict failure coverage

This commit is contained in:
Andrey Avtomonov 2026-05-18 00:27:19 +02:00
parent 32288434ea
commit a630174341
3 changed files with 8 additions and 4 deletions

View file

@ -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 });
}

View file

@ -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',
})),

View file

@ -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,