Skip to content

fix(ci): build full workspace for CodeQL Rust scan - #229

Closed
jpage-godaddy wants to merge 2 commits into
mainfrom
codeql-rust-warning
Closed

fix(ci): build full workspace for CodeQL Rust scan#229
jpage-godaddy wants to merge 2 commits into
mainfrom
codeql-rust-warning

Conversation

@jpage-godaddy

@jpage-godaddy jpage-godaddy commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • CodeQL's Rust code-scanning quality warning flagged low call-target (35%, threshold 50%) and known-type (48%, threshold 20%) resolution.
  • Two CI-hygiene fixes landed here, both legitimate improvements independent of the metric outcome:
    1. rust/Cargo.toml is a mixed package+workspace root with no default-members, so cargo build only ever built the root godaddy-cli package — tools/generate-api-catalog and all test targets/dev-dependencies were never compiled. Switched to cargo build --workspace --all-targets.
    2. dtolnay/rust-toolchain@stable installs the minimal rustup profile (no rust-src), which looked like a plausible cause for widespread macro-expansion failures. Added components: rust-src.
  • Neither change affected the quality metrics. Three scans (baseline, post-build-fix, post-rust-src-fix) produced byte-for-byte identical results: 35%/48%, 135/17 files with/without extraction errors, and exactly 2,800 macro-expansion failures for ordinary macros (format!, vec!, assert!/assert_eq!, json!). Digging into the Analyze job log: CodeQL's Rust extractor runs its own indexing pass independent of the workflow's Build step, and its internal config shows sysroot_src: None / proc_macro_server: None even after confirming rust-src was actually installed — it isn't picking up the active toolchain's sysroot at all. This looks like a current limitation of the bundled Rust extractor (already on the latest codeql-bundle-v2.26.3) rather than something fixable from our side.

Test plan

  • cargo build --workspace --all-targets succeeds locally and in CI, now compiling generate-api-catalog, test binaries, and dev-dependencies that previously weren't built.
  • Confirmed via three separate CodeQL runs that the database quality metrics are unaffected by either change — documented above rather than claimed as fixed.

cargo build in a mixed package+workspace root only builds the root
package, silently skipping tools/generate-api-catalog and all test
targets/dev-dependencies. CodeQL's Rust database quality metrics flag
low call-target/type resolution partly due to that incomplete build.
Copilot AI lite review requested due to automatic review settings August 24, 2026 23:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the CodeQL Rust workflow build step to compile the entire Rust workspace (including all targets) so CodeQL can observe more dependencies and improve database quality metrics for analysis.

Changes:

  • Switch CodeQL build step from cargo build to cargo build --workspace --all-targets to compile all workspace members and targets during tracing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The Analyze job's own CodeQL log showed sysroot_src/proc_macro_server
unset and ~2800 macro-expansion failures across 135/152 files for
completely ordinary macros (format!, vec!, assert!, json!) — the
minimal rustup profile installed by dtolnay/rust-toolchain has no
rust-src, so CodeQL's semantic analyzer has no std-library source to
resolve against. The prior --workspace --all-targets build fix left
the quality metrics byte-for-byte unchanged, confirming the Rust
extractor performs its own indexing pass independent of the workflow's
Build step.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@jpage-godaddy

Copy link
Copy Markdown
Collaborator Author

Closing; these changes did not fix the CodeQL warning they were meant to address. Will evaluate later if CodeQL is useful at all for Rust.

@jpage-godaddy
jpage-godaddy deleted the codeql-rust-warning branch August 25, 2026 00:54
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