Skip to content

Bring workspace to clippy-clean + fmt-clean baseline#2

Merged
avrabe merged 8 commits into
mainfrom
cleanup/fmt-clippy-kanicfg
May 19, 2026
Merged

Bring workspace to clippy-clean + fmt-clean baseline#2
avrabe merged 8 commits into
mainfrom
cleanup/fmt-clippy-kanicfg

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 19, 2026

Summary

Mechanical, semantics-preserving cleanup of the wohl workspace so a future cargo fmt --check + cargo clippy -D warnings CI merge gate can land cleanly. No behavior changes; all 92 tests pass, Kani verified on all 6 components (20 harnesses total).

This is PR 1a of 2 for the foundation work — PR 1b (#TBD) will introduce the CI workflow itself, README, and CLAUDE.md drift fix. Issue #1 is closed by PR 1b, not this one.

⚠ Merge order: PR #4 (sync of unpushed local-main commits) must merge first. Independent reviewers flagged that this PR's diff currently bundles those 5 commits because origin/main was 5 commits behind local main. After PR #4 merges, this PR's diff will auto-shrink to the three commits actually authored here (3f2f524 cleanup + d06c553 reasons + 5a44e87 reason-pointer fix).

What changed

Workspace lints (modern Rust check-cfg idiom):

  • Root Cargo.toml: [workspace.lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] }
  • Each of the 8 crates: [lints] workspace = true
  • Eliminates 6× "unexpected cfg(kani)" warnings without scattering #[allow] attributes

Clippy fixes (all 6 monitor crates):

Lint Count Crates
missing Default impl 6 all monitors
x = x + 1+= 9 leak, temp, alert
manual abs-diff → .abs_diff() 1 power
index-loop → .iter().enumerate() 1 air
collapsible nested if 3 door (×2), hub (×1)

wohl-hub dead-code (judgment-based, with load-bearing reason = "..." per architect review):

  • #[allow(dead_code, reason = "...")] on 5 TOML config structs and ALERT_HEALTH_MISS — reasons connect each suppression to specific follow-up work (Track D Verus, scheduler thread at spar/wohl_system.aadl:207, TOML schema surface)
  • #[cfg(test)] on config_from_str (only called from tests)
  • Deleted contact_zone method — truly unused, no callers anywhere

Format sweep:

  • cargo fmt --all reformatted 8 files with pre-existing drift (engine.rs files + wohl-hub/main.rs)
  • wohl-integration/src/lib.rs was incidentally swept as well

Verification

Check Result Verified by
cargo fmt --all --check clean author
cargo clippy --workspace --all-targets -- -D warnings clean author
cargo test --workspace --all-features 92 passed, 0 failed author
cargo kani -p wohl-leak 4/4 verified author
cargo kani -p wohl-temp 3/3 verified independent reviewer
cargo kani -p wohl-air 3/3 verified independent reviewer
cargo kani -p wohl-door 3/3 verified independent reviewer
cargo kani -p wohl-power 3/3 verified author
cargo kani -p wohl-alert 4/4 verified independent reviewer

All 20 Kani harnesses across 6 monitors PASS post-cleanup. Verification status preserved.

Reviewer feedback addressed

Out of scope

  • CI workflow / README / CLAUDE.md drift fix — PR 1b (next)
  • Verus proofs for wohl-alert dedup invariant — separate Track D work
  • Sibling relay/* clippy drift — visible as warnings from dependencies but not gated by this workspace's lints
  • Cargo.lock change reflects relay sibling now depending on relay-primitives and adding relay-ccsds — upstream, not authored here

Test plan

  • cargo fmt --all --check (local, macOS-aarch64)
  • cargo clippy --workspace --all-targets -- -D warnings (local)
  • cargo test --workspace --all-features (local, 92 pass)
  • cargo kani -p wohl-{leak,power} (local, 4/4 + 3/3 PASS)
  • cargo kani -p wohl-{temp,air,door,alert} (independent reviewer verified — 3/3 + 3/3 + 3/3 + 4/4 PASS)
  • Reviewer-flagged dead-code judgment calls audited (contact_zone deletion confirmed safe; config_from_str use confirmed test-only; ALERT_HEALTH_MISS retention confirmed ID-numbering-preserving)

🤖 Generated with Claude Code

avrabe and others added 6 commits April 19, 2026 12:32
Binary input mode reading 14-byte Wohl sensor packets from stdin, matching
the format Wohl sensor nodes emit. Translates SENSOR_TEMP/WATER/CONTACT/
CO2/POWER to SensorEvent; JSON mode unchanged. 6 new tests, 28 total.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Four new files under spar/:
- wohl_properties.aadl — custom property set (current, battery, radio, Zephyr binding)
- wohl_hardware.aadl — part library: nRF52840, ESP32-S3, RPi4, SHT30, BMP280, SCD41, SPS30, BH1750, reed, PIR, water probe
- wohl_nodes.aadl — DoorWindowNode/ClimateNode/AirQualityNode/HubNode impls
- wohl_home.aadl — StarterHome.Deployed wiring 3 door + 1 climate + 1 air + hub

Passes `spar parse`, `spar instance` (48 components), `spar analyze` (fault
tree correctly flags the hub as SPoF). Every sensor carries a
Zephyr_Binding for devicetree generation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds wohl_firmware.aadl with DoorFirmware/ClimateFirmware/AirFirmware
threads and NodeBootloader + OTAManager threads (the gale-boot and OTA
placeholders). Node systems now expose packet_out/image_in/attest_out
ports and wire sensor devices through the firmware process to the
radio bus. StarterHome.Deployed wires all 5 nodes to the hub for
sensor packets, OTA images, and attestation reports.

Spar instance: 62 components. Analyze: sensor data flow, OTA distri-
bution, and attestation paths are modeled. Thread→processor binding
warnings are a pre-existing Spar limitation with nested-path bindings
that also affects wohl_system.aadl.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Adds HubMonitorProcess with PacketRouter + 5 monitor threads +
  AlertDispatcher, wired inside HubNode.RPi.
- New IntelN100 processor type and HubNode.MiniPC alternate
  implementation (GMKtec/Beelink/Minisforum-style mini PC) for ML/
  local-LLM headroom when RPi is outgrown.
- Zone_Id / Zone_Name / Location / Role properties on
  DoorWindowNode/ClimateNode/AirQualityNode subcomponents in
  StarterHome.Deployed, so the model carries the sensor-to-room
  mapping today consumed from wohl.toml.
- StarterHome.DeployedMiniPC deployment mirrors Deployed with the
  MiniPC hub substituted.

(Spar instance JSON currently drops the property values — filed as
pulseengine/spar#129.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New Spar build's connection_rules checker caught temp_out/air_out/
power_out being event data ports while the monitor inputs are data
ports. Matched: periodic sensors route through data ports, sporadic
(water, contact) through event data ports.

Spar analyze is now clean on both StarterHome.Deployed and
StarterHome.DeployedMiniPC.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Prepares the codebase to satisfy a future cargo fmt + clippy -D warnings
CI merge gate. All changes are mechanical / semantics-preserving; Kani
spot-checked on wohl-leak (4/4) and wohl-power (3/3) post-cleanup.

Workspace lints
  - Cargo.toml: [workspace.lints.rust] check-cfg = ['cfg(kani)']
  - Each crate: [lints] workspace = true (8 crates)
  - Eliminates 6 unexpected_cfgs warnings without #[allow] noise

Clippy fixes across all 6 monitor crates
  - 6× added impl Default { fn default() -> Self { Self::new() } }
  - 9× manual x = x + 1 → x += 1
  - 1× manual abs-diff → watts.abs_diff(last)  (wohl-power)
  - 1× index-loop → for (i, &t) in thresholds.iter().enumerate()  (wohl-air)
  - 2× collapsible nested if → joined with &&  (wohl-door)

wohl-hub dead-code handling
  - #[allow(dead_code)] on 5 TOML config structs (public schema, fields
    not yet wired) and on ALERT_HEALTH_MISS (reserved alert ID)
  - #[cfg(test)] on config_from_str (only called from tests)
  - Deleted contact_zone method (truly unused, no callers)
  - 1× collapsible_if in process_event

cargo fmt --all sweep
  - Reformatted 8 wohl files (was pre-existing drift in engine.rs and
    wohl-hub/main.rs)

Verification
  - cargo fmt --all --check: clean
  - cargo clippy --workspace --all-targets -- -D warnings: clean
  - cargo test --workspace --all-features: 92/92 pass
  - cargo kani -p wohl-leak: 4/4 verified
  - cargo kani -p wohl-power: 3/3 verified

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
avrabe and others added 2 commits May 19, 2026 09:15
…easons

Adds `reason = "..."` to every #[allow(dead_code)] introduced in 3f2f524.
Per the architect reviewer's recommendation, naked `#[allow]` is invisible
to future grep; reasons make each suppression load-bearing and connect it
to the specific follow-up work (Track D Verus, firmware-AADL scheduler,
TOML schema surface).

No behavior or verification change — `cargo fmt`, `clippy -D warnings`,
test (92/92), and Kani all still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reviewer caught a wrong file pointer in the reason string introduced in
d06c553. The Scheduler thread is defined at spar/wohl_system.aadl:207,
not wohl_firmware.aadl (which holds node-firmware threads).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit bd6e4a5 into main May 19, 2026
@avrabe avrabe deleted the cleanup/fmt-clippy-kanicfg branch May 19, 2026 07:43
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.

1 participant