fix(desktop): stop labeling malformed relay responses as unreachable

parse_json_response tagged a 2xx response with an undeserializable body
as "relay unreachable:", the same prefix used for genuine transport
failures. The reconcile log-guard suppresses that prefix, so a reached-but-
malformed response (protocol mismatch, relay bug, corrupted body) was being
silently swallowed instead of surfaced. Re-prefix it to "relay returned
malformed response:" so it falls outside the unreachable bucket and logs
loudly; the frontend connectivity classifier also correctly stops treating
it as a connectivity failure. No other code reads the old string.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7
2026-06-19 13:20:15 -04:00
co-authored by Will Pfleger
parent 7c5b1f252e
commit 92f8f78b0e
+7 -2
View File
@@ -211,11 +211,16 @@ pub(crate) async fn parse_json_response<T: DeserializeOwned>(
return Err(msg);
}
// Drop the reqwest error detail — it contains the raw URL.
// A successful HTTP response whose body fails to deserialize means the relay
// was reached but returned something unexpected (protocol mismatch, relay bug,
// corrupted body) — NOT a connectivity failure. Keep it off the
// "relay unreachable:" bucket so it surfaces loudly instead of being treated
// as a transient unreachable-relay condition. The reqwest error detail is
// dropped because it contains the raw URL.
response
.json::<T>()
.await
.map_err(|_| "relay unreachable: response was not valid JSON".to_string())
.map_err(|_| "relay returned malformed response: not valid JSON".to_string())
}
pub async fn relay_error_message(response: reqwest::Response) -> String {