fix(cli): make 'buzz messages edit --content -' read stdin like send - #4684
Open
kushaim wants to merge 1 commit into
Open
fix(cli): make 'buzz messages edit --content -' read stdin like send#4684kushaim wants to merge 1 commit into
kushaim wants to merge 1 commit into
Conversation
Fixes block#4361. cmd_edit_message validated and signed the literal '-' as the replacement body when callers passed --content -, while cmd_send_message correctly resolves stdin in the same situation (PR block#624). The two paths diverged in this one step. Mirrors cmd_send_message's exact pattern: read stdin if '-', then validate the resolved content, then pass the resolved string to build_edit. No new public API, no behavior change for non-'-' content. Also adds a regression test on the read_or_stdin helper asserting that read_or_stdin('-') is not the literal '-'. Signed-off-by: kushaim <carlossilvajimenez@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4361.
cmd_edit_messagevalidated and signed the literal"-"as thereplacement body when callers passed
--content -, whilecmd_send_messagecorrectly resolves stdin in the same situation(introduced in PR #624). The two paths diverged in this one step.
This is hazardous for agents: an agent can send a multiline answer
through stdin, use the same
--content -convention to correct thatanswer, receive an
accepted: trueresponse, and silently replacethe answer with a single dash. Markdown clients then render the
edited message as an empty bullet.
Mirrors
cmd_send_message's exact pattern: read stdin if-, thenvalidate the resolved content, then pass the resolved string to
build_edit. No new public API, no behavior change for non--content, no change to
cmd_send_message.Includes a regression test on the
read_or_stdinhelper(
read_or_stdin_dash_reads_stdin_not_literal_dash) that assertsread_or_stdin("-")is not the literal"-". A test runner'sstdin is empty, so the result is
Ok("")— the test is robustagainst whatever the runner has on stdin as long as it isn't a
literal
"-"(which would itself be a bug).Verified:
cargo check -p buzz-cli --lib— cleancargo test -p buzz-cli --lib— 318 passed, 0 failed (the newtest included)