Conversation
roborev: Combined Review (
|
Allows scoping search results to a single account when multiple accounts are synced into the same archive. Resolves the account identifier to a source_id via GetSourceByIdentifier and sets q.AccountID directly on the parsed search.Query, which buildSearchQueryParts already handles. No interface changes needed.
The --account flag was silently ignored when remote mode was active, giving users unfiltered results without any indication. Fail fast with a clear error instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move account resolution before the IsEmpty() check so that `search --account foo@bar.com` lists all messages for that account. Add AccountID to Query.IsEmpty() and accept zero positional args when --account is provided. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract aggregate flags, aggregate output formatters, formatSize, and printJSON into output.go. These utilities are used by list-labels, list-domains, list-senders, show-message, and create-subset — not search-specific. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Reject --account in remote mode with clear error - Accept --account without positional search terms (local mode) - Require at least a query or --account flag - Query with only AccountID set is not empty Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Assert Execute() returns nil and seed two accounts with messages to verify the --account filter includes the correct account and excludes the other. Use stdout capture to check JSON output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use io.ReadAll in a goroutine to fully drain the pipe, preventing truncation on large output and deadlock if the command fills the OS pipe buffer. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6fbb1a0 to
ed87911
Compare
When --account is not set, check IsEmpty() before store.Open so that bad input like "before:not-a-date" gets rejected without touching the database. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
- TestSearchCmd_InvalidQueryFailsFastWithoutDB: config points at a non-existent directory, so any DB access would fail; asserts that "before:not-a-date" returns "empty search query" without touching the database. - TestSearchCmd_AccountFlagDoesNotLeakAcrossInvocations: runs two back-to-back Execute() calls, first with --account and then without, verifying the second search is not account-filtered. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
…port * origin/main: Add --account flag to search command (#165)
Add
--accountflag tomsgvault searchto scope results to a single account when multiple accounts are synced into the same archive.The flag also works standalone to list all messages for an account:
Additional fixes included in this PR:
--accountin remote mode with a clear error instead of silently ignoring itAccountIDtoQuery.IsEmpty()so it is treated as a valid filter criterionformatSize,printJSON, aggregate formatters) fromsearch.gointooutput.goCloses #164.