fix(apps): surface relay/control WebSocket construction errors (VAPP-42) #53

Merged
David merged 1 commit from fix/VAPP-42-surface-ws-errors into main 2026-06-29 02:22:04 +02:00
Owner

What

The browser WebSocket open paths hid construction failures, violating NEVER HIDE ERRORS and masking the real cause of a broken relay:

  • files.rs mount fell back to a dummy WebSocket::new("ws://localhost:0"), so the only console signal was a misleading "can't establish connection to ws://localhost:0/" - the actual failing relay_ws_url was hidden.
  • terminal.rs / desktop.rs used WebSocket::new(relay_ws_url).ok()?, silently producing no session and no error.

This cost a full debugging round: the true cause (an insecure ws:// relay URL, because VERVAIN_SERVER_PUBLIC_URL was http://, mixed-content-blocked on the https page) was invisible.

Changes

  • On a failed WebSocket::new, all three pages now console::error the offending URL with the single-use auth token redacted (shared redact_auth helper in pages/mod.rs, wasm-only) plus the error, and call out the likely ws://-on-https mixed-content cause.
  • files.rs: drop the localhost:0 dummy; mount/attach return Option<FilesHandle>; on failure set ConnStatus::Closed and op_error so the Files page renders its existing error UI instead of mounting a dead socket.

Testing

just pre-commit green (fmt, clippy -D warnings, server + wasm check, bin tests).

Fixes VAPP-42. Relates to VAPP-41.

🤖 Generated with Claude Code

## What The browser WebSocket open paths hid construction failures, violating NEVER HIDE ERRORS and masking the real cause of a broken relay: - `files.rs` `mount` fell back to a dummy `WebSocket::new("ws://localhost:0")`, so the only console signal was a misleading "can't establish connection to ws://localhost:0/" - the actual failing `relay_ws_url` was hidden. - `terminal.rs` / `desktop.rs` used `WebSocket::new(relay_ws_url).ok()?`, silently producing no session and no error. This cost a full debugging round: the true cause (an insecure `ws://` relay URL, because `VERVAIN_SERVER_PUBLIC_URL` was `http://`, mixed-content-blocked on the https page) was invisible. ## Changes - On a failed `WebSocket::new`, all three pages now `console::error` the offending URL with the single-use `auth` token redacted (shared `redact_auth` helper in `pages/mod.rs`, wasm-only) plus the error, and call out the likely `ws://`-on-https mixed-content cause. - `files.rs`: drop the `localhost:0` dummy; `mount`/`attach` return `Option<FilesHandle>`; on failure set `ConnStatus::Closed` and `op_error` so the Files page renders its existing error UI instead of mounting a dead socket. ## Testing `just pre-commit` green (fmt, clippy `-D warnings`, server + wasm check, bin tests). Fixes VAPP-42. Relates to VAPP-41. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(apps): surface relay/control WebSocket construction errors
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 1m25s
Create release / Create release from merged PR (pull_request) Has been skipped
e465b9489d
The browser WS open paths hid construction failures: files fell back to a dummy ws://localhost:0 socket (masking the real URL behind a misleading "localhost:0" connection error), and terminal/desktop used WebSocket::new(...).ok()? which silently produced no session. That violated NEVER HIDE ERRORS and hid the actual cause of a broken relay (an insecure ws:// URL from a http:// VERVAIN_SERVER_PUBLIC_URL, mixed-content-blocked on the https page).

On a failed WebSocket construction the three pages now log the offending URL (with the single-use auth token redacted via a shared redact_auth helper) and the error to the console, and call out the likely ws://-on-https mixed-content cause. Files additionally drops the localhost:0 dummy, returns Option<FilesHandle>, sets ConnStatus::Closed, and surfaces an op_error so the page renders its existing error UI instead of mounting a dead socket.

#VAPP-42
David scheduled this pull request to auto merge when all checks succeed 2026-06-29 02:21:37 +02:00
David merged commit 81c6ecb300 into main 2026-06-29 02:22:04 +02:00
David deleted branch fix/VAPP-42-surface-ws-errors 2026-06-29 02:22:04 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/vervain-apps!53
No description provided.