test(changes): keep opencode transient backfill retryable

This commit is contained in:
777genius 2026-04-28 21:47:52 +03:00
parent c065dc703d
commit 9f785ee3b2

View file

@ -1332,24 +1332,30 @@ describe('ChangeExtractorService', () => {
'utf8' 'utf8'
); );
const backfillOpenCodeTaskLedger = vi.fn(async (input: any) => ({ let backfillAttempt = 0;
schemaVersion: 1, const backfillOpenCodeTaskLedger = vi.fn(async (input: any) => {
providerId: 'opencode', const outcome = backfillAttempt++ === 0 ? 'transient-error' : 'no-attribution';
teamName: input.teamName, return {
taskId: input.taskId, schemaVersion: 1,
projectDir: input.projectDir, providerId: 'opencode',
workspaceRoot: input.workspaceRoot, teamName: input.teamName,
dryRun: false, taskId: input.taskId,
attributionMode: input.attributionMode, projectDir: input.projectDir,
scannedSessions: 1, workspaceRoot: input.workspaceRoot,
scannedToolparts: 0, dryRun: false,
candidateEvents: 0, attributionMode: input.attributionMode,
importedEvents: 0, scannedSessions: 1,
skippedEvents: 0, scannedToolparts: 0,
outcome: 'no-attribution', candidateEvents: 0,
notices: [], importedEvents: 0,
diagnostics: [], skippedEvents: 0,
})); outcome,
notices: [],
diagnostics: outcome === 'transient-error'
? ['OpenCode SQLite file changed while snapshot was read; using transaction snapshot.']
: [],
};
});
const workerClient = { const workerClient = {
isAvailable: vi.fn(() => true), isAvailable: vi.fn(() => true),
computeTaskChanges: vi.fn(async () => computeTaskChanges: vi.fn(async () =>