Skip to content

Handle both mailboxes#190

Open
cooper-grc wants to merge 3 commits intomainfrom
cg/outlook-mailbox
Open

Handle both mailboxes#190
cooper-grc wants to merge 3 commits intomainfrom
cg/outlook-mailbox

Conversation

@cooper-grc
Copy link
Copy Markdown
Contributor

@cooper-grc cooper-grc commented Apr 7, 2026

Summary by cubic

Adds first-class support for both Gmail and Outlook mailboxes with provider-scoped thread fetching and de-duplication. Thread messages now include a millisecond Timestamp for consistent cross-provider sorting.

  • New Features

    • Unified fetching via EmailThreadRef (ID + integration) with provider-qualified keys to prevent duplicates; messages include Timestamp (ms) for stable ordering.
    • Outlook support: fetch conversation messages, detect sender via profile, strip HTML bodies, and add deeplinks using sourceclients.OutlookClient.
    • Better provider detection: prefers explicit integration in metadata/data; also infers from _tool, conversation_id/conversationId, thread_id/threadId, and URLs in email_link/uri or deeplink.
    • Mailbox endpoint requires integration=all|gmail|outlook; filters outputs to the selected provider and aggregates threads from outputs and row cells (cell thread_ids are scoped by the selected provider).
    • Row detail reads threads from cell or outputs for both providers, uses provider-scoped keys, and falls back to synthetic threads when needed.
    • Added types.Teams integration metadata (read/write).
  • Migration

    • Pass the integration query param to /api/v1/views/:view_id/mailbox (all, gmail, or outlook); missing param returns 400.
    • Prefer setting integration in email outputs; otherwise it’s inferred from IDs/links.
    • Use conversation_id/conversationId (or an Outlook link) for Outlook; use thread_id/threadId (or a Gmail link) for Gmail. Row cell thread_id can remain comma-separated; the selected integration determines which mailbox is used.

Written for commit bb8effc. Summary will update on new commits.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

✅ Integration Tests PASSED

Gateway: https://api.airstore.ai
Query path: /sources/gmail/unread-emails
Timestamp: 2026-04-07T20:57:22Z

I/O Smoke Tests

Test Status Latency Bytes
list_sources PASS 241ms -
list_gmail PASS 323ms -
list_query_path PASS 541ms -
read_file PASS 375ms 1,724
stat_file PASS 235ms 69,626

Compression A/B Tests

Metric Value
Files tested 8
Total raw bytes 73,033
Total strip bytes 46,330
Total raw tokens 41,729
Total strip tokens 27,530
Tokens saved 14,199
Byte reduction 36%
Token reduction 34%
Min threshold 10%
Cache consistent Yes
Per-file results
File Raw B Strip B Raw Tok Strip Tok Tok Saved Red% Raw ms Strip ms
2024-10-15_Harris-Walz_Organizing_Tea... 2,337 2,305 976 967 9 1% 363ms 246ms
2024-10-15_Stephen_King_via_KamalaHar... 2,904 2,866 1,116 1,103 13 1% 365ms 247ms
2025-07-17_KAYAK_How_to_have_everythi... 1,724 1,670 1,220 1,204 16 3% 242ms 227ms
2025-07-17_Alamo_Drafthouse_Cinema_Th... 19,047 18,224 12,228 11,704 524 4% 416ms 304ms
2025-07-17_Alamo_Drafthouse_Cinema_Th... 18,978 18,155 12,105 11,578 527 4% 465ms 310ms
2024-10-15_Knut_at_Sanity_Join_us_tom... 1,272 726 504 209 295 42% 352ms 247ms
2025-07-17_Lindsay_Stanley_TODAY_Conf... 1,876 1,049 657 268 389 44% 386ms 245ms
2025-07-17_NORDSTROM_RACK_FLASH_Travi... 24,895 1,335 12,923 497 12,426 94% 467ms 256ms

Charts

Overall Compression
Raw vs Compressed Bytes
Token Comparison
Reduction by File
Read Latency
I/O Latency

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="pkg/views/email_threads.go">

<violation number="1" location="pkg/views/email_threads.go:450">
P2: `receivedAt.UnixMilli()` returns `-62135596800000` when `ReceivedTime()` returns the zero `time.Time` (parse failure). Guard with a zero check so the behaviour matches the Gmail path, which defaults to `0`.</violation>

<violation number="2" location="pkg/views/email_threads.go:653">
P2: HTML tag matching is case-sensitive, so Outlook emails with uppercase tags (e.g., `<BR>`, `</P>`) lose line breaks. Lowercase the input before the tag-replacement pass, or use a case-insensitive approach such as `strings.EqualFold` / `regexp.MustCompile(`(?i)...`)`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant