Conversation
…assertion Make cacheNeedsBuild() zero-message aware: when both the DB and sync state report 0 messages, skip the rebuild instead of triggering one on every TUI start (zero-message accounts never produce message parquet). Relax the attachment filename test to assert valid UTF-8 + prefix/suffix rather than an exact replacement character, matching the defense-in-depth intent without coupling to enmime's specific sanitization behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Eliminate per-message API calls for label changes on existing messages by applying label diffs directly from history records (AddMessageLabels / RemoveMessageLabels). Batch new message fetches via GetMessagesRawBatch and deletions via MarkMessagesDeletedBatch. For 450K deleted emails this changes the bottleneck from ~0.3 msg/s (one API call per label change) to local-only DB operations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add table-driven TestCacheNeedsBuild covering all branches: zero-message accounts, missing state files, new messages, up-to-date cache, empty parquet directories, and soft-deleted messages. Also add .claude/ to .gitignore. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cover invalid sync state JSON, DB open failure, and missing required parquet tables branches that were untested. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ListHistory was using Gmail's default page size of 100, requiring ~482 HTTP calls for 48K history records. Setting maxResults=500 (same as ListMessages) reduces this to ~97 calls, cutting scan time from ~54s to ~11s. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Author
|
This speeds up incremental sync a LOT after bulk deletions (I deleted more than 500K e-mails so stumbled on the need to do this) |
wesm
added a commit
that referenced
this pull request
Feb 8, 2026
Re-apply the NotFoundError handling in GetMessagesRawBatch that was lost during the squash merge of PR #108: messages deleted between history scan and fetch are expected during incremental sync, so log at debug instead of warn. Add TestGetMessagesRawBatch_LogLevels to verify 404s produce debug logs while other errors produce warn logs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
maxResults=500on History API: Reduces pagination round-trips from ~482 to ~97 for large history gaps, cutting scan time from ~54s to ~11s.cacheNeedsBuildfor zero-message accounts: Prevent rebuild loop when DB and sync state both agree there are 0 messages.TestCacheNeedsBuild: 10 table-driven test cases covering all branches (zero-message, missing state, new messages, up-to-date, empty cache, soft-deleted, invalid state, DB failure, missing required tables)..claude/to.gitignoreTest plan
AddMessageLabels,RemoveMessageLabels,MarkMessagesDeletedBatchTestCacheNeedsBuildwith 10 cases covering all branchesgo test ./internal/sync/ ./internal/store/ ./cmd/msgvault/cmd/ -count=1🤖 Generated with Claude Code