feat: support --after/--before date filtering for IMAP sync#222
Merged
Conversation
roborev: Combined Review (
|
Invalid date strings were silently ignored, causing the sync to fall back to fetching the entire mailbox. Now returns a clear error with the expected YYYY-MM-DD format. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move date flag validation to the top of syncFullCmd.RunE so malformed dates are rejected before opening the database or iterating sources. Previously, in a mixed Gmail+IMAP setup, Gmail sources could sync successfully before the IMAP client builder rejected the bad date. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test now writes client secrets and a fake token so the Gmail source passes discovery checks. Without the early validation, Gmail would be selected for syncing before the IMAP source rejects the malformed date — making this a proper regression test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
roborev: Combined Review (
|
sternryan
added a commit
to sternryan/msgvault
that referenced
this pull request
Apr 26, 2026
Reconciles 172 ahead / 37 behind state with upstream wesm/msgvault. Strategy: accept upstream wholesale for connector code (M365, iMessage, gvoice, IMAP XOAUTH2) where upstream's implementations are more battle-tested and already cover the fork's bug fixes. Hand-resolve store/sync/search/cmd/build files to union both feature sets. Preserved from fork: - SQLCipher encryption-at-rest (passphrase, AES-GCM token encryption) - Advisory file locking (tryLock, lockFile, syscall.Flock) - AI Archive Intelligence subsystem (internal/embedding/, vec_messages, pipeline_runs, --semantic search) - Web UI (React/TypeScript SPA in web/) - Hot-path search tokenizer (dispatchToken, toLowerFast, parseSizeFast) - migrateAddContentID, InitVectorTable, content_id attachment column Adopted from upstream: - Dialect interface + loggedDB wrapper + structured logging pipeline (kenn-io#276 PostgreSQL dialect refactor foundation) - OpenReadOnly() for MCP read-only access - IsBusyError, SchemaStale helpers - Unified text import (kenn-io#238) — M365 OAuth (kenn-io#228), iMessage (kenn-io#224), Google Voice (kenn-io#225) — all wholesale - Search enhancements: regex, FTS5 snippets, sorting (kenn-io#252), domain normalization (normalizeAddr, looksLikeDomain, gTLDs) - rebuild-fts command (kenn-io#287), 8 bug fixes from kenn-io#254 - IMAP date filtering (kenn-io#222), greeting wait (kenn-io#248) - Vector subsystem (kenn-io#277) — coexists with fork's AI Archive Intelligence as parallel implementation; future cleanup needed Build/runtime fixes applied during merge: - Replaced mattn/go-sqlite3 imports with mutecomm/go-sqlcipher/v4 (drop-in API-compatible) to resolve duplicate symbol linker errors - Dropped sqlite_vec from default BUILD_TAGS (requires SQLite 3.38+ APIs sqlcipher v4.4.2 does not expose; re-enable when sqlcipher upgrades) - safeRowsAffected helper in db_logger.go: defer recover around RowsAffected() call (sqlcipher returns nil internal Result for multi-statement DDL) - Wired normalizeAddr into hot-path tokenizer for from:/to:/cc:/bcc: Stubbed under unreachable build tag (need follow-up decision): - cmd/msgvault/cmd/sync_gvoice.go — fork's sync API obsolete vs upstream's import-based gvoice - cmd/msgvault/cmd/sync_imessage.go — same situation Verified: go build ./... passing, go vet clean, 45/45 test packages pass with 0 failures. See MERGE_REPORT.md for file-by-file resolution notes.
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.
Summary
--after/--beforeflags through to IMAPSEARCH SINCE/BEFOREcriteria instead of ignoring them--query(which has no IMAP equivalent); date flags now work nativelyThis makes recurring IMAP syncs practical — scanning a rolling window via
--afterinstead of enumerating the full mailbox each time.Tested locally:
--afterwith a recent date narrowed the server-side scan dramatically.--
IIRC this is how the repo handles invalid date formats more generally (e.g. for Gmail too).
Solves this issue: #195
🤖 Generated with Claude Code