- Ya
- 9 Agosti 2026, 04:41 UTC
- Mwandishi
- Kamo
- Ahadi ya
- 8fa2944
SearchIndexService wrote sizeBytes = 0 for every message it ever indexed, under the comment "Not available from envelope". It was available — the fetch profile simply never asked for it. Every row in email_metadata.search_index is 0 bytes in production, so mailbox storage reads as zero for every organization, and any storage accounting built on the index would have inherited that. - EmailImapService adds FetchProfile.Item.SIZE, so RFC822.SIZE is prefetched with the envelope rather than costing a round trip per message, and toEnvelope carries it through. - GraphMailProvider selects "size", the same quantity, so mailbox totals mean the same thing whichever provider an organization is on. - EmailSizeBackfillService repairs the rows already written, in bounded batches grouped by (member, folder) so each group is one IMAP round trip. A UID the folder no longer holds is left unsized rather than recorded as zero — zero and unknown are not the same, and conflating them would permanently understate the mailbox. Also adds EmailImapService.messageSizes, which reads sizes for a UID set in one round trip; re-deriving them via getMessage would fetch entire message bodies to read a number the server publishes in the envelope. 6 new tests, 146 total, all passing.