fix(cargo-gamma-unsafe): avoid clippy::fn_to_numeric_cast_any on the MSRV toolchain - #112
Conversation
…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
There was a problem hiding this comment.
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_withapproach and keepclippy::fn_to_numeric_cast_anyexpectations stable across MSRV/latest. - Adds a repo-root
guardian_baselines.gdnbaselinesto baseline SDL ESLint@microsoft/sdl/no-inner-htmlfindings originating from the vendored, minifiedmutation-test-elements.jsbundle.
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 Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (97.7%) is below the target coverage (100.0%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #112 +/- ##
=======================================
- Coverage 97.7% 97.7% -0.1%
=======================================
Files 286 286
Lines 62257 62190 -67
=======================================
- Hits 60830 60763 -67
Misses 1427 1427
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Guardian rejects every entry under `results` whose `createdDate` is empty, so the baseline added in #112 was loaded but applied to nothing: Baselines: guardian-baseline ##[error]The CreatedDate of the result with signature <76fd7a25...> is empty. ##[error]The CreatedDate of the result with signature <6c2296c1...> is empty. ##[error]The CreatedDate of the result with signature <c4f9dd26...> is empty. ... Active results: 3 Baselined results: 0 ##[error]Error: Guardian exited with an error exit code: 8 The three rejected signatures are exactly the three @microsoft/sdl/no-inner-html findings in the vendored mutation-testing-elements bundle that the baseline was meant to cover, so `Guardian: Post Analysis` has broken every OxidizerOxToolsGitHub.PublishEachCommit run on main since 95089c5. `createdDate` is a required property on each result, not just on the baseline object. The ox-sdk baseline this file mirrors carries it on every result, between `ruleId` and `justification`; that field was dropped when this file was hand-authored rather than emitted by the Guardian CLI. Add it, using the same timestamp as the baseline itself. No `expirationDate` is set: these findings are in a vendored, minified third-party bundle that changes only by re-vendoring, so the baseline should not silently lapse and re-break the build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
What broke
The
OxidizerOxToolsGitHub.PublishEachCommitrun 40252163 failed onmain(95089c5, "Introduce cargo-gamma (#93)") in two independent places:Cargo clippy--Build and Test {dev,release} on linuxGuardian: Post Analysis--SDLSourcesRoot 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 therecord as *const ()sub-cast in thedying_resets_the_disposition_to_the_default_before_re_raisingtest. Clippy 1.97 (RUST_LATEST) no longer flags the pointer form, which is why it passed theRUST_LATESTchecks and only broke on the MSRV leg.Fixed by widening the handler the way the production
install_withand the siblingevery_terminal_signal_is_armed_to_survive_its_own_deliverytest already do --record as extern "C" fn(i32) as usizeunder#[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-htmlon vendored JSmutation-test-elements.jsis the minified mutation-testing-elements 3.9.0 bundle, vendored and inlined viainclude_str!for offline report rendering. The SDL ESLint tool (which runs with--no-ignore, so a plain.eslintignoreis not honored) flags itsinnerHTML/insertAdjacentHTMLusage and breaks Guardian.Fixed by adding the repo-root
guardian_baselines.gdnbaselinesthe pipeline already looks for -- it logged "Baselines file expected at ...\guardian_baselines.gdnbaselines but not found" -- mirroringox-sdk. It baselines exactly those three findings by the Guardian signatures the failing run emitted.Reproduction and verification
x86_64-unknown-linux-gnu(the interrupt module is#[cfg(unix)], so it only surfaces on the linux leg; the windows legs were green).cargo clippy --all-targets --all-features -- -D warningsoncargo-gamma-unsafeis clean on 1.95 and 1.97, dev and release (linux target).cargo +nightly-2026-01-21 fmt --checkandcargo heather(license headers) both pass.Fixes the failures in build 40252163.
/cc Martin Taillefer (@geeknoid)