Mirror messages whose FETCH response will not parse, and bump to 0.2.1 #33
No reviewers
Labels
No labels
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/mail-mind-mcp!33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/unparseable-fetch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #32. Also bumps the version to 0.2.1 and pins the base at
v0.2.1, so the release can be tagged from the merge commit.The bug
An unescaped
"inside an ENVELOPE or BODYSTRUCTURE string makes imapclient refuse the whole FETCH response, atresponse_lexer.py:104. The blade maps the error toserver_error, not retryable._backfilllet that error end the mailbox's pass, and the next pass restarted at the same batch. On the affected instance, Inbox stopped after about 5,100 messages and Sent after about 800.The fix (
ingest.py)_fetch_batch: on a failed batch, it first refetches the same UIDs with FLAGS only._raw_record: each bad message is mirrored from its raw bytes, which arrive as a literal and need no quoted-string parsing. The whole message is used when it fitsstore.max_text_bytes, otherwise only the header. It gets headers, addresses, threading ids, date, flags, body text and the attachment list, so it stays searchable._upload_blob, so both paths share it.Parse-error text from imapclient can include message content. With this change it no longer reaches the stored sync error from the backfill path.
Tests
tests/test_unparseable.py:AccountSession.fetchand yields the exact stored error string._fetch_batchisolates the bad UID after a FLAGS probe.make check: 84 unit tests pass.make test-integration: 7 pass against GreenMail.🤖 Generated with Claude Code