Skip to content

Conversation

nickrolfe
Copy link
Contributor

@nickrolfe nickrolfe commented Oct 7, 2025

We have a check that a traced language can only run overlay analysis with build-mode: none, but Go does not currently declare support for BMN, even though it has a similar autobuild mode that will work for overlay analysis.

This commit adds a hard-coded exception to that check, allowing any build mode for Go. This is intended as a short-term solution until Go declares BMN support.

For now, it should be safe to enable for all build modes:

  • We can still control rollout, via the overlay feature flags, to repos we know will work correctly.
  • It allows us to see what happens for manual builds.
  • We should be able to ensure that the Go extractor/autobuilder fail for unsupported build configures in such a way that we fall back to full analysis.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Which use cases does this change impact?

  • Advanced setup - Impacts users who have custom workflows.
  • Default setup - Impacts users who use default setup.
  • Code Scanning - Impacts Code Scanning (i.e. analysis-kinds: code-scanning).
  • Code Quality - Impacts Code Quality (i.e. analysis-kinds: code-quality).

How did/will you validate this change?

  • None - I am not validating these changes specifically, but I have been testing overlay analysis for Go in general.

If something goes wrong after this change is released, what are the mitigation and rollback strategies?

  • Feature flags - All new or changed code paths can be fully disabled with corresponding feature flags.

How will you know if something goes wrong after this change is released?

  • Telemetry - I rely on existing telemetry or have made changes to the telemetry.
    • Dashboards - I will watch relevant dashboards for issues after the release. Consider whether this requires this change to be released at a particular time rather than as part of a regular release.
    • Alerts - New or existing monitors will trip if something goes wrong with this change.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

@nickrolfe nickrolfe marked this pull request as ready for review October 7, 2025 11:52
@nickrolfe nickrolfe requested a review from a team as a code owner October 7, 2025 11:52
@Copilot Copilot AI review requested due to automatic review settings October 7, 2025 11:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a workaround to allow Go overlay analysis to work with any build mode, bypassing the normal restriction that requires build-mode: none for traced languages. The change introduces a hard-coded exception for Go since it doesn't currently declare Build Mode None (BMN) support but has equivalent autobuild capabilities.

Key changes:

  • Added Go-specific exception in overlay database mode validation
  • Modified the traced language check to exclude Go from the build mode restriction

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/config-utils.ts Added Go exception in getOverlayDatabaseMode function to bypass build mode validation
lib/init-action.js Generated JavaScript equivalent of the TypeScript changes

Comment on lines 728 to 732
l !== KnownLanguage.go && // Workaround to allow overlay analysis for Go with any build
// mode, since it does not support BMN.
(await codeql.isTracedLanguage(l)),
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

The hard-coded Go exception creates a maintenance burden and breaks the logical flow. Consider extracting this logic into a helper function like shouldCheckBuildModeForLanguage(language) to improve readability and make future language exceptions easier to manage.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

You mention:

even though it has a similar autobuild mode that will work for overlay analysis

but this PR enables overlay for workflows using manual build steps too. Will those setups work too with overlay?

We have a check that a traced language can only run overlay analysis
with build-mode: none, but Go does not currently declare support for
BMN, even though it has a similar autobuild mode that will work for
overlay analysis.

This commit adds a hard-coded exception to that check, allowing any
build mode for Go. This is intended as a short-term solution until Go
declares BMN support. It should be safe, since we can choose not to
enable the feature flag for Go repos using traced builds.
@nickrolfe nickrolfe force-pushed the nickrolfe/go-overlay branch from d2af337 to 7892cb2 Compare October 7, 2025 16:45
@nickrolfe
Copy link
Contributor Author

I've updated the PR description and code comment to mention that the Go extractor/autobuilder will aim to ensure that we fall back to full analysis for build setups that won't work with overlays.

Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

Thanks for the extra context!

@nickrolfe nickrolfe merged commit 7bdfa97 into main Oct 8, 2025
239 checks passed
@nickrolfe nickrolfe deleted the nickrolfe/go-overlay branch October 8, 2025 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants