feat(changes): pass opencode evidence mode

This commit is contained in:
777genius 2026-04-28 17:57:01 +03:00
parent 051bfe2319
commit 8da5b7f25d
4 changed files with 21 additions and 0 deletions

View file

@ -46,6 +46,7 @@ import type { AgentChangeSet, ChangeStats, TaskChangeSetV2 } from '@shared/types
const logger = createLogger('Service:ChangeExtractorService');
const OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE = 'strict-delivery' as const;
const OPEN_CODE_AUTO_BACKFILL_EVIDENCE_MODE = 'chain-only' as const;
const OPEN_CODE_MAX_DISCOVERED_LANES = 500;
/** Кеш-запись: данные + mtime файла + время протухания */
@ -425,6 +426,7 @@ export class ChangeExtractorService {
sourceGeneration,
deliveryContextFingerprint,
attributionMode: OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE,
evidenceMode: OPEN_CODE_AUTO_BACKFILL_EVIDENCE_MODE,
});
const now = Date.now();
const cached = this.openCodeBackfillCache.get(cacheKey);
@ -499,6 +501,7 @@ export class ChangeExtractorService {
projectDir,
workspaceRoot,
attributionMode: OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE,
evidenceMode: OPEN_CODE_AUTO_BACKFILL_EVIDENCE_MODE,
...(deliveryContext.filePath ? { deliveryContextPath: deliveryContext.filePath } : {}),
});
void appendOpenCodeTaskChangeDiag({
@ -838,6 +841,7 @@ export class ChangeExtractorService {
sourceGeneration?: string | null;
deliveryContextFingerprint: string;
attributionMode: typeof OPEN_CODE_AUTO_BACKFILL_ATTRIBUTION_MODE;
evidenceMode: typeof OPEN_CODE_AUTO_BACKFILL_EVIDENCE_MODE;
}): string {
return JSON.stringify({
teamName: input.teamName,
@ -848,6 +852,7 @@ export class ChangeExtractorService {
sourceGeneration: input.sourceGeneration ?? '',
deliveryContextFingerprint: input.deliveryContextFingerprint,
attributionMode: input.attributionMode,
evidenceMode: input.evidenceMode,
});
}

View file

@ -240,10 +240,17 @@ export interface OpenCodeBackfillTaskLedgerCommandBody {
workspaceRoot?: string;
deliveryContextPath?: string;
attributionMode?: OpenCodeBackfillTaskLedgerAttributionMode;
evidenceMode?: OpenCodeBackfillTaskLedgerEvidenceMode;
dryRun?: boolean;
}
export type OpenCodeBackfillTaskLedgerAttributionMode = 'strict-delivery' | 'compatible';
export type OpenCodeBackfillTaskLedgerEvidenceMode =
| 'off'
| 'metadata-only'
| 'chain-only'
| 'snapshot-probe'
| 'snapshot-auto';
export type OpenCodeBackfillTaskLedgerOutcome =
| 'imported'
@ -264,6 +271,12 @@ export interface OpenCodeBackfillTaskLedgerCommandData {
workspaceRoot?: string;
dryRun: boolean;
attributionMode?: OpenCodeBackfillTaskLedgerAttributionMode;
evidenceMode?: OpenCodeBackfillTaskLedgerEvidenceMode;
strictWindowCandidateCount?: number;
openCodeDbFingerprint?: string;
deliveryLedgerFingerprint?: string;
snapshotShapeFingerprint?: string;
retryAfterReason?: string;
scannedSessions: number;
scannedToolparts: number;
candidateEvents: number;

View file

@ -308,6 +308,7 @@ export class OpenCodeReadinessBridge implements OpenCodeTeamRuntimeBridgePort {
...(input.workspaceRoot ? { workspaceRoot: input.workspaceRoot } : {}),
dryRun: input.dryRun === true,
...(input.attributionMode ? { attributionMode: input.attributionMode } : {}),
...(input.evidenceMode ? { evidenceMode: input.evidenceMode } : {}),
scannedSessions: 0,
scannedToolparts: 0,
candidateEvents: 0,

View file

@ -1058,6 +1058,7 @@ describe('ChangeExtractorService', () => {
projectDir,
workspaceRoot: projectPath,
attributionMode: 'strict-delivery',
evidenceMode: 'chain-only',
})
);
expect(workerClient.computeTaskChanges).not.toHaveBeenCalled();
@ -1182,6 +1183,7 @@ describe('ChangeExtractorService', () => {
workspaceRoot: projectPath,
deliveryContextPath: expect.stringContaining('delivery-context.json'),
attributionMode: 'strict-delivery',
evidenceMode: 'chain-only',
})
);
});