Skip to content

Conversation

@cboone
Copy link
Owner

@cboone cboone commented Feb 10, 2026

Summary

  • Fix text search snippet wiring by using the correct SearchSnippet/get method name, map JMAP call IDs to method names, and degrade gracefully when snippets fail.
  • Improve search UX by accepting bare YYYY-MM-DD dates for --before and --after, and by making search method errors include method and call context.
  • Add jm mark-read to set $seen on one or more emails, including output/type support, docs updates, and CLI/live test coverage.

Testing

  • go test ./...

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.
Copilot AI review requested due to automatic review settings February 10, 2026 22:46
Copy link
Contributor

Copilot AI left a 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/get invocation naming (via wrapper) and improve SearchEmails error messages by mapping call IDs to method names, with graceful snippet failure handling.
  • Accept bare YYYY-MM-DD dates for jm search --before/--after (in addition to RFC 3339) and update CLI/docs/tests accordingly.
  • Add jm mark-read command + 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.

Copy link
Contributor

Copilot AI left a 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.

Copy link
Contributor

Copilot AI left a 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.

@cboone cboone merged commit cb7227b into main Feb 10, 2026
7 checks passed
@cboone cboone deleted the feature/experiment branch February 10, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant