mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 04:15:48 -06:00
49cd6009cc
`server.sessions.compaction-read-errors` mocks `config/sessions/session-accessor.sqlite-read.js`, but production reaches `loadTranscriptEvents` through re-exports: `server-methods/sessions-compact.ts` imports it from the `session-accessor.js` barrel and `preflightSessionTranscriptForManualCompact` imports it from the leaf. The `gateway-server` project is `isolate: false`, so when a neighbour has already evaluated those importers they stay bound to the real implementation and the mock never fires -- the injected read error simply does not happen and all three tests fail with `expected true to be false`, reading like a product regression. Trigger:33744584f3added `server.chat-metadata-boundary.test.ts`, which boots a full non-minimal Gateway in `beforeAll` and lands immediately before this file in the shard. Main has gone red on it repeatedly since (32338154086, 32339521003, 32339928383, 32341300955, 32341946296);e294c154a6fixed only the sibling symptom where the factory had not run yet. Route the file to a new `gateway-server-isolated` project instead, mirroring `unit-fast-isolated` -- whose comment describes this exact hazard. A fresh graph per file makes both symptoms structurally impossible rather than order-dependent. The list is explicit so the reason travels with the file. Not reproducible on macOS: the exact 24-file stripe in CI's own order, and the triggering pair three times, are green locally every time.
51 lines
2.0 KiB
JavaScript
51 lines
2.0 KiB
JavaScript
// Canonical file ownership for the non-isolated Gateway server Vitest project.
|
|
export const gatewayServerBackedHttpTestFiles = [
|
|
"src/gateway/embeddings-http.test.ts",
|
|
"src/gateway/models-http.test.ts",
|
|
"src/gateway/openai-http.test.ts",
|
|
"src/gateway/openresponses-http.test.ts",
|
|
"src/gateway/probe.auth.integration.test.ts",
|
|
];
|
|
|
|
// Gateway server tests that replace a module the Gateway reaches only through
|
|
// re-exports. `gateway-server` is `isolate: false`, so a neighbour that boots a
|
|
// full Gateway leaves those importers bound to the real implementation and the
|
|
// mock silently never fires. These run in `gateway-server-isolated` instead,
|
|
// which gives each file a fresh module graph.
|
|
export const gatewayServerIsolatedTestFiles = [
|
|
"src/gateway/server.sessions.compaction-read-errors.test.ts",
|
|
];
|
|
|
|
export const gatewayServerExcludedTestFiles = [
|
|
"src/gateway/gateway.test.ts",
|
|
"src/gateway/server.startup-matrix-migration.integration.test.ts",
|
|
"src/gateway/sessions-history-http.test.ts",
|
|
];
|
|
|
|
const gatewayServerBackedHttpTestFileSet = new Set(gatewayServerBackedHttpTestFiles);
|
|
const gatewayServerExcludedTestFileSet = new Set(gatewayServerExcludedTestFiles);
|
|
const gatewayServerIsolatedTestFileSet = new Set(gatewayServerIsolatedTestFiles);
|
|
|
|
export function isGatewayServerBackedHttpTestFile(file) {
|
|
return gatewayServerBackedHttpTestFileSet.has(file.replaceAll("\\", "/"));
|
|
}
|
|
|
|
export function isGatewayServerTestFile(file) {
|
|
const normalized = file.replaceAll("\\", "/");
|
|
if (
|
|
gatewayServerExcludedTestFileSet.has(normalized) ||
|
|
gatewayServerIsolatedTestFileSet.has(normalized) ||
|
|
normalized.startsWith("src/gateway/server-methods/") ||
|
|
normalized.endsWith(".e2e.test.ts")
|
|
) {
|
|
return false;
|
|
}
|
|
const basename = normalized.slice(normalized.lastIndexOf("/") + 1);
|
|
return (
|
|
isGatewayServerBackedHttpTestFile(normalized) ||
|
|
(normalized.startsWith("src/gateway/") &&
|
|
basename.includes("server") &&
|
|
normalized.endsWith(".test.ts"))
|
|
);
|
|
}
|