From 40f80a8df09be2b1e7aed995af3abca5f5ffbce1 Mon Sep 17 00:00:00 2001 From: Mario Campos Date: Tue, 11 Aug 2026 17:59:08 -0500 Subject: [PATCH] Rename type to better match generic intention --- lib/entry-points.js | 4 ++-- src/cli/output-cache.ts | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index ecd5385df..2de9797e9 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -146278,7 +146278,7 @@ function getCachedCodeQlVersion(cmd, env = getEnv()) { } catch { return void 0; } - if (!isPersistedVersionInfo(persisted) || cmd !== void 0 && persisted.cmd !== cmd) { + if (!isCommandCacheRecord(persisted) || cmd !== void 0 && persisted.cmd !== cmd) { return void 0; } cachedCodeQlVersion = persisted.entries["version" /* Version */]; @@ -146288,7 +146288,7 @@ function isVersionInfo(x) { const candidate = x; return typeof candidate === "object" && candidate !== null && typeof candidate.version === "string" && (candidate.features === void 0 || typeof candidate.features === "object" && candidate.features !== null) && (candidate.overlayVersion === void 0 || typeof candidate.overlayVersion === "number"); } -function isPersistedVersionInfo(x) { +function isCommandCacheRecord(x) { const candidate = x; return typeof candidate === "object" && candidate !== null && typeof candidate.cmd === "string" && candidate.entries !== void 0 && isVersionInfo(candidate.entries["version" /* Version */]); } diff --git a/src/cli/output-cache.ts b/src/cli/output-cache.ts index 5fcca2cd4..e6b665b71 100644 --- a/src/cli/output-cache.ts +++ b/src/cli/output-cache.ts @@ -20,8 +20,10 @@ type CommandCacheKeyOutputMap = { [CommandCacheKey.Version]: VersionInfo; }; -/** The persisted version together with the CLI path it was obtained from. */ -interface PersistedVersionInfo { +/** + * The type of the command cache that is persisted to disk. + */ +interface CommandCacheRecord { cmd: string; entries: Map; } @@ -107,7 +109,7 @@ export function getCachedCodeQlVersion( return undefined; } if ( - !isPersistedVersionInfo(persisted) || + !isCommandCacheRecord(persisted) || (cmd !== undefined && persisted.cmd !== cmd) ) { return undefined; @@ -137,14 +139,14 @@ function isVersionInfo(x: unknown): x is VersionInfo { } /** - * Determines whether a value is a `PersistedVersionInfo` object. + * Determines whether a value is a `CommandCacheRecord` object. * @param x The value to test */ -function isPersistedVersionInfo( +function isCommandCacheRecord( x: unknown, -): x is PersistedVersionInfo { +): x is CommandCacheRecord { const candidate = x as Partial< - PersistedVersionInfo + CommandCacheRecord > | null; return ( typeof candidate === "object" &&