-
Notifications
You must be signed in to change notification settings - Fork 0
Improve text search reliability and add mark-read workflow #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Findings from hands-on testing of all jm commands against a live Fastmail account. Covers broken full-text search, bare date parsing for --before/--after, opaque JMAP error messages, and a new mark-read command.
Fix full-text search by working around a go-jmap v0.5.3 bug where searchsnippet.Get.Name() returns "Mailbox/get" instead of "SearchSnippet/get", causing invalidArguments from the JMAP server. A wrapper type overrides the method name. If SearchSnippet/get fails but Email/query and Email/get succeed, results are now returned without snippets instead of failing entirely. Improve search error messages by tracking call IDs to identify which JMAP method failed (e.g. "Email/query" instead of "unknown"). Accept bare dates (YYYY-MM-DD) in --before/--after flags, treating them as midnight UTC. RFC 3339 remains the primary format. Add mark-read command that sets the $seen keyword on emails using the same batch pattern as archive/spam/move.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves the reliability and UX of jm search (snippet method wiring, better method error context, and more flexible date flag parsing) and adds a new jm mark-read workflow to set the $seen keyword on one or more emails.
Changes:
- Fix
SearchSnippet/getinvocation naming (via wrapper) and improveSearchEmailserror messages by mapping call IDs to method names, with graceful snippet failure handling. - Accept bare
YYYY-MM-DDdates forjm search --before/--after(in addition to RFC 3339) and update CLI/docs/tests accordingly. - Add
jm mark-readcommand + client implementation, output formatting, docs, and test coverage (including live tests).
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
internal/client/email.go |
Adds searchSnippetGet wrapper, improves method-error reporting in search, and implements Client.MarkAsRead. |
internal/client/email_test.go |
Expands unit tests for snippet wiring, error mapping, graceful snippet failure, and mark-read patch structure. |
cmd/search.go |
Adds parseDate and updates --before/--after parsing + flag help text. |
cmd/mark-read.go |
New mark-read command wiring and result output. |
internal/types/types.go |
Extends MoveResult to include marked_as_read. |
internal/output/text.go |
Adds text output for MarkedAsRead. |
tests/help.md |
Updates root/help expectations for mark-read. |
tests/flags.md |
Adds CLI tests for bare-date flags and mark-read multi-arg auth behavior; updates invalid-date hint expectation. |
tests/errors.md |
Adds mark-read “missing token” error test. |
tests/arguments.md |
Adds mark-read “requires at least one argument” test. |
tests/live.md |
Adds live tests verifying mark-read marks as read and removes from unread results. |
docs/CLI-REFERENCE.md |
Documents bare-date support and the new mark-read command; updates MoveResult schema docs. |
docs/plans/todo/2026-02-10-fix-text-search-and-ux-improvements.md |
Adds a plan/design write-up capturing observed issues and intended verification steps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
SearchSnippet/getmethod name, map JMAP call IDs to method names, and degrade gracefully when snippets fail.YYYY-MM-DDdates for--beforeand--after, and by making search method errors include method and call context.jm mark-readto set$seenon one or more emails, including output/type support, docs updates, and CLI/live test coverage.Testing