Skip to content

Rust: remove shipped feature flag #2960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Rust: remove shipped feature flag #2960

wants to merge 3 commits into from

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Jul 3, 2025

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@redsun82 redsun82 marked this pull request as ready for review July 4, 2025 14:41
@Copilot Copilot AI review requested due to automatic review settings July 4, 2025 14:41
@redsun82 redsun82 requested a review from a team as a code owner July 4, 2025 14:41
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

if (
config.languages.includes(Language.rust) &&
!(await codeql.resolveLanguages()).rust
!(await codeql.resolveLanguages()).rust // means codeql already supports rust without any intervention
Copy link
Member

Choose a reason for hiding this comment

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

Minor: I'd prefer this comment to be part of the comment above the if rather than at the end of this line, if you think that it is needed at all.

@@ -588,32 +587,25 @@ async function run() {
core.exportVariable(bmnVar, value);
}

// For rust: set CODEQL_ENABLE_EXPERIMENTAL_FEATURES, unless codeql already supports rust without it
// For rust, if running a version prior to public preview (2.22.1) set CODEQL_ENABLE_EXPERIMENTAL_FEATURES
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure that this comment accurately describes what is currently implemented. As far as I can tell you check whether the actual CLI version is less than minVer and if so throw a ConfigurationError. That means we never get to the CODEQL_ENABLE_EXPERIMENTAL_FEATURES check.

If that is the case, and that behaviour is unintentional, then you should obviously fix it, but I'd also like to perhaps see this refactored with a test to make sure it does the right thing.

Copy link
Contributor Author

@redsun82 redsun82 Aug 4, 2025

Choose a reason for hiding this comment

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

there are 2 versions involved:

  • prior to 2.19.3, there is no rust support whatsoever, which means that if we are requesting rust we indeed need to throw a configuration error
  • between 2.19.3 and 2.22.1, rust support is experimental, which means the variable needs to be set explicitly. What I now see, is that if !(await codeql.resolveLanguages()).rust, that actually entails already that CODEQL_ENABLE_EXPERIMENTAL_FEATURES is not set, otherwise codeql resolve languages would provide an entry for rust, which makes the process.env[envVar] !== "true" check redundant.
  • after 2.22.1, (await codeql.resolveLanguages()).rust will always be set

If we forego the "Experimental Rust analysis enabled" log line entirely (there's probably no burning need for it), we can simplify by getting rid of the second if. And the comment needs a rewrite to be clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm considering to just not mention the 2.19.3 range, and go for a simple Rust analysis is supported from version 2.22.1. No need for the general public to know about the experimental phase I guess

Copy link
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

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

I think this is OK to merge if you are happy to break Rust analyses for those older versions of the CLI. See my thoughts in the comment I added. There's also one typo in the comment.

// * either we run `codeql` prior to 2.19.3, which means no rust support is possible
// * or we run a version between 2.19.3 and 2.22.1 (excluded), when rust support was
// experimental and required explicitly setting CODEQL_ENABLE_EXPERIMENTAL_FEATURES
// However, there is not need to let users know about the experimental feature flag at
Copy link
Member

Choose a reason for hiding this comment

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

Typo: this should read "no need", rather than "not need"

Comment on lines +637 to +638
// this point, if they want rust support they should chose a version which supports it
// publicly.
Copy link
Member

Choose a reason for hiding this comment

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

This might break Rust analysis for users who have pinned v3 (or similar) of the Action as well as a CodeQL CLI >= 2.19.3 && < 2.22.1 and who used CODEQL_ENABLE_EXPERIMENTAL_FEATURES. I agree that it's not unreasonable to ask users to upgrade to a newer CLI version in that case, but perhaps we should give them some warning first before breaking their workflows over night when the next Action release happens? That said, it's not clear to me that a warning in the output would necessarily be noticed. I don't know if we have any data to know how many people would be affected.

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.

2 participants