Skip to content

[8.19] fix(outlook): skip unexpected item types and harden folder/account error handling (#4158) - #4178

Merged
Jan-Kazlouski-elastic merged 3 commits into
8.19from
backport/8.19/pr-4158
Jul 17, 2026
Merged

Jan-Kazlouski-elastic merged 3 commits into
8.19from
backport/8.19/pr-4158

Conversation

@Jan-Kazlouski-elastic

Copy link
Copy Markdown
Contributor

Backports #4158 to 8.19.

Related to https://github.com/elastic/sdh-search/issues/1898

Follow-up to #4147 / #4153. Auto-backport to 8.19 failed due to conflicts from the outlook/ package split on main.

Summary

  • Type allowlists on every folder iteration (Message/Meeting*, Task, CalendarItem, Contact/DistributionList); stray types are logged and skipped instead of aborting the sync.
  • Broaden per-folder skips to FOLDER_SKIP_ERRORS (ErrorFolderNotFound + ErrorManagedFolderNotFound).
  • Skip non-calendar child folders under Calendar and non-mail "Archive" folders before projecting fields.
  • Skip accounts on ErrorAccessDenied (in addition to ErrorNonExistentMailbox); connection-wide errors still propagate.
  • Attachment guards: only extract FileAttachment content; skip missing name / None size.
  • Replace the dead DEFAULT_TIMEZONE = "UTC" string fallback with exchangelib.UTC.
  • Materialize folder querysets with list(...) inside asyncio.to_thread so the blocking EWS fetch stays off the event loop.

Backport notes

Test plan

  • pytest tests/sources/test_outlook.py (94 passed)
  • ruff check / ruff format --check

Made with Cursor

…ount error handling (#4158)

Manual backport of #4158 to 8.19's monolithic outlook.py layout. Guard every
folder-iteration site against stray item types, broaden per-folder EWS skips,
skip accounts on ErrorAccessDenied, harden attachment extraction, and use
exchangelib UTC as the timezone fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic enabled auto-merge (squash) July 16, 2026 19:48
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic requested review from erikcurrin-elastic and removed request for erikcurrin-elastic July 16, 2026 19:48
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic merged commit e234ce7 into 8.19 Jul 17, 2026
4 checks passed
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic deleted the backport/8.19/pr-4158 branch July 17, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants