Skip to content

Prepare the backend for other systems (no change on Windows) - #8

Open
NickMarcha wants to merge 1 commit into
releasefrom
platform-seams
Open

NickMarcha wants to merge 1 commit into
releasefrom
platform-seams

Conversation

@NickMarcha

Copy link
Copy Markdown
Owner

First step toward Linux (CachyOS first) and later macOS. Windows behavior should be unchanged; everything tied to a system now sits behind a small seam, so a Linux PR only adds its own backend files.

What moved

  • Audio (src-tauri/src/audio/): mod.rs holds what's shared (the two recording threads, the start handshake, the level test), wav.rs writes WAVs and pads silence to wall-clock time. A backend has list_devices and capture(source, stop, track). windows.rs is the old WASAPI code; unsupported.rs returns errors.
  • Discord IPC (src-tauri/src/discord_rpc/ipc/): framing and handshake are shared and run on any stream. A backend only opens the connection (windows.rs: named pipes) and checks whether Discord is running. The RPC session in client.rs no longer has Windows-only gates.
  • Engine (engine.rs): asset(kind) per system, server_exe/is_engine_file use the system's suffixes, gpu_drivers replaces the System32 check in lib.rs, unix permissions are set on unpack. engine_status_command gains available, and Settings only offers those engines.
  • engine_check.py reads the new asset table (checked: same URLs and hashes as before).
  • Removed the unused cpal dependency.

Tests

  • New Rust tests (28 on Windows, 27 on Linux): WAV padding and timing, the recording start handshake (both tracks, a missing device, a backend that never opens, Discord missing mid-recording), the level test, IPC framing, a full RPC session against a fake Discord (READY, AUTHENTICATE, channel, guild name, SUBSCRIBE, PING/PONG, SPEAKING_START, a rejected token), engine unpacking, choice and cleanup.
  • Two new frontend tests for the engine list. All 26 frontend tests pass.
  • New .github/workflows/test.yml runs the frontend tests plus cargo test on Windows and Ubuntu for every PR. I checked the Linux build locally in a rust:1.91 container.

Before merging: check by hand on Windows

Hardware isn't covered by the tests.

  • Record a call with the default sources: both tracks, right length, speakers line up
  • Record with a chosen mic and a chosen output device
  • Close and reopen Discord mid-recording (silence, then audio again)
  • Test buttons in Audio settings (mic and others, with Discord closed: "Discord is not running")
  • Connect to Discord, restart the app (auto-reconnect), auto-record
  • Transcribe with an installed engine; Settings > Manage models lists all three engines

🤖 Generated with Claude Code

Audio, the Discord IPC connection and engine downloads now have shared code
plus a small backend per system (Windows: WASAPI, named pipes, the current
engine zips; elsewhere: stubs that return errors). Windows behavior is
unchanged. Linux compiles and passes the shared tests, so a Linux port only
has to fill in its backends.

- audio: recording threads, start handshake, WAV writing and the level test
  are shared and tested against a fake backend
- discord_rpc: framing and the whole RPC session run on any stream; tested
  against a fake Discord on an in-memory stream
- engine: per-system asset table, executable and library names, driver
  check; Settings only offers engines the system can download
- CI: test.yml runs the frontend tests and the backend tests on Windows
  and Linux for every PR; engine_check.py reads the new asset table
- drop the unused cpal dependency

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@NickMarcha NickMarcha added the skip-changelog Leave this PR out of the release notes and the #updates post label Nov 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Leave this PR out of the release notes and the #updates post

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant