fix(cli): say when a messages read came back at its limit - #5721
Open
Chessing234 wants to merge 2 commits into
Open
fix(cli): say when a messages read came back at its limit#5721Chessing234 wants to merge 2 commits into
Chessing234 wants to merge 2 commits into
Conversation
buzz messages get returns the newest 50 messages when --limit is omitted, with nothing in the output to say the result is a prefix. A truncated history is byte-for-byte indistinguishable from a complete one, so an agent rebuilding context from a channel read reconstructs a plausible-but-wrong past and acts on it. Emit a note on stderr when the read comes back at its limit, naming the bound that applied - the default, the requested --limit, or the cap it was silently clamped to - and how to see more. stdout keeps the plain JSON array, so the machine contract is unchanged. The note says "may exist" rather than reporting a total: the relay answers a filter, not a count, and a result set exactly the size of the limit is possible. A short read is the only provably complete case and stays silent. Refs block#5595 Signed-off-by: Taksh <takshkothari09@gmail.com>
search defaults to 20 and hard-caps at 100, so `--limit 500` returns exactly 100 with nothing indicating the flag was ignored. thread has the same shape at 100/500. Both now emit the same stderr note. thread counts only the replies: the root event rides along in the same response but is not part of the reply page, so including it would report truncation one reply early. Also state the defaults and caps in --limit's help, which previously read "Maximum number of results to return" with no hint that a default existed, and mark --before / --since inclusive - `until` and `since` are both inclusive comparisons in the filter matcher, so a naive pager double-counts the boundary event without that note. Closes block#5595 Signed-off-by: Taksh <takshkothari09@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.
A
messages getthat returns exactly 50 rows is byte-for-byte indistinguishable from a complete history, so an agent rebuilding channel context reconstructs a prefix of the conversation and acts on it as if it were the whole thing. Same forsearch(default 20, hard cap 100 —--limit 500silently returns 100) andthread(100/500).The report ranked "say so" first, and that is what this does:
--limityou passed, or the cap it was clamped to — and how to see more:showing 100 results — --limit 500, capped at 100 was reached, so more may exist; narrow the window with --since / --before to page through the rest.truncated: truefield — it would change the documented read shape for every reader.--limithelp now states the default and the cap for get / thread / search. It previously read "Maximum number of results to return", with no hint that a default existed or that search ignores anything above 100.--before/--sinceare marked inclusive.crates/buzz-core/src/filter.rs:48-58rejects oncreated_at < sinceandcreated_at > until, so both bounds keep their own second and a naive pager double-counts the boundary event.Two deliberate limits, since the report asked for total counts:
113would mean a secondPOST /countround-trip on every read, which felt like the wrong default for the hot path — so the note says "may exist" instead of claiming a number.threadcounts only the replies — the root event rides along in the same response but is not part of the reply page, and counting it would report truncation one reply early.Raising the defaults is not part of this, per the report: any default truncates something; the bug is the silence.
Verified locally:
cargo fmt --all --check,cargo clippy -p buzz-cli --all-targets(clean),cargo test -p buzz-cli --lib— 351 pass, including 8 new tests on the notice. The notice text itself is unit-tested; I did not exercise it against a live relay.Closes #5595