fix(cli): preserve network errors in mention preflight - #6569
fix(cli): preserve network errors in mention preflight#6569olympusbuildz wants to merge 1 commit into
Conversation
Mention preflight used fetch_events(...).ok()? which discarded
CliError::Network from an unreachable relay, then invented
CliError::Other("could not load channel membership..."). That inverted
retryable from true→false and exit 2→4 whenever the body needed
mention processing (@ outside code or --mention).
Propagate query failures as Result, reserve Ok(None) for a missing
kind 39002 membership event, and map only that case to NotFound.
Fixes block#6555
Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
Co-authored-by: Olympusbuildz <Olympus.roots@outlook.com>
Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
|
I filed #6555. This is the right fix and it is the same shape I had going on my own branch, so I am not opening a competing PR. I verified yours instead. Two things stand between this and a merge. 1. It fails the Lint gate at
|
Problem
buzz messages sendagainst an unreachable relay reportsnetwork_error/retryable: true/ exit 2 when the body has no mention processing. The same outage with an@outside a code region (or with--mention) is rewritten as:{"error":"error","message":"could not load channel membership for mention preflight","retryable":false}exit 4. Wrappers that honor
retryablepermanently drop attention-seeking messages.Root cause
fetch_eventsincrates/buzz-cli/src/commands/messages.rsdidclient.query(...).await.ok()?, discardingCliError::Network.resolve_content_mentionsthen mapped bareNonetoCliError::Other, which is never retryable.Three unrelated conditions collapsed into one membership-looking message: transport failure, non-array body, and a channel with no kind 39002 event.
Fix
fetch_events→Result<Vec<_>, CliError>(same shape asfetch_eventin this file)fetch_member_pubkeys→Result<Option<Vec<_>>, CliError>whereOk(None)means no 39002 eventNotFoundnaming the channelWhy it matters
retryabledrives automation. Inverting it only for@bodies is a silent drop class on the messages that were meant to notify someone.Test plan
Named regression:
mention_preflight_preserves_network_error_when_relay_unreachable—BuzzClienttohttp://127.0.0.1:1, body with@and explicit-mention path both stayCliError::Network, retryable, exit 2; plain body still skips preflight.Risk
Blast radius is CLI mention preflight only. Empty membership is now
not_foundinstead of genericerror— more accurate for operators.Closest work
none found on
fetch_events/ mention-preflight retryable inversion (open PRs onmessages.rscover empty content, NUL, etc., not this path).Fixes #6555