fix(cli): send forum roots and replies as forum kinds - #5925
Conversation
`messages send` published kind:9 whenever `--kind` was omitted. Desktop's forum surface lists kind:45001 topics and their kind:45003 comments, so a default send into a forum channel was accepted by the relay, returned an event id, and then never appeared where people read that channel. The event stayed reachable by deep link or notification, which is what makes the failure hard to spot. Resolve the channel's type from its kind:39000 discovery event and pick the kind that channel's canonical surface shows. An explicit `--kind` is still honoured unchanged, and `--broadcast` stays on kind:9 — it is a stream-only concept, so a flag should not silently redirect the event kind. Signed-off-by: Taksh <takshkothari09@gmail.com>
Pins the `t`-tag read, the forum root/reply split, the stream and DM cases, and that --broadcast is left on kind:9. Signed-off-by: Taksh <takshkothari09@gmail.com>
"channel default" was accurate but unhelpful; name the kinds so a caller can tell whether they need --kind at all. Signed-off-by: Taksh <takshkothari09@gmail.com>
themiguelamador
left a comment
There was a problem hiding this comment.
The forum default still has an invisible-success path: --broadcast forces an implicit forum send back to kind 9. That event is accepted but omitted from Desktop's forum surface—the same user-visible failure this PR fixes. The PR describes broadcast as stream-only, so a forum invocation should fail clearly rather than silently publish hidden content. Explicit forum kinds combined with --broadcast also ignored the flag.
I consolidated selection into a tested resolve_message_kind contract. Ordinary forum roots/replies remain 45001/45003; forum broadcast is rejected; explicit forum kinds reject the ignored broadcast flag; and explicit --kind 9 --broadcast remains the expert opt-out. Selection now runs before attachment upload, preventing invalid broadcast combinations from leaving orphaned media. CLI help identifies broadcast as stream-only.
Fix: Complear/buzz@c56c71995 (review/pr-5925-fix)
Verified: full buzz-cli unit suite (357 passed); cargo clippy -p buzz-cli --all-targets -- -D warnings; rustfmt; git diff --check.
|
Thanks — all of it addressed, in af89a28, b8b7027 and d281d5f.
Before the upload. Selection now runs before the attachment loop, so a rejected combination cannot leave media stored with no event referencing it. That also covers Help. Verified on the pushed head: |
The review points out two invisible-success paths the first commit left open, and both come back to --broadcast being a stream-only concept: - An implicit forum send with --broadcast fell back to kind 9. That event is accepted by the relay and never listed on the forum surface — the exact failure this PR exists to fix, reachable by adding a flag. - An explicit --kind 45001/45003 with --broadcast dropped the flag silently: build_forum_post and build_forum_comment take no broadcast argument. Selection is now one tested contract, resolve_message_kind, which rejects both rather than half-applying them. --kind 9 --broadcast stays as the explicit opt-out, in a forum channel too: the caller named the kind. The unsupported --kind error moves into the same function, so every kind decision has one home. Signed-off-by: Taksh <takshkothari09@gmail.com>
The review asks that CLI help identify broadcast as stream-only, now that a forum invocation is an error rather than a silent kind 9. Signed-off-by: Taksh <takshkothari09@gmail.com>
The review asks that selection run before attachment upload, so an invalid broadcast combination cannot leave orphaned media on the relay. Every rejection in resolve_message_kind is a usage error the caller retries, and the upload loop ran first, so the files were already stored with no event referencing them. The reply flag is read from p.reply_to.is_some() rather than thread_ref.is_some(); thread_ref is Some exactly when reply_to is, and it is resolved by a relay round-trip that no longer needs to happen first. Signed-off-by: Taksh <takshkothari09@gmail.com>
d281d5f to
da2a99d
Compare
Fixes #5075.
messages sendpublished kind:9 whenever--kindwas omitted. Desktop's forum surface lists kind:45001 topics and their kind:45003 comments, so a default send into a forum channel is accepted by the relay, returns an event id, and never appears where people read that channel. It stays reachable by notification or deep link, which is what makes it look like a delivery problem rather than a kind problem.The send now resolves the channel's type from its kind:39000 discovery event (
ttag, written byemit_group_discovery_events) and picks the kind that channel's canonical surface shows: 45001 for a forum root, 45003 for a forum reply, 9 everywhere else. An explicit--kindis honoured unchanged, and--broadcaststays on kind:9 — broadcast is a stream concept, and a flag should not silently redirect the event kind. A channel with no discovery event keeps the stream default rather than failing the send.Acceptance criteria from the issue: root send to a forum publishes 45001 ✅, stream sends still publish 9 ✅, explicit override unchanged ✅, regression tests for both defaults ✅,
--kindhelp now names the kinds ✅. The one I cannot tick myself is "appears as a topic in Desktop's forum surface" — I have no forum channel to send into; the claim rests on Desktop listing 45001, which is the issue's own evidence.Verified locally:
cargo test -p buzz-cli --lib(355 passed, 6 new), clippy and fmt clean. The extra kind:39000 read costs one query per send that omits--kind; sends already query channel members for mention resolution on the same path.