Commit Graph
5 Commits
Author SHA1 Message Date
vicrodh 05d641d871 feat(qconnect): surface missing AUTHENTICATE JWT as a hard credential error
Add `require_jwt` (default false) to `WsTransportConfig` and a
`MissingAuthenticateJwt` error variant. When `require_jwt` is set but no
`jwt_qws` is present, the connect attempt now emits a `TransportError`,
closes the socket, and routes through the existing bounded reconnect path
instead of silently skipping the AUTHENTICATE frame (gap #12).

The default stays false so the InMemory / test transport path keeps
working without a JWT; `resolve_transport_config` flips it on for the real
Qobuz endpoint. Reuses the increment-only `handle_reconnect_delay`, so the
issue #358 latch is untouched.

cc
2026-06-01 03:42:09 -06:00
vicrodh c32bbc5db3 feat(qconnect): persist device_uuid in qconnect_settings.db
resolve_qconnect_device_uuid() generated a fresh Uuid::new_v4() per
process via a OnceLock, so every launch registered a new renderer
identity cloud-side (zombie renderers) and broke reconnect continuity.
Persist it beside device_name in qconnect_settings.db: generate once on
first run, reuse thereafter, keeping the QBZ_QCONNECT_DEVICE_UUID env
override for tests. Mirrors load_persisted_device_name/persist_device_name.

cc
2026-06-01 02:44:14 -06:00
vicrodh 6f38362b9f feat(qconnect): apply startup_mode + CLI override during app setup
Spawns a background auto-connect task during the Tauri setup hook when
the effective startup decision says so. Failures log a warn and leave
lifecycle in Off; no infinite reconnect loop on first-time failure.

cc
2026-05-01 12:30:32 -06:00
vicrodh b4a32aec5d refactor(qconnect): fix test module imports broken by submodule split
Steps 4-8 moved items into focused submodules but only verified `cargo
check` (lib only) — tests under #[cfg(test)] in mod.rs continued
referring to items via plain `super::FunctionName`, which only resolved
when the items were still in mod.rs.

This commit re-paths the test imports to point at their actual
submodules:

- decode_hex_channel, parse_subscribe_channels, default_qconnect_device_info
  → super::transport::*
- find_unique_renderer_id, refresh_local_renderer_id,
  QconnectFileAudioQualitySnapshot → super::session::*
- resolve_controller_queue_item_from_snapshots,
  resolve_queue_item_ids_from_queue_state, QconnectRemoteSkipDirection,
  resolve_core_shuffle_order, QconnectControllerQueueItemResolution
  → super::queue_resolution::*
- build_session_renderer_snapshot → super::session::*
- should_reload_remote_track → super::track_loading::*
- queue_state_needs_materialization → super::corebridge::*

Promoted decode_hex_channel and parse_subscribe_channels to pub(super)
in transport.rs, and should_reload_remote_track to pub(super) in
track_loading.rs so the tests can reach them across the submodule
boundary.

All 37 qconnect tests pass.

cc
2026-04-27 17:04:08 -06:00
vicrodh c9285a33e9 refactor(qconnect): extract device identity and transport config to transport.rs
Move 14 items that own QConnect transport setup, device identity, and
credential discovery into a dedicated transport submodule:

Device identity (pub(super)):
- default_qconnect_device_info / default_qconnect_device_info_with_name
- resolve_qconnect_device_uuid (with QCONNECT_DEVICE_UUID OnceLock)
- resolve_system_hostname, resolve_default_qconnect_device_name

Custom-device-name persistence (pub(super)):
- load_persisted_device_name, persist_device_name
  (qconnect_settings_db_path stays private to the submodule)

Transport config + credentials (pub(super) + private):
- resolve_transport_config (handles env-var fallbacks, qws/createToken
  auto-discovery, subscribe-channel parsing)
- fetch_qconnect_transport_credentials (private)
- normalize_opt_string, parse_subscribe_channels, decode_hex_channel
  (private)

Diagnostics (pub(super)):
- hex_preview (used by transport-event debug logs in mod.rs)

Constants moved to transport.rs (private to the submodule):
- DEFAULT_QCONNECT_DEVICE_BRAND/MODEL/TYPE/SOFTWARE_PREFIX
- VOLUME_REMOTE_CONTROL_ALLOWED
- QCONNECT_QWS_TOKEN_KIND, QCONNECT_QWS_CREATE_TOKEN_PATH

Constants kept in mod.rs but promoted to pub(super) so transport.rs
can borrow them: AUDIO_QUALITY_MP3, AUDIO_QUALITY_HIRES_LEVEL2.

mod.rs imports OnceLock and Uuid removed (now confined to transport).

Pure relocation. mod.rs: 4022 → 3673 lines. transport.rs: 386 lines.
Total qconnect/ submodules now: 8 (types, session, queue_resolution,
corebridge, track_loading, event_sink, transport, plus residual mod.rs).

cc
2026-04-27 15:48:30 -06:00