Repository navigation
provide-hub: fail fast on a non-ws(s) --server URL (bd-q96fhj3q) - #845
Merged
Merged
Conversation
…-q96fhj3q) samod 0.14 split DialError into TransientFailure (retried with backoff) and PermanentFailure (stops the dialer, surfaced via established()); the upgrade mapped every BearerDialer failure to transient to preserve 0.13 semantics. A non-ws(s) --server URL (the classic https:// paste) is fixed at construction, so retrying could never succeed: every attempt failed tungstenite's scheme check and the user got 30 s of futile dials ending in 'timed out connecting to hub' / 'auth rejected?'. - build_auth_request validates the scheme up front and returns the new ProviderError::InvalidUrl (tungstenite only checks the scheme at connect); Handshake keeps the bearer-header case, which stays transient because a fresh token is fetched per attempt - connect maps InvalidUrl, and tungstenite's connect-time Error::Url, to DialError::PermanentFailure; token-fetch and network errors stay transient - join surfaces the permanent cause instead of guessing auth: 'hub connection failed: invalid websocket url: unsupported scheme \'https\' (the server URL must use ws:// or wss://)' Tests watched fail first, including one surprise the strand did not predict: tungstenite 0.27's into_client_request accepts https://, so the failure surfaced at connect_async, not at request build — the scheme guard now lives in build_auth_request. New coverage: scheme guard unit test, connect-level permanent/transient classification with guards that the bearer-header and token-fetch cases stay transient, and a join-level test asserting fast failure naming the URL. quarto-hub-provider 45/45 pass; full workspace suite deferred per user request.
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
q2 provide-hub --server https://…used to retry for 30 seconds and then fail with "timed out connecting to hub" or "hub connection failed (auth rejected?)". Both messages named the wrong cause. The real problem: the scheme washttps, and onlyws://andwss://work. Retrying could never help, because the URL is fixed when the dialer starts.The change
build_auth_requestnow checks the scheme up front and returns a newProviderError::InvalidUrl.DialError::PermanentFailure, so samod stops retrying at once. Token fetches and network errors stay transient: a fresh token is fetched per attempt, so an auth rejection can still clear on retry.joinsurfaces the real cause. The error now reads:hub connection failed: invalid websocket url: unsupported scheme 'https' (the server URL must use ws:// or wss://).Verification
https://when it builds the request and only rejects the scheme at connect, so the guard covers both layers.quarto-hub-provider: 45/45 pass.q2 provide-hub someDocId --file index.qmd --server https://example.test/ws --token toknow fails in about 2 seconds with the message above. Before, it took 30 seconds and blamed a timeout.-j 2. This change does not touch typst.Closes bd-q96fhj3q.