Skip to content

Sprint #43: Driver safety, concurrency, and IPC versioning - #44

Open
phaedrus1992 wants to merge 16 commits into
mainfrom
feat/43-driver-safety-ipc-version
Open

Sprint #43: Driver safety, concurrency, and IPC versioning#44
phaedrus1992 wants to merge 16 commits into
mainfrom
feat/43-driver-safety-ipc-version

Conversation

@phaedrus1992

@phaedrus1992 phaedrus1992 commented Apr 17, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #22, #23, #24, #25, #45.

Implements four critical fixes to driver safety, HID correctness, and IPC robustness, plus CI infrastructure fixes:

Test Plan

  • IPC protocol tests pass (11/11): roundtrip, version mismatch detection, regression guard
  • Driver tests compile (UnsafeCell initialization verified)
  • Unsafe code properly documented with #[expect] attributes
  • Clippy clean on modified crates
  • All fixes committed and pushed
  • Pre-PR review findings addressed and fixed
  • CHANGELOG updated with breaking changes
  • Version bumped: sideblinder-ipc 0.8.0 → 0.9.0
  • CI passes with corrected LLVM installation

Breaking Changes

  • sideblinder-ipc: IPC frame payload size increased from 22 to 23 bytes (now includes protocol version byte). Old version will be rejected with VersionMismatch error.

🤖 Generated with Claude Code

- ffb_handler: fix unsafe block visibility and force feedback logic
- input_report: correct axis usage and type handling
- ioctl: fix IOCTL command definitions and payload handling
- hid_descriptor: correct axis usage comments
- Inline WDF macro for proper visibility across modules
- Fix module exports and macro accessibility
- Correct unsafe block scoping
- Collapse nested if statements for clarity
- Replace magic numbers with named constants
- Suppress lint attributes where appropriate
- Handle unwrap() safely with better error context
- Rewrite IPC payload structure for safer serialization
- Correct payload size expectations with new #[expect] comments
- Bump sideblinder-ipc to 0.9.0
- Update CHANGELOG with release notes
- ipc-protocol.md: document IPC message format and payload structure
- wdk-build-troubleshooting.md: comprehensive WDK build error troubleshooting
- KNOWN-ISSUES.md: document wdk-sys path handling and Windows Kits edge cases
- Add reference repos for architectural study (vjoy, joystick_gremlin, mw5_ffb, sidewinder-arduino)
- Document reference code policies in CLAUDE.md
- Update README with reference code section
- Update CONTRIBUTING.md with driver build requirements
- Add WDK installation via NuGet in CI (with diagnostics script)
- Install LLVM 17 for kernel-mode driver builds
- Configure static CRT linking for Windows MSVC targets
- Set CARGO_BUILD_JOBS=1 to prevent wdk-macros lock contention
- Add NuGet.Config for Microsoft feed access
- Document -j 1 requirement in .cargo/config.toml and CLAUDE.md
- Update Renovate config for WDK package updates
@phaedrus1992
phaedrus1992 force-pushed the feat/43-driver-safety-ipc-version branch from 71702a1 to ca6c84a Compare April 17, 2026 21:55
RangerRick and others added 2 commits April 18, 2026 19:13
- Add unsafe impl Sync for FfbQueue with SAFETY comment explaining UMDF serialization guarantees
- Remove useless 'mut' binding on queue test (after &self API change)
- Add #![expect(unsafe_code)] to lib.rs, ioctl.rs for workspace lint compliance
- Check WdfRequestSetInformation returns in all 4 IOCTL handlers
- Check WdfRequestComplete return with SAFETY comment
- Add clippy suppression for test code unwrap/expect

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…sion byte

Protocol frame size increased from 26 to 27 bytes after adding version byte.
Update documentation in gui_pipe.rs and pipe_backend.rs (4 instances).

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@phaedrus1992

Copy link
Copy Markdown
Owner Author

Pre-PR Review: Safety and Linting Fixes

Completed initial pre-PR analysis and fixes for critical P0 issues:

Fixed

  • FfbQueue data race: Added unsafe impl Sync with detailed SAFETY comment explaining UMDF serialization guarantees
  • Unsafe code linting: Added #![expect(unsafe_code)] attributes to lib.rs, ioctl.rs for workspace lint compliance
  • Error handling: Check return values from WdfRequestSetInformation (4 handlers) and WdfRequestComplete
  • Test code: Added clippy suppression for unwrap/expect in test blocks (hid_descriptor, ffb_handler, input_report)
  • Documentation: Updated stale 26-byte references to 27-byte (4 instances in gui_pipe.rs and pipe_backend.rs)

Deferred (tracked in issues #46-49)

  • P1-3: Macro unsafe documentation (architectural refactoring)
  • P1-4: Duplicate HID struct and enum constants
  • P1-5: Protocol versioning semver policy
  • P1-6: WDK header validation diagnostics
  • P2: Code simplifications (low priority)

All critical safety issues resolved. Ready for CI and code review.

Dynamically find and install the latest available 17.x version of LLVM
using Chocolatey, with a fallback to the latest available if 17.x is
not found. This addresses the user requirement to use the latest 17.x
version while maintaining CI robustness.

Closes #45
Change from outer attribute #[expect(...)] to inner attribute
#![expect(...)] so the suppression applies to all unwraps in the test
module, not just the first test. The module contains three unwraps
(lines 174, 175, 187) that all require the same suppression since
panicking on errors is the correct failure mode for tests.

This addresses the code reviewer's feedback about incomplete attribute
coverage.
Chocolatey no longer provides LLVM 17.x (latest available is 20.x).
Download LLVM 17.0.6 directly from the official GitHub releases instead,
which is more reliable and gives us full control over the version.

Fixes CI job failure where Chocolatey installed LLVM 20 instead of 17.x.
The wdk-macros race condition only affects sideblinder-driver. Build
other crates in parallel for faster CI, then build sideblinder-driver
with -j 1 serialization.

This splits each job into:
  cargo <cmd> --workspace --exclude sideblinder-driver
  cargo <cmd> -p sideblinder-driver -j 1

Applied to clippy, test, and release build jobs.
Now that we're only applying -j 1 to the driver crate specifically, we
don't need CARGO_BUILD_JOBS=1 in the environment. Removing it allows
the non-driver crates to build in parallel as intended.
Add GitHub Actions cache step to store the LLVM installer in the cache,
keyed by version. The install step checks for a cached copy before
downloading, significantly reducing CI time on cache hits.
When a new push or pull request triggers CI, cancel any in-progress
runs from earlier commits on the same branch. This prevents wasting
CI resources on outdated builds.
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.

[major] Driver crate outside workspace; no lint enforcement

2 participants