Skip to content

Commit

Permalink
Fix name of Python stdlib extraction feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
henrymercer committed Oct 17, 2024
1 parent c470063 commit d591d17
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 19 deletions.
17 changes: 10 additions & 7 deletions lib/feature-flags.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/feature-flags.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions lib/feature-flags.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/feature-flags.test.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/init-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/init-action.js.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/feature-flags.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,17 @@ test("non-legacy feature flags should not end with _enabled", async (t) => {
}
});

test("non-legacy feature flags should not start with codeql_action_", async (t) => {
for (const [feature, config] of Object.entries(featureConfig)) {
if (!config.legacyApi) {
t.false(
feature.startsWith("codeql_action_"),
`non-legacy feature ${feature} should not start with 'codeql_action_'`,
);
}
}
});

function assertAllFeaturesUndefinedInApi(
t: ExecutionContext<unknown>,
loggedMessages: LoggedMessage[],
Expand Down
17 changes: 10 additions & 7 deletions src/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,20 @@ export interface FeatureEnablement {
/**
* Feature enablement as returned by the GitHub API endpoint.
*
* Do not include the `codeql_action_` prefix as this is stripped by the API
* endpoint.
*
* Legacy features should end with `_enabled`.
*/
export enum Feature {
ArtifactV4Upgrade = "artifact_v4_upgrade",
CleanupTrapCaches = "cleanup_trap_caches",
CodeqlActionPythonDefaultIsToNotExtractStdlib = "codeql_action_python_default_is_to_not_extract_stdlib",
CppDependencyInstallation = "cpp_dependency_installation_enabled",
DisableCsharpBuildless = "disable_csharp_buildless",
DisableJavaBuildlessEnabled = "disable_java_buildless_enabled",
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib",
QaTelemetryEnabled = "qa_telemetry_enabled",
ZstdBundle = "zstd_bundle",
ZstdBundleStreamingExtraction = "zstd_bundle_streaming_extraction",
Expand Down Expand Up @@ -99,12 +102,6 @@ export const featureConfig: Record<
envVar: "CODEQL_ACTION_CLEANUP_TRAP_CACHES",
minimumVersion: undefined,
},
[Feature.CodeqlActionPythonDefaultIsToNotExtractStdlib]: {
defaultValue: false,
envVar: "CODEQL_ACTION_DISABLE_PYTHON_STANDARD_LIBRARY_EXTRACTION",
minimumVersion: undefined,
toolsFeature: ToolsFeature.PythonDefaultIsToNotExtractStdlib,
},
[Feature.CppDependencyInstallation]: {
defaultValue: false,
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
Expand Down Expand Up @@ -134,6 +131,12 @@ export const featureConfig: Record<
legacyApi: true,
minimumVersion: undefined,
},
[Feature.PythonDefaultIsToNotExtractStdlib]: {
defaultValue: false,
envVar: "CODEQL_ACTION_DISABLE_PYTHON_STANDARD_LIBRARY_EXTRACTION",
minimumVersion: undefined,
toolsFeature: ToolsFeature.PythonDefaultIsToNotExtractStdlib,
},
[Feature.QaTelemetryEnabled]: {
defaultValue: false,
envVar: "CODEQL_ACTION_QA_TELEMETRY",
Expand Down
2 changes: 1 addition & 1 deletion src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ async function run() {
// We are in the case where the default has switched to not extracting the stdlib.
if (
!(await features.getValue(
Feature.CodeqlActionPythonDefaultIsToNotExtractStdlib,
Feature.PythonDefaultIsToNotExtractStdlib,
codeql,
))
) {
Expand Down

0 comments on commit d591d17

Please sign in to comment.