Skip to content

fix(cargo-gamma-unsafe): avoid clippy::fn_to_numeric_cast_any on the MSRV toolchain - #112

Open
Pato Sandaña (psandana) wants to merge 2 commits into
mainfrom
psandana/fix-msrv-clippy-and-sdl-eslint-baseline
Open

fix(cargo-gamma-unsafe): avoid clippy::fn_to_numeric_cast_any on the MSRV toolchain#112
Pato Sandaña (psandana) wants to merge 2 commits into
mainfrom
psandana/fix-msrv-clippy-and-sdl-eslint-baseline

Conversation

@psandana

Copy link
Copy Markdown
Contributor

What broke

The OxidizerOxToolsGitHub.PublishEachCommit run 40252163 failed on main (95089c5, "Introduce cargo-gamma (#93)") in two independent places:

  1. Cargo clippy -- Build and Test {dev,release} on linux
    error: casting function pointer `record` to `*const ()`
      --> crates/cargo-gamma-unsafe/src/interrupt.rs:683:62
      = note: `-D clippy::fn-to-numeric-cast-any` implied by `-D warnings`
    
  2. Guardian: Post Analysis -- SDLSources
    ESLint Error @microsoft/sdl/no-inner-html
      crates/cargo-gamma-lib/src/vendor/mutation-test-elements.js (lines 2, 4, 89)
    Guardian exited with an error exit code: 8
    

Root causes and fixes

1. clippy fn_to_numeric_cast_any (MSRV-only)

The publish pipeline builds with RUST_MSRV = 1.95 (constants.env), and clippy 1.95 flags the record as *const () sub-cast in the dying_resets_the_disposition_to_the_default_before_re_raising test. Clippy 1.97 (RUST_LATEST) no longer flags the pointer form, which is why it passed the RUST_LATEST checks and only broke on the MSRV leg.

Fixed by widening the handler the way the production install_with and the sibling every_terminal_signal_is_armed_to_survive_its_own_delivery test already do -- record as extern "C" fn(i32) as usize under #[expect(clippy::fn_to_numeric_cast_any, ...)]. That form trips the lint identically on 1.95 and 1.97, so the expectation stays fulfilled on both toolchains.

2. SDL ESLint no-inner-html on vendored JS

mutation-test-elements.js is the minified mutation-testing-elements 3.9.0 bundle, vendored and inlined via include_str! for offline report rendering. The SDL ESLint tool (which runs with --no-ignore, so a plain .eslintignore is not honored) flags its innerHTML/insertAdjacentHTML usage and breaks Guardian.

Fixed by adding the repo-root guardian_baselines.gdnbaselines the pipeline already looks for -- it logged "Baselines file expected at ...\guardian_baselines.gdnbaselines but not found" -- mirroring ox-sdk. It baselines exactly those three findings by the Guardian signatures the failing run emitted.

Reproduction and verification

  • Installed the matching toolchain and reproduced the exact clippy error with clippy 0.1.95 targeting x86_64-unknown-linux-gnu (the interrupt module is #[cfg(unix)], so it only surfaces on the linux leg; the windows legs were green).
  • After the fix, cargo clippy --all-targets --all-features -- -D warnings on cargo-gamma-unsafe is clean on 1.95 and 1.97, dev and release (linux target).
  • cargo +nightly-2026-01-21 fmt --check and cargo heather (license headers) both pass.

Fixes the failures in build 40252163.

/cc Martin Taillefer (@geeknoid)

Pato Sandaña and others added 2 commits August 28, 2026 21:06
…MSRV toolchain

The `dying_resets_the_disposition_to_the_default_before_re_raising` test
installed its handler with `record as *const () as libc::sighandler_t`.
Clippy 1.95 -- the RUST_MSRV toolchain the publish pipeline builds with --
flags the `record as *const ()` sub-cast under
`clippy::fn_to_numeric_cast_any`, so `-D warnings` broke `Build and Test`
on linux for both dev and release. Newer clippy (1.97, RUST_LATEST) no
longer flags the pointer form, which is why it passed local checks.

Widen the function the same way `install_with` and the sibling
`every_terminal_signal_is_armed_to_survive_its_own_delivery` test already
do -- `record as extern "C" fn(i32) as usize` under an
`#[expect(clippy::fn_to_numeric_cast_any, ...)]` -- which the lint fires
on identically across 1.95 and 1.97, keeping the expectation fulfilled on
both toolchains.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ff5a5cc-ea89-4c8e-a67a-ab83c17b8224
The SDLSources stage's ESLint tool flags `innerHTML`/`insertAdjacentHTML`
usage (`@microsoft/sdl/no-inner-html`) inside
`crates/cargo-gamma-lib/src/vendor/mutation-test-elements.js`, the
minified mutation-testing-elements 3.9.0 bundle we inline via
`include_str!` for offline report rendering. Those three errors broke the
Guardian post-analysis step of the publish pipeline.

The bundle is vendored third-party code we edit only by re-vendoring, so
add the repo-root `guardian_baselines.gdnbaselines` the publish pipeline
already looks for (mirroring ox-sdk), suppressing exactly those three
findings by their Guardian signatures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ff5a5cc-ea89-4c8e-a67a-ab83c17b8224
Copilot AI lite review requested due to automatic review settings August 29, 2026 01:08

Copilot AI left a comment

Copy link
Copy Markdown

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 fixes two pipeline breaks introduced with cargo-gamma: an MSRV-only clippy lint in cargo-gamma-unsafe tests and a Guardian SDL ESLint failure on a vendored JS bundle used by cargo-gamma-lib.

Changes:

  • Adjusts the test-only signal-handler cast to match the production install_with approach and keep clippy::fn_to_numeric_cast_any expectations stable across MSRV/latest.
  • Adds a repo-root guardian_baselines.gdnbaselines to baseline SDL ESLint @microsoft/sdl/no-inner-html findings originating from the vendored, minified mutation-test-elements.js bundle.

Reviewed changes

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

File Description
guardian_baselines.gdnbaselines Adds Guardian baselines for ESLint findings on vendored JS to unblock SDLSources in Guardian.
crates/cargo-gamma-unsafe/src/interrupt.rs Updates a test to use a consistent, expected function-to-integer handler conversion for libc::signal on MSRV clippy.

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

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.7%. Comparing base (95089c5) to head (79cda22).

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #112   +/-   ##
=====================================
  Coverage   97.7%   97.7%           
=====================================
  Files        286     286           
  Lines      62174   62175    +1     
=====================================
+ Hits       60751   60753    +2     
+ Misses      1423    1422    -1     
Flag Coverage Δ
linux 94.5% <100.0%> (?)
linux-arm 94.5% <100.0%> (?)
windows 94.7% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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