Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d1bdc0e
Create separate directory for overlay source code
henrymercer Feb 17, 2026
d28d996
Compute cache key for overlay language status
henrymercer Feb 17, 2026
69c2819
Add save and restore methods
henrymercer Feb 17, 2026
e275d63
Generalise status to multiple languages
henrymercer Feb 17, 2026
ebad062
Skip overlay analysis based on cached status
henrymercer Feb 17, 2026
96961e0
Save overlay status to Actions cache
henrymercer Feb 17, 2026
827bba6
Introduce feature flags for saving and checking status
henrymercer Feb 17, 2026
6c405c2
Be more explicit about attempt to build overlay DB
henrymercer Feb 17, 2026
0c47ae1
Sort doc URLs
henrymercer Feb 17, 2026
7b7a951
Add status page diagnostic when overlay skipped
henrymercer Feb 17, 2026
ef58c00
Only store overlay status if analysis failed
henrymercer Feb 17, 2026
cc0dce0
Improve diagnostic message wording
henrymercer Feb 17, 2026
d24014a
Tweak diagnostic message
henrymercer Feb 17, 2026
3dd1275
Improve error messages
henrymercer Feb 17, 2026
554b931
More error message improvements
henrymercer Feb 17, 2026
5c583bb
Include diagnostics in bundle
henrymercer Feb 17, 2026
05d4e25
Avoid mutating languages array in overlay status functions
henrymercer Feb 17, 2026
657f337
Add tests for shouldSkipOverlayAnalysis
henrymercer Feb 17, 2026
fa56ea8
Extract status file path helper
henrymercer Feb 17, 2026
898ae16
Improve log message
henrymercer Feb 17, 2026
4191f52
Address review comments
henrymercer Feb 19, 2026
4e71011
Add feature flag for more lenient overlay resource checks
henrymercer Feb 20, 2026
1847416
Merge pull request #3498 from github/henrymercer/overlay-resource-che…
henrymercer Feb 23, 2026
dc00a6f
Improve error message
henrymercer Feb 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/overlay/status.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import test from "ava";

import { mockCodeQLVersion, setupTests } from "../testing-utils";
import { DiskUsage } from "../util";

import { getCacheKey } from "./status";

setupTests(test);

function makeDiskUsage(totalGiB: number): DiskUsage {
return {
numTotalBytes: totalGiB * 1024 * 1024 * 1024,
Comment thread
mbg marked this conversation as resolved.
numAvailableBytes: 0,
};
}

test("getCacheKey incorporates language, CodeQL version, and disk space", async (t) => {
const codeql = mockCodeQLVersion("2.20.0");
t.is(
await getCacheKey(codeql, "javascript", makeDiskUsage(50)),
"codeql-overlay-status-javascript-2.20.0-runner-50GB",
);
t.is(
await getCacheKey(codeql, "python", makeDiskUsage(50)),
"codeql-overlay-status-python-2.20.0-runner-50GB",
);
t.is(
await getCacheKey(
mockCodeQLVersion("2.21.0"),
"javascript",
makeDiskUsage(50),
),
"codeql-overlay-status-javascript-2.21.0-runner-50GB",
);
t.is(
await getCacheKey(codeql, "javascript", makeDiskUsage(100)),
"codeql-overlay-status-javascript-2.20.0-runner-100GB",
);
});

test("getCacheKey rounds disk space down to nearest 10 GiB", async (t) => {
const codeql = mockCodeQLVersion("2.20.0");
t.is(
await getCacheKey(codeql, "javascript", makeDiskUsage(14)),
"codeql-overlay-status-javascript-2.20.0-runner-10GB",
);
t.is(
await getCacheKey(codeql, "javascript", makeDiskUsage(19)),
"codeql-overlay-status-javascript-2.20.0-runner-10GB",
);
});
31 changes: 31 additions & 0 deletions src/overlay/status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* We perform enablement checks for overlay analysis to avoid using it on runners that are too small
* to support it. However these checks cannot avoid every potential issue without being overly
* conservative. Therefore, if our enablement checks enable overlay analysis for a runner that is
* too small, we want to remember that, so that we will not try to use overlay analysis until
* something changes (e.g. a larger runner is provisioned, or a new CodeQL version is released).
*
* We use the Actions cache as a lightweight way of providing this functionality.
*/
Comment thread
mbg marked this conversation as resolved.

import { type CodeQL } from "../codeql";
import { DiskUsage } from "../util";

export async function getCacheKey(
codeql: CodeQL,
language: string,
diskUsage: DiskUsage,
): Promise<string> {
// Total disk space, rounded to the nearest 10 GB. This is included in the cache key so that if a
// customer upgrades their runner, we will try again to use overlay analysis, even if the CodeQL
// version has not changed. We round to the nearest 10 GB to work around small differences in disk
// space.
//
// Limitation: this can still flip from "too small" to "large enough" and back again if the disk
// space fluctuates above and below a multiple of 10 GB.
const diskSpaceToNearest10Gb = `${10 * Math.floor(diskUsage.numTotalBytes / (10 * 1024 * 1024 * 1024))}GB`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design question: this fundamentally assumes that the CodeQL analysis typically runs on comparable runners. I.e. the assumption is that unless the amount of total disk space is increased deliberately, the runner specs are the same. Practically speaking, I'd expect that to be the case as well. However, I am not sure whether it is necessarily the case or this is an assumption we have made previously.

My concern is that, if a customer has a runner group for CodeQL containing runners with different specs, we might flip-flop on this -- I think you express that in the "Limitation" part of the comment. That wouldn't be a great experience for a customer if it happened. Is there a way we can mitigate this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, this might be something that's worth checking in telemetry before rolling this out.


// Include the CodeQL version in the cache key so we will try again to use overlay analysis when
// new queries and libraries that may be more efficient are released.
return `codeql-overlay-status-${language}-${(await codeql.getVersion()).version}-runner-${diskSpaceToNearest10Gb}`;
}