Skip to content

refactor: remove code with no effect on macOS - #14

Merged
softmaxe merged 3 commits into
mainfrom
claude/dead-code-review-040d0d
Oct 30, 2026
Merged

softmaxe merged 3 commits into
mainfrom
claude/dead-code-review-040d0d

Conversation

@softmaxe

Copy link
Copy Markdown
Owner

Summary

Remove code that no longer changes behavior on macOS, the only supported platform.

 read_battery
-  open_interface
-    set_blocking_mode(false)   # hidapi only applies it to hid_read
+  api.open_path
   Device::request
-    send_short
-      ShortWrite check         # macOS hid_write returns full length or fails
+    io.write
 raycast/mouse-battery.sh
   GBAT_BINARY
-  GPWBAT_BINARY
-  GPW2_BATTERY_BINARY
   PATH
   /opt/homebrew/bin, /usr/local/bin, $HOME/.local/bin
   <repo>/target/release
-  <repo>/gbat
 docs/record-demo.sh
   rewrite the tape's Output to a temporary GIF
   vhs
-  ffmpeg frame merge and filter graph   # VHS 0.12.0 workaround
   ffmpeg decode check
   replace assets/demo.gif

Evidence

  • Before: cargo test --locked: 26 passed. Battery: 75% from the installed gbat 0.0.1.
    After: cargo fmt --check and cargo clippy --all-targets --locked -- -D warnings pass. cargo test --locked: 26 passed. The new release build prints Battery: 75% from a real mouse and exits 0.
  • Before: GPWBAT_BINARY=<stub> selected the stub.
    After: GBAT_BINARY=<stub> selects the stub. GPWBAT_BINARY=<stub> is ignored and the script uses gbat from PATH.
  • Before: demo.tape went through the frame export and FFmpeg pipeline.
    After: VHS 0.12.1 alone renders the real demo.tape from a real mouse to a valid 1100x500, 324-frame GIF. A separate small tape confirmed it replaces an existing file. docs/record-demo.sh itself was not run, so assets/demo.gif is unchanged.

Merge Danger

Door: two-way

Each change is a plain revert.

Blast Radius: small

Anyone still setting GPWBAT_BINARY or GPW2_BATTERY_BINARY, or keeping a binary at the repository root, falls through to the normal search after updating the Raycast script. Recording the demo now needs VHS 0.12.1 or later. A future hidapi upgrade that allows partial writes would no longer be detected.

hidapi's macOS backend ignores the blocking flag in read_timeout and
reports a successful write at full length, so neither path can change
behavior on the only supported platform.
GBAT_BINARY is the only override, and the script no longer looks for a
binary in the repository root, where no build or install puts one.

BREAKING CHANGE: GPWBAT_BINARY and GPW2_BATTERY_BINARY are ignored.
VHS 0.12.1 renders and replaces the GIF itself, so the FFmpeg pipeline
that worked around 0.12.0 is no longer needed.
@softmaxe
softmaxe enabled auto-merge (squash) October 30, 2026 08:04
@softmaxe
softmaxe merged commit 0676713 into main Oct 30, 2026
4 checks passed
@softmaxe
softmaxe deleted the claude/dead-code-review-040d0d branch October 30, 2026 08:05
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