From 126166c21209f7c4537f0bd342c2b5907460e656 Mon Sep 17 00:00:00 2001 From: Mario Campos Date: Fri, 19 Jun 2026 15:07:56 -0500 Subject: [PATCH] Rename `CacheEntry` to `CommandCacheEntry` for consistency --- src/cache.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cache.ts b/src/cache.ts index e0d50c0cd..a9fbbc47c 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -21,7 +21,7 @@ export type CommandCacheKey = (typeof CommandCacheKey)[keyof typeof CommandCacheKey]; /** A single cached command output together with the CLI path it came from. */ -interface CacheEntry { +interface CommandCacheEntry { /** * The path to the CodeQL CLI that produced `output`. Persisted so that a * different step using a different CodeQL bundle doesn't pick up a stale @@ -36,7 +36,7 @@ interface CacheEntry { * whenever a value is read from the file (tier 2) or computed via the CLI * (tier 3). */ -const inMemoryCache = new Map(); +const inMemoryCache = new Map(); function getCommandCacheFilePath(): string { return path.join(getTemporaryDirectory(), COMMAND_CACHE_FILENAME); @@ -46,7 +46,7 @@ function getCommandCacheFilePath(): string { * Reads and parses the temporary cache file. Best-effort: a missing, malformed, * or otherwise unreadable file is treated as an empty cache. */ -function readCommandCacheFile(): Record { +function readCommandCacheFile(): Record { let contents: string; try { contents = fs.readFileSync(getCommandCacheFilePath(), "utf8"); @@ -68,7 +68,7 @@ function readCommandCacheFile(): Record { * Persists the cache to the temporary file. Best-effort: a failure to write * just means a later step re-runs the CLI. */ -function writeCommandCacheFile(data: Record): void { +function writeCommandCacheFile(data: Record): void { try { fs.writeFileSync(getCommandCacheFilePath(), JSON.stringify(data)); } catch { @@ -94,7 +94,7 @@ export function cacheCommandOutput( `cacheCommandOutput() should be called only once per key, but was called more than once for '${key}'.`, ); } - const entry: CacheEntry = { cmd, output }; + const entry: CommandCacheEntry = { cmd, output }; inMemoryCache.set(key, entry); const data = readCommandCacheFile(); @@ -127,7 +127,7 @@ export function getCachedCommandOutput( // Tier 2: the temporary file persisted by an earlier step, if any. const entry = readCommandCacheFile()[key] as unknown; if ( - !json.isObject(entry) || + !json.isObject(entry) || !json.isString(entry.cmd) || (cmd !== undefined && entry.cmd !== cmd) || (validate !== undefined && !validate(entry.output))