Repository navigation
fix(platform): scope the mail sync to the Inbox and learn its address - #4038
Merged
Merged
Conversation
Two defects compounded into inverted threads: the mailbox's own sent mail opened conversations with the mailbox as the contact, and every reply from the other party rendered as the team's. The sync's inbox pass was not scoped to the Inbox. Gmail's listing carried no label, and users.messages.list without one answers every message, Sent included; Outlook's listing hit /me/messages, which spans every folder. The pass now names the folder both ways (labelIds INBOX, folder inbox), as the sent pass already did. An OAuth mailbox had no address of its own: config.fromAddress existed only for IMAP, mirrored from the login, so the ingest fell back to "the root sender is the customer" — true for a customer's mail, wrong for the mailbox's. Gmail and Outlook gain a get_profile action and the sync's first pass asks it once, keeps the answer on config.fromAddress (the Inbox header and composer read it there too) and hands it to the ingest as accountEmail. A provider that cannot answer leaves the pass to run as before. Existing inverted threads are left as they are; the sync tests pin the listing inputs and the heal, the guide says what a pass reads, and CONV-F38 covers the live check.
# Conflicts: # services/platform/tests/manual/reference/automation.md # services/platform/tests/manual/suites/conversations.md
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.
Why
A Gmail thread the mailbox owner had started showed the owner as the contact and every reply from the other party as the team's (right-hand) message. Six of the dev org's Gmail conversations look like this. Two pre-existing defects compound:
listFolderset no label for Gmail —users.messages.listwithout one answers every message, Sent included — and no folder for Outlook, whose/me/messagesspans every folder. The mailbox's own sent mail became the root of a new conversation.config.fromAddressexisted only for IMAP (mirrored from the login), soresolveDirectionhad nothing to compare against and the ingest fell back to "the root sender is the customer" — right for a customer's mail, inverted for the mailbox's.What
listFolder: GmaillabelIds: INBOX/ Outlookfolder: inboxon the inbox pass (the sent pass already namedSENT/sentitems). The triage listing already saidin:inbox; the sync now agrees.get_profileon the Gmail (users/me/profile) and Outlook (/me?$select=mail,userPrincipalName, already used byformat: email) connectors.healOAuthFromAddress— the IMAP heal's twin — runs on the first pass whose public config resolves no address, keeps the answer onconfig.fromAddress(the Inbox header and composer read it there too) and hands it to the ingest asaccountEmail. Steady state costs nothing; a provider that cannot answer is logged and the pass runs as before.withFromAddressgeneralises the IMAP helper;withImapFromAddressdelegates to it.builtin.mdEN/DE/FR): what a pass reads and how it knows the mailbox's own address. Manual boxCONV-F38, coverage row.Not in scope (by decision): repairing existing inverted threads, and syncing Gmail/Outlook Sent so replies from the mail client appear in the thread.
Proof
sync_mailbox.test.ts: the Gmail/Outlook listing inputs now pinlabelIds: 'INBOX'/folder: 'inbox'; the heal reads the profile with the listing credential before the list, patches the credential config, handsaccountEmailto the ingest, tolerates a failing profile call, and does not ask again once the config resolves.imap_from_address.test.tscoverswithFromAddress. Typecheck, type-aware lint,configs:validate, registry tests,lint:manual,@tale/docs testgreen.fromAddressand open no thread with the mailbox as contact.