nak event currently exits with status 0 even when every relay publish fails.
Observed with:
nak v0.18.8-0.20260306175109-33aae3d3ffac
I reproduced it against a minimal WebSocket relay that accepts the connection and responds to every EVENT with:
["OK", "<event-id>", false, "restricted: diagnostic reject"]
Command shape:
nak event --sec 11 -k 1 -c 'diagnostic reject' ws://127.0.0.1:<port>
Output shape:
{"kind":1,"id":"...",...}
connecting to ws://127.0.0.1:<port>... ok.
publishing to ws://127.0.0.1:<port>... failed: msg: restricted: diagnostic reject
Process status was still 0.
Expected behavior: if relay arguments were provided and zero relays accepted the event, nak event should exit nonzero. If the desired CLI contract is "event was signed/printed successfully even though publishing failed," it would help to document that explicitly and provide a flag for fail-on-zero-accepted-relays, because operator scripts otherwise cannot safely treat exit 0 as delivery.
Likely source: publishFlow accumulates successRelays, but returns nil even when len(relays) > 0 && len(successRelays) == 0.
Related asymmetry: nak req has --force-pre-auth, but nak event does not. For auth-required relays, a pre-auth publish mode or a stricter zero-success exit path would make operator flows easier to make receipt-safe.
nak eventcurrently exits with status 0 even when every relay publish fails.Observed with:
I reproduced it against a minimal WebSocket relay that accepts the connection and responds to every
EVENTwith:Command shape:
Output shape:
Process status was still
0.Expected behavior: if relay arguments were provided and zero relays accepted the event,
nak eventshould exit nonzero. If the desired CLI contract is "event was signed/printed successfully even though publishing failed," it would help to document that explicitly and provide a flag for fail-on-zero-accepted-relays, because operator scripts otherwise cannot safely treat exit 0 as delivery.Likely source:
publishFlowaccumulatessuccessRelays, but returnsnileven whenlen(relays) > 0 && len(successRelays) == 0.Related asymmetry:
nak reqhas--force-pre-auth, butnak eventdoes not. For auth-required relays, a pre-auth publish mode or a stricter zero-success exit path would make operator flows easier to make receipt-safe.