From 6e00160897c8394efb959ec3bcdb04a9eb49b94c Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Mon, 1 Jun 2026 06:46:34 +0800 Subject: [PATCH] Version scan terminal cache key --- .../scan-terminal/__tests__/proxyCachePolicy.test.ts | 10 ++++++++++ .../dashboard/scan-terminal/scan-terminal-client.ts | 2 ++ 2 files changed, 12 insertions(+) diff --git a/frontend/components/dashboard/scan-terminal/__tests__/proxyCachePolicy.test.ts b/frontend/components/dashboard/scan-terminal/__tests__/proxyCachePolicy.test.ts index bdad23f0..eeb2d520 100644 --- a/frontend/components/dashboard/scan-terminal/__tests__/proxyCachePolicy.test.ts +++ b/frontend/components/dashboard/scan-terminal/__tests__/proxyCachePolicy.test.ts @@ -56,6 +56,16 @@ export function runTests() { /hasDirectBackendApiBaseUrl/, "public scan terminal requests should only attach user auth in direct-backend mode so CDN caches can be shared through the Next proxy", ); + assert.match( + scanTerminalClientSource, + /SCAN_TERMINAL_PAYLOAD_VERSION/, + "scan terminal client should include a stable payload version in the URL so CDN caches roll forward after response-shape optimizations", + ); + assert.match( + scanTerminalClientSource, + /params\.set\("_v",\s*SCAN_TERMINAL_PAYLOAD_VERSION\)/, + "scan terminal client should vary the CDN cache key without changing backend scan filters", + ); const overviewProxySource = fs.readFileSync( path.join( diff --git a/frontend/components/dashboard/scan-terminal/scan-terminal-client.ts b/frontend/components/dashboard/scan-terminal/scan-terminal-client.ts index c46bfcf9..c8846862 100644 --- a/frontend/components/dashboard/scan-terminal/scan-terminal-client.ts +++ b/frontend/components/dashboard/scan-terminal/scan-terminal-client.ts @@ -22,6 +22,7 @@ export const scanTerminalQueryPolicy = { autoRefreshMs: null, manualForceRefreshCooldownMs: 2 * 60_000, } as const; +const SCAN_TERMINAL_PAYLOAD_VERSION = "runway-slim-v1"; type TerminalQueryOptions = { forceRefresh?: boolean; @@ -142,6 +143,7 @@ async function getTerminal({ if (Number.isFinite(timezoneOffsetSeconds)) { params.set("timezone_offset_seconds", String(Math.trunc(Number(timezoneOffsetSeconds)))); } + params.set("_v", SCAN_TERMINAL_PAYLOAD_VERSION); if (forceRefresh) { params.set("_ts", String(Date.now())); }