Skip to content

Commit 1aef003

Browse files
henrymercerCopilot
andcommitted
Address review feedback on overlay disk flags
Document each minimum disk feature flag individually and replace the tuple list with an explicit feature-to-threshold mapping. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 508b83b commit 1aef003

3 files changed

Lines changed: 47 additions & 30 deletions

File tree

lib/entry-points.js

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config-utils.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,21 @@ export { type Config } from "./config/action-config";
103103
* variable.
104104
*
105105
* This threshold can be lowered by the feature flags in
106-
* `OVERLAY_MINIMUM_DISK_SPACE_FEATURES`.
106+
* `OVERLAY_MINIMUM_DISK_SPACE_MB_BY_FEATURE`.
107107
*/
108108
const OVERLAY_MINIMUM_AVAILABLE_DISK_SPACE_MB = 14000;
109109

110110
/**
111-
* Feature flags that lower the minimum available disk space required to perform
112-
* overlay analysis, paired with the threshold (in MB) that each one enables.
113-
*
114-
* If several of these are enabled, the lowest threshold takes effect.
111+
* Minimum available disk space (in MB) enabled by each overlay feature flag.
115112
*/
116-
const OVERLAY_MINIMUM_DISK_SPACE_FEATURES: ReadonlyArray<
117-
[FeatureWithoutCLI, number]
118-
> = [
119-
[Feature.OverlayAnalysisMinDisk8Gb, 8000],
120-
[Feature.OverlayAnalysisMinDisk9Gb, 9000],
121-
[Feature.OverlayAnalysisMinDisk10Gb, 10000],
122-
[Feature.OverlayAnalysisMinDisk11Gb, 11000],
123-
[Feature.OverlayAnalysisMinDisk12Gb, 12000],
124-
[Feature.OverlayAnalysisMinDisk13Gb, 13000],
125-
];
113+
const OVERLAY_MINIMUM_DISK_SPACE_MB_BY_FEATURE = {
114+
[Feature.OverlayAnalysisMinDisk8Gb]: 8000,
115+
[Feature.OverlayAnalysisMinDisk9Gb]: 9000,
116+
[Feature.OverlayAnalysisMinDisk10Gb]: 10000,
117+
[Feature.OverlayAnalysisMinDisk11Gb]: 11000,
118+
[Feature.OverlayAnalysisMinDisk12Gb]: 12000,
119+
[Feature.OverlayAnalysisMinDisk13Gb]: 13000,
120+
} satisfies Partial<Record<FeatureWithoutCLI, number>>;
126121

127122
/**
128123
* The minimum memory (in MB) that must be available for CodeQL to perform overlay analysis. If
@@ -606,8 +601,10 @@ async function getMinimumDiskSpaceMb(
606601
features: FeatureEnablement,
607602
): Promise<number> {
608603
let minimumMb = OVERLAY_MINIMUM_AVAILABLE_DISK_SPACE_MB;
609-
for (const [feature, thresholdMb] of OVERLAY_MINIMUM_DISK_SPACE_FEATURES) {
610-
if (await features.getValue(feature)) {
604+
for (const [feature, thresholdMb] of Object.entries(
605+
OVERLAY_MINIMUM_DISK_SPACE_MB_BY_FEATURE,
606+
)) {
607+
if (await features.getValue(feature as FeatureWithoutCLI)) {
611608
minimumMb = Math.min(minimumMb, thresholdMb);
612609
}
613610
}

src/feature-flags.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,34 @@ export enum Feature {
122122
*/
123123
OverlayAnalysisMatchCodeqlVersionDryRun = "overlay_analysis_match_codeql_version_dry_run",
124124
/**
125-
* Feature flags that lower the amount of available disk space that the overlay hardware check
126-
* requires. The lowest threshold that is enabled takes effect; if none are enabled, the default
127-
* threshold applies. These flags have no effect if `OverlayAnalysisSkipResourceChecks` is
128-
* enabled.
125+
* Lowers the overlay minimum available disk space to 8 GB. The lowest enabled limit wins; if
126+
* none are enabled, the default applies.
129127
*/
130128
OverlayAnalysisMinDisk8Gb = "overlay_analysis_min_disk_8_gb",
129+
/**
130+
* Lowers the overlay minimum available disk space to 9 GB. The lowest enabled limit wins; if
131+
* none are enabled, the default applies.
132+
*/
131133
OverlayAnalysisMinDisk9Gb = "overlay_analysis_min_disk_9_gb",
134+
/**
135+
* Lowers the overlay minimum available disk space to 10 GB. The lowest enabled limit wins; if
136+
* none are enabled, the default applies.
137+
*/
132138
OverlayAnalysisMinDisk10Gb = "overlay_analysis_min_disk_10_gb",
139+
/**
140+
* Lowers the overlay minimum available disk space to 11 GB. The lowest enabled limit wins; if
141+
* none are enabled, the default applies.
142+
*/
133143
OverlayAnalysisMinDisk11Gb = "overlay_analysis_min_disk_11_gb",
144+
/**
145+
* Lowers the overlay minimum available disk space to 12 GB. The lowest enabled limit wins; if
146+
* none are enabled, the default applies.
147+
*/
134148
OverlayAnalysisMinDisk12Gb = "overlay_analysis_min_disk_12_gb",
149+
/**
150+
* Lowers the overlay minimum available disk space to 13 GB. The lowest enabled limit wins; if
151+
* none are enabled, the default applies.
152+
*/
135153
OverlayAnalysisMinDisk13Gb = "overlay_analysis_min_disk_13_gb",
136154
OverlayAnalysisPython = "overlay_analysis_python",
137155
OverlayAnalysisRuby = "overlay_analysis_ruby",

0 commit comments

Comments
 (0)