Repository navigation
feat(cli): search past 100 results, by date and by kind of chat - #17
Conversation
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Adds date and chat-kind filters plus pagination for searches exceeding 100 results. Default searches remain limited to 30 results, and the changes retrieve messages without modifying Telegram data or permissions. Notes:
You can add or adjust custom eligibility rules. Learn more. |
Search silently stopped at 100 results. It now pages until --limit: global search with Telegram's (rate, peer, ID) cursor, search in one chat with the last message ID, stopping when a page is empty, when no next rate is given, or when the cursor does not move on. --since and --until bound message dates (a day, an RFC 3339 time or an age like 7d). --kind keeps a search everywhere to users, groups or channels. The demo backend now names the chat of each result and sorts them by date, like Telegram. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Check that the cursor moved before taking a page, stop at the exact count Telegram gives, fall back to the last message's date without a next rate, and widen Telegram's exclusive date bounds by a second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
770a184 to
24cf8c7
Compare
Dismissing prior approval to re-evaluate 24cf8c7
An agent searching deal channels asked for
-n 300and silently got 100 results, with no way to narrow by date or by kind of chat. It ended up running ~80 per-channel searches to cover them.tg searchnow pages until--limit. Global search follows Telegram's (rate, chat, ID) cursor, usingnext_rateor, without one, the last message's date. Search in one chat follows the last message ID. Paging stops when a page is empty, repeats the last one, or ends the exact count Telegram gave, so it never loops or takes a message twice.New flags:
--since/--until: a day (counted in full), an RFC 3339 time, or an age like7dor12h. Telegram's date bounds leave out the second they name, so they are widened by one.--kind user|group|channel: a search everywhere limited to one kind of chat, in a single request (broadcasts_only,groups_only,users_only). Bots count as users, as Telegram does not tell them apart there.The demo backend now names the chat of each result and sorts results by date, like Telegram (visible in the before shot).
guide.txtand--helpcover the flags.Proved with
go test ./...: a fake MTProto invoker drives real paging (cursor, fallback rate, date bounds, kind flag, repeated page, exact count), plusparseWhenand usage error cases.go vet,gofmt, and the demo output below. Not run against a real account.Before
After
Council review
Rounds: 4
Muse Wonder was unavailable (quota exhausted). Round 4 checked the one remaining blocker. Dismissed: pacing sleeps and a
--limitcap (flood waits up to 30s are already waited out, longer ones return "rate limited by Telegram, retry in Ns"), and following a newnext_rateon a page that made no progress (risks paging forever).Created with Claude Opus 5.5 in Claude Code (T3 Code); council reviews by Claude Opus 5.5, GPT 6.2 Sol and Gemini 4 Neon.
🤖 Generated with Claude Code
Note
Add date-bound and chat-kind filters to CLI search, with results past 100
start,end, andkindflags tocli.searchin cli.go. TheparseWhenhelper accepts calendar dates, RFC 3339 timestamps, and day/Go-duration ages; an end-bound date includes the whole day. Usage errors cover unsupported kinds, combining a kind with a specific chat, invalid dates, and reversed bounds.core.SearchQueryin core.go with optional start/end times and a chat-kind field.mtp.backend.Searchin backend.go to page through Telegram results until the limit is reached, applying date bounds (clamped to Telegram's 32-bit range) and global chat-kind filters, stopping on empty, repeated, or complete pages. Larger limits are no longer capped at one page.demo.Backend.Searchto apply the same filters and return results with chat titles in chronological order, keeping the newest messages when the limit is exceeded.Macroscope summarized 24cf8c7.
Summary by CodeRabbit