0.2.0 Track D: WASM lint coverage — fix static_mut_refs + bazel build CI job#26
Merged
Conversation
Each monitor crate's Cargo [lib] points at plain/src/lib.rs, so cargo clippy/fmt never see src/wasm_component.rs. Only Bazel compiles those files. Two regressions slipped through that gap: * `static mut TABLE` + `&'static mut` accessor — Rust 2024 static_mut_refs lint * unused `pub const MAX_OUTPUT_QUEUE` in wohl-alert/src/wasm_component.rs Fixes: * Replace the static-mut singleton in all six wasm_component.rs files with `OnceLock<Mutex<T>>` + a `with_table(|t| ...)` helper. Single unsafe-free idiom across leak/temp/air/door/power/alert. WASM components are single-threaded so the Mutex is uncontended; this is the simplest defensible pattern on stable. * Delete unused MAX_OUTPUT_QUEUE in wohl-alert/src/wasm_component.rs (plain/src/engine.rs + src/engine.rs copies are out of scope for this change — they live behind the Verus/Kani gate). * Add a `bazel-build` CI job that runs `bazel build //:all` from `wohl/`. Mirrors the verus job's checkout + nix-install + setup-bazel pattern. This exercises every rust_wasm_component_bindgen target on wasm32-wasip2 and catches future drift in rules_wasm_component or the wasm_component.rs files before it ships. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes out the WASM-binding hygiene items in #14. Two parts:
static_mut_refs(Rust 2024) in all 6 wasm_component.rs files. Replaces thestatic mut TABLE: Option<...>+fn get_table() -> &'static mut ...pattern withOnceLock<Mutex<T>>+ awith_table(|t| ...)closure helper. Stable, nounsafe, no nightly, no new deps. Identical idiom across all 6 crates.bazel-buildCI job that runsbazel build //:all— exercises the 6rust_wasm_component_bindgentargets so future drift inrules_wasm_component(or in these files) is caught at the gate. Mirrors the Verus job's pattern: pinnedrelay+rules_wasm_componentsiblings withfetch-depth: 0, pinnedcachix/install-nix-actionSHA,bazel-contrib/setup-bazel@0.15.0.Also removes the dead
pub const MAX_OUTPUT_QUEUE: usize = 16;fromcrates/wohl-alert/src/wasm_component.rs.Why this matters
Each monitor crate's
[lib]points atplain/src/lib.rs, so cargo's--workspaceclippy/fmt never seessrc/wasm_component.rs. Until now the WASM-binding glue had zero lint coverage. The newbazel build //:alljob is the standing gate, and thestatic_mut_refsfix removes the existing offender so the gate goes green on day 1.Verified locally
cargo +1.85.0 clippy --workspace --all-targets -- -D warnings— clean (no regression — cargo still doesn't see these files; sanity-check that nothing else broke).cargo test --workspace --offline— clean.bazel build //:allcould not be run locally (no nix on this dev host); the new CI job is the verification path.Open follow-ups
rustfmtthem.bazel-buildjob pullsrelayeven though//:allmay not require it; kept for symmetry + future-proofing. Could be trimmed once proven unnecessary.MAX_OUTPUT_QUEUEstill exists incrates/wohl-alert/plain/src/engine.rs:23andcrates/wohl-alert/src/engine.rs:19— those are behind the Verus/Kani gate (verified source) and explicitly out-of-scope for this lint PR.🤖 Generated with Claude Code