Skip to content

Commit 0470aa6

Browse files
committed
fix(test): keep full session-store/paths exports in compaction override mock
The cross-provider auth cases drive buildEmbeddedCompactionRuntimeContext, whose import graph also pulls the re-exported resolveSessionStoreEntry from config/sessions/store.js. The partial mock dropped it, so the full CI shard's eager module evaluation threw a missing-export error. Spread the real store and paths modules and override only the mocked I/O entry points.
1 parent 53bd78f commit 0470aa6

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

src/agents/embedded-agent-runner/compaction-live-model-override.test.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,30 @@ vi.mock("../model-selection.js", async () => {
2828
};
2929
});
3030

31-
vi.mock("../../config/sessions/store.js", () => ({
32-
loadSessionStore: (...args: unknown[]) => state.loadSessionStoreMock(...args),
33-
updateSessionStore: (...args: unknown[]) => state.updateSessionStoreMock(...args),
34-
}));
31+
// Spread the real modules and override only the I/O entry points: the
32+
// compaction-runtime-context import graph also pulls other store/paths exports
33+
// (e.g. the re-exported resolveSessionStoreEntry), and a partial mock that
34+
// drops them throws under the full CI shard's eager module evaluation.
35+
vi.mock("../../config/sessions/store.js", async () => {
36+
const actual = await vi.importActual<typeof import("../../config/sessions/store.js")>(
37+
"../../config/sessions/store.js",
38+
);
39+
return {
40+
...actual,
41+
loadSessionStore: (...args: unknown[]) => state.loadSessionStoreMock(...args),
42+
updateSessionStore: (...args: unknown[]) => state.updateSessionStoreMock(...args),
43+
};
44+
});
3545

36-
vi.mock("../../config/sessions/paths.js", () => ({
37-
resolveStorePath: (...args: unknown[]) => state.resolveStorePathMock(...args),
38-
}));
46+
vi.mock("../../config/sessions/paths.js", async () => {
47+
const actual = await vi.importActual<typeof import("../../config/sessions/paths.js")>(
48+
"../../config/sessions/paths.js",
49+
);
50+
return {
51+
...actual,
52+
resolveStorePath: (...args: unknown[]) => state.resolveStorePathMock(...args),
53+
};
54+
});
3955

4056
import { normalizeProviderId } from "@openclaw/model-catalog-core/provider-id";
4157
import { shouldSwitchToLiveModel } from "../live-model-switch.js";

0 commit comments

Comments
 (0)