diff --git a/tests/snapshots/provider/translate-path.json b/tests/snapshots/provider/translate-path.json index 8ed47f3202..b0c191092e 100644 --- a/tests/snapshots/provider/translate-path.json +++ b/tests/snapshots/provider/translate-path.json @@ -730,10 +730,10 @@ "Authorization": "Bearer ", "Content-Type": "application/json", "HTTP-Referer": "https://cline.bot", - "User-Agent": "OmniRoute/0.0.0", + "User-Agent": "OmniRoute/", "X-CLIENT-TYPE": "omniroute", - "X-CLIENT-VERSION": "0.0.0", - "X-CORE-VERSION": "0.0.0", + "X-CLIENT-VERSION": "", + "X-CORE-VERSION": "", "X-IS-MULTIROOT": "false", "X-PLATFORM": "linux", "X-PLATFORM-VERSION": "", @@ -743,10 +743,10 @@ "Authorization": "Bearer ", "Content-Type": "application/json", "HTTP-Referer": "https://cline.bot", - "User-Agent": "OmniRoute/0.0.0", + "User-Agent": "OmniRoute/", "X-CLIENT-TYPE": "omniroute", - "X-CLIENT-VERSION": "0.0.0", - "X-CORE-VERSION": "0.0.0", + "X-CLIENT-VERSION": "", + "X-CORE-VERSION": "", "X-IS-MULTIROOT": "false", "X-PLATFORM": "linux", "X-PLATFORM-VERSION": "", @@ -757,10 +757,10 @@ "Authorization": "Bearer ", "Content-Type": "application/json", "HTTP-Referer": "https://cline.bot", - "User-Agent": "OmniRoute/0.0.0", + "User-Agent": "OmniRoute/", "X-CLIENT-TYPE": "omniroute", - "X-CLIENT-VERSION": "0.0.0", - "X-CORE-VERSION": "0.0.0", + "X-CLIENT-VERSION": "", + "X-CORE-VERSION": "", "X-IS-MULTIROOT": "false", "X-PLATFORM": "linux", "X-PLATFORM-VERSION": "", diff --git a/tests/unit/provider-translate-path-golden.test.ts b/tests/unit/provider-translate-path-golden.test.ts index 9b1708b227..e9eec891b9 100644 --- a/tests/unit/provider-translate-path-golden.test.ts +++ b/tests/unit/provider-translate-path-golden.test.ts @@ -33,6 +33,13 @@ const OAUTH_CRED = { accessToken: "tok-test-ACCESS", providerSpecificData: {} }; // (process.versions.node) forms are collapsed to . const NODE_VERSION = typeof process !== "undefined" ? process.version : ""; const NODE_VERSION_BARE = typeof process !== "undefined" ? (process.versions?.node ?? "") : ""; +// The OmniRoute app version also leaks into headers (cline X-CLIENT-VERSION / +// X-CORE-VERSION = clineAuth APP_VERSION = process.env.npm_package_version || +// "0.0.0"). It is "0.0.0" under a direct `node` run (Unit Tests shard) but the real +// package version under `npx`/`npm run` (Coverage shard), so it must be normalized +// too — mirror clineAuth's resolution and collapse it to . +const APP_VERSION = + (typeof process !== "undefined" ? process.env.npm_package_version : "") || "0.0.0"; function sanitize(headers: Record): Record { const out: Record = {}; @@ -48,6 +55,7 @@ function sanitize(headers: Record): Record { .replace(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, ""); if (NODE_VERSION) s = s.split(NODE_VERSION).join(""); if (NODE_VERSION_BARE) s = s.split(NODE_VERSION_BARE).join(""); + if (APP_VERSION) s = s.split(APP_VERSION).join(""); out[k] = s; } return out;