Skip to content

Commit af56b04

Browse files
authored
Merge pull request #2550 from github/henrymercer/fix-ff-name
Fix name of Python stdlib extraction feature flag
2 parents c470063 + 5d314b7 commit af56b04

9 files changed

+53
-24
lines changed

lib/feature-flags.js

+10-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/feature-flags.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/feature-flags.test.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/feature-flags.test.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js

+5-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/feature-flags.test.ts

+11
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,17 @@ test("non-legacy feature flags should not end with _enabled", async (t) => {
495495
}
496496
});
497497

498+
test("non-legacy feature flags should not start with codeql_action_", async (t) => {
499+
for (const [feature, config] of Object.entries(featureConfig)) {
500+
if (!config.legacyApi) {
501+
t.false(
502+
feature.startsWith("codeql_action_"),
503+
`non-legacy feature ${feature} should not start with 'codeql_action_'`,
504+
);
505+
}
506+
}
507+
});
508+
498509
function assertAllFeaturesUndefinedInApi(
499510
t: ExecutionContext<unknown>,
500511
loggedMessages: LoggedMessage[],

src/feature-flags.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,20 @@ export interface FeatureEnablement {
4242
/**
4343
* Feature enablement as returned by the GitHub API endpoint.
4444
*
45+
* Do not include the `codeql_action_` prefix as this is stripped by the API
46+
* endpoint.
47+
*
4548
* Legacy features should end with `_enabled`.
4649
*/
4750
export enum Feature {
4851
ArtifactV4Upgrade = "artifact_v4_upgrade",
4952
CleanupTrapCaches = "cleanup_trap_caches",
50-
CodeqlActionPythonDefaultIsToNotExtractStdlib = "codeql_action_python_default_is_to_not_extract_stdlib",
5153
CppDependencyInstallation = "cpp_dependency_installation_enabled",
5254
DisableCsharpBuildless = "disable_csharp_buildless",
5355
DisableJavaBuildlessEnabled = "disable_java_buildless_enabled",
5456
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
5557
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
58+
PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib",
5659
QaTelemetryEnabled = "qa_telemetry_enabled",
5760
ZstdBundle = "zstd_bundle",
5861
ZstdBundleStreamingExtraction = "zstd_bundle_streaming_extraction",
@@ -99,12 +102,6 @@ export const featureConfig: Record<
99102
envVar: "CODEQL_ACTION_CLEANUP_TRAP_CACHES",
100103
minimumVersion: undefined,
101104
},
102-
[Feature.CodeqlActionPythonDefaultIsToNotExtractStdlib]: {
103-
defaultValue: false,
104-
envVar: "CODEQL_ACTION_DISABLE_PYTHON_STANDARD_LIBRARY_EXTRACTION",
105-
minimumVersion: undefined,
106-
toolsFeature: ToolsFeature.PythonDefaultIsToNotExtractStdlib,
107-
},
108105
[Feature.CppDependencyInstallation]: {
109106
defaultValue: false,
110107
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
@@ -134,6 +131,12 @@ export const featureConfig: Record<
134131
legacyApi: true,
135132
minimumVersion: undefined,
136133
},
134+
[Feature.PythonDefaultIsToNotExtractStdlib]: {
135+
defaultValue: false,
136+
envVar: "CODEQL_ACTION_DISABLE_PYTHON_STANDARD_LIBRARY_EXTRACTION",
137+
minimumVersion: undefined,
138+
toolsFeature: ToolsFeature.PythonDefaultIsToNotExtractStdlib,
139+
},
137140
[Feature.QaTelemetryEnabled]: {
138141
defaultValue: false,
139142
envVar: "CODEQL_ACTION_QA_TELEMETRY",

src/init-action.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -594,15 +594,18 @@ async function run() {
594594
ToolsFeature.PythonDefaultIsToNotExtractStdlib,
595595
)
596596
) {
597-
// We are in the case where the default has switched to not extracting the stdlib.
598-
if (
597+
if (process.env["CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB"]) {
598+
logger.debug(
599+
"CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB is already set, so the Action will not override it.",
600+
);
601+
} else if (
599602
!(await features.getValue(
600-
Feature.CodeqlActionPythonDefaultIsToNotExtractStdlib,
603+
Feature.PythonDefaultIsToNotExtractStdlib,
601604
codeql,
602605
))
603606
) {
604607
// We are in a situation where the feature flag is not rolled out,
605-
// so we need to suppress the new default behavior.
608+
// so we need to suppress the new default CLI behavior.
606609
core.exportVariable("CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB", "true");
607610
}
608611
}

0 commit comments

Comments
 (0)