fix(gmail): make void inbox mirror Gmail's INBOX label - #64
Open
MaximeGaudin wants to merge 1 commit into
Open
Conversation
void inbox and `gmail search 'in:inbox'` disagreed on the same mailbox (#63). Three causes: - refresh/initial sync listed INBOX with newer_than:7d and reconciled against that partial set, archiving older INBOX mail locally and never fetching it. Now lists the complete INBOX (500/page, 20-page cap) and skips reconcile with a warning if the cap truncates. - an expired historyId (404) deserialized into an empty history response, so incremental sync failed silently forever. Now surfaces GmailError::HistoryExpired and falls back to a full INBOX refresh with a fresh historyId. - list_messages/get_message ignored HTTP status, so API errors parsed as empty lists — a transient failure during refresh would archive every message locally. Now error_for_status() is enforced. Also documents the thread-level inbox mapping in the README. Fixes #63
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.
Fixes #63
Summary
void inbox --connector gmailandvoid gmail search 'in:inbox'returned different sets for the same mailbox. Three independent bugs caused the drift:initial_sync/refresh_inboxlisted INBOX withnewer_than:7d, thenreconcile_inboxarchived every message not in that partial set. INBOX mail older than 7d was never fetched and actively archived locally (the "in Gmail INBOX but not void inbox" orphans).historyIdfailed silently — Gmail returns 404 once history is purged; the error body deserialized into an emptyHistoryListResponse, so incremental sync no-oped forever and archive-state drift persisted until daemon restart (the "in void inbox but not Gmail INBOX" stragglers).list_messages/get_messageignored HTTP status, so a transient 4xx/5xx during refresh yielded an empty INBOX set and reconcile archived every message locally.Changes
refresh_inboxlists the complete INBOX (no date filter, 500/page, 20-page cap); reconcile is skipped with a warning if the cap truncates, so a partial listing can never archive live INBOX mail. Bodies are fetched only for unknown messages.initial_syncnow reuses this path.incremental_syncfalls back to a full INBOX refresh and resumes from a freshhistoryIdon expiry.error_for_status(); history 404 maps to a newGmailError::HistoryExpired.*_with_apivariants for mock-server testing.void inboxmirrors Gmail'sINBOXlabel and is thread-level (latest unarchived message per thread) vs the message-levelgmail searchlisting (issue point 3).Testing
qparam absent, both archive directions, new-message fetch) and history-404 fallback (reconcile + freshhistoryId).Existing installations self-heal on the next sync: reconcile un-archives everything still labeled
INBOXin Gmail.