buzz icon indicating copy to clipboard operation
buzz copied to clipboard

buzz social publish treats --content - literally, returns accepted, and cannot delete the bad note

Open Dilosaurus opened this issue 3 months ago • 1 comments

Summary

buzz social publish --content - accepts the command and returns accepted:true, but social publish does not implement the stdin sentinel supported by messages send. It publishes a literal one-character - note instead of the piped content.

The bad note then cannot be removed with the CLI because buzz social has no note/event delete command.

This is a silent-success failure: the caller receives a successful publish result while the intended body is discarded, and there is no CLI recovery path.

Reproduction

printf '%s' 'expected multiline note body' | buzz social publish --content -

Observed publish result reported accepted:true with event:

9eb212214efb544213c7150a7d5f92e180b5be9a166f31639e7ce46494198186

Canonical readback:

{
  "content": "-",
  "id": "9eb212214efb544213c7150a7d5f92e180b5be9a166f31639e7ce46494198186",
  "kind": 1
}

The intended body was hundreds of characters; the persisted content length was 1.

CLI inconsistency

buzz messages send --help documents:

--content <CONTENT>  Message text ... Use '-' to read from stdin

buzz social publish --help only says:

--content <CONTENT>  Text content of the note

The same top-level CLI therefore assigns different semantics to the identical --content - shape without rejecting the unsupported form.

buzz social --help currently exposes publish/read/contact/list operations but no delete command, so the malformed kind-1 note cannot be retracted from the stock CLI.

Expected behavior

One of:

  1. social publish supports --content - exactly like messages send, or
  2. it exits nonzero with an explicit “stdin content is unsupported” error instead of publishing -.

Also, the CLI should expose deletion/retraction for a caller-owned social note.

Suggested fix

  • Reuse the stdin content reader used by messages send for social publish.
  • Add a regression test that pipes multiline UTF-8 content, then reads the event back byte-for-byte.
  • At minimum, warn or reject when --content - is used with piped stdin.
  • Return the published content length (or another readback-friendly receipt) so a one-character result is visible.
  • Add buzz social delete --event <id> using the project’s normal authorized NIP-09 deletion path.

Dilosaurus avatar Aug 05 '26 15:08 Dilosaurus

Still reproducing (2026-08-31, Windows CLI build).

$ printf 'STDIN TEST
' | buzz social publish --content -
{"accepted":true,"event_id":"...","message":""}
$ buzz social event --event <id>   # content == "-"

Two things that make this worse than a plain input bug:

  1. It renders as a bare bullet, not as obvious junk. Desktop passes note.content through <Markdown> (desktop/src/features/pulse/ui/NoteCard.tsx), so a lone - becomes an empty list item — the feed shows a single dot. The author sees accepted:true and nothing looks wrong until someone asks what the dots are.
  2. No delete path anywhere. buzz messages delete rejects it (has no h-tag — cannot determine channel), buzz notes rm only targets kind:30023 addressable notes, and I found no note-deletion action in desktop/src either. The junk posts are permanent.

In our case this silently dropped 3 work reports before it was noticed.

The asymmetry is the root cause: messages send (commands/messages.rs) and long-form notes (commands/notes.rs) resolve --content - from stdin, while SocialCmd::PublishNote { content: String } in crates/buzz-cli/src/lib.rs takes the string verbatim. Same shape as #4361 for messages edit.

Cheapest safe fix even without stdin support: reject a bare - in social publish the way mem set rejects an empty stdin read, so the failure is loud instead of a published dot.

mmdal0857 avatar Aug 31 '26 04:08 mmdal0857