test(e2e): complete the embedding.ts mock export surface for the cycle-sync import path

The wave's sync changes make the cycle sync phase lazily import
commands/sync.ts, whose static embedding.ts imports must all resolve
against the test's module mock (a missing name is a load-time
SyntaxError). Stubs mirror the real pure functions.
This commit is contained in:
test
2026-08-12 14:38:36 -07:00
committed by Sina Matian
parent dcad42534e
commit 447f81956d
@@ -48,6 +48,16 @@ mock.module('../../src/core/embedding.ts', () => ({
estimateEmbeddingCostUsd: (tokens: number) => (tokens / 1000) * 0.00013,
// v0.41.31: embed phase reads the current signature to stamp provenance.
currentEmbeddingSignature: () => 'text-embedding-3-large:1536',
// The cycle sync phase reaches commands/sync.ts, whose static embedding.ts
// imports must all resolve against this mock (missing names are a load-time
// SyntaxError, not a runtime undefined).
currentEmbeddingPricePerMTok: () => 0.13,
willEmbedSynchronously: (opts: { v2Enabled: boolean; serialFlag: boolean; noEmbed: boolean }) => {
const effectiveNoEmbed = opts.v2Enabled && !opts.serialFlag && !opts.noEmbed ? true : opts.noEmbed;
return effectiveNoEmbed ? 'deferred' : 'inline';
},
shouldBlockSync: (costUsd: number, floorUsd: number, mode: string, posture: 'gated' | 'tokenmax' = 'gated') =>
posture === 'tokenmax' ? false : mode === 'inline' && costUsd > floorUsd,
}));
const { runCycle, ALL_PHASES } = await import('../../src/core/cycle.ts');