Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions crates/buzz-cli/src/commands/channels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,15 @@ pub async fn cmd_get_channel(client: &BuzzClient, channel_id: &str) -> Result<()
});
let resp = client.query(&filter).await?;
let events: Vec<serde_json::Value> = serde_json::from_str(&resp).unwrap_or_default();
if let Some(e) = events.first() {
let mut normalized = extract_channel_metadata(e);
normalized["pubkey"] =
serde_json::json!(e.get("pubkey").and_then(|v| v.as_str()).unwrap_or(""));
println!("{normalized}");
} else {
println!("null");
}
let Some(e) = events.first() else {
return Err(CliError::NotFound(format!(
"channel '{channel_id}' not found"
)));
Comment on lines +233 to +236

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject malformed query bodies before reporting absence

When /query returns a successful HTTP response whose body is not a JSON array—for example, a malformed or truncated relay response—line 232 converts the parse failure into an empty vector, so this new branch reports not_found with exit code 1 even though the channel's existence was never established. Propagate the deserialization failure as an unexpected error before testing whether the decoded array is empty.

AGENTS.md reference: AGENTS.md:L195-L197

Useful? React with 👍 / 👎.

Comment on lines +233 to +236

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the channels-get runbook expectations

This changes the documented error-path behavior, but crates/buzz-cli/TESTING.md lines 522–525 still assert that the same unknown UUID prints null and exits 0, while line 136 still says channels get may return null. Anyone following the repository's live-testing runbook will therefore treat the intended new behavior as a failure; update those expectations to the not_found stderr payload and exit code 1.

AGENTS.md reference: AGENTS.md:L202-L202

Useful? React with 👍 / 👎.

};
let mut normalized = extract_channel_metadata(e);
normalized["pubkey"] =
serde_json::json!(e.get("pubkey").and_then(|v| v.as_str()).unwrap_or(""));
println!("{normalized}");
Ok(())
}

Expand Down