Skip to content

Add Strategy 0: disk-read path for get_email()#54

Merged
imdinu merged 6 commits intomainfrom
feature/0.1.7-disk-read-strategy
Mar 11, 2026
Merged

Add Strategy 0: disk-read path for get_email()#54
imdinu merged 6 commits intomainfrom
feature/0.1.7-disk-read-strategy

Conversation

@imdinu
Copy link
Copy Markdown
Owner

@imdinu imdinu commented Mar 10, 2026

Summary

  • Strategy 0 reads emails directly from .emlx files on disk — the fastest path for get_email(), bypassing JXA/Apple Events entirely
  • Extracts read/flagged status from the .emlx plist footer flags bitmask (bit 0 = read, bit 4 = flagged)
  • Extracts Date, Reply-To, Message-ID from MIME headers for full schema parity with JXA strategies
  • Falls through to existing JXA strategies if disk read fails

Based on the disk-read idea from PR #53 by @vkostakos.

Changes

File What
src/apple_mail_mcp/index/disk.py Extended EmlxEmail with 5 new fields, plist + MIME header parsing
src/apple_mail_mcp/server.py Strategy 0 cascade step before JXA strategies
tests/test_server.py Strategy 0 test + fixed existing tests for new code path

Test plan

  • 286 tests passing
  • Lint + format clean
  • Manual test with real index (get_email returns disk-read results)
  • Verify fallthrough when .emlx is missing/corrupt

🤖 Generated with Claude Code

vkostakos and others added 2 commits March 9, 2026 21:29
Implement new strategy for get_email to read directly from disk before trying JXA
Build on vkostakos's disk-read strategy to extract all fields:
- read/flagged status from .emlx plist footer flags bitmask
- date_sent, reply_to, message_id from MIME headers
- Move Strategy 0 after _enrich_attachments definition
- Add structured logging for fallthrough debugging
- Fix existing tests to mock _get_index_manager
- Add dedicated Strategy 0 test

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@imdinu imdinu force-pushed the feature/0.1.7-disk-read-strategy branch from 1cac1fa to b067ef6 Compare March 10, 2026 01:31
imdinu and others added 4 commits March 10, 2026 13:45
- Version bump to 0.1.7 in pyproject.toml and server.json
- Add CHANGELOG.md covering all releases (0.1.0–0.1.7)
- Add CONTRIBUTING.md with dev setup, architecture notes, PR guidelines
- Update CLAUDE.md with Strategy 0 cascade docs and hybrid access table
- Add plist bitmask parsing tests (read/flagged from flags integer)
- Add Strategy 0 fallthrough test (disk fail → JXA pickup)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Update all project descriptions (README, pyproject.toml, server.json,
mkdocs.yml, docs, CLAUDE.md) to lead with disk-first reads as the
headline feature alongside batch JXA and FTS5 search.

Add architecture deep-dive page with .emlx format, JXA IPC tradeoffs,
FTS5 index design, and Gemini-generated diagrams.

Add get_email benchmark scenario with dynamic message ID discovery,
re-run full competitive benchmarks, and update results.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
date_received and date_sent were both extracted from the Date header,
making them always identical. Now date_received parses the topmost
Received header (delivery time) with fallback to Date header, while
date_sent correctly uses Date (composition time).

Co-Authored-By: Claude Opus 4.6 <[email protected]>
… to README

- Add date_received fix note with rebuild instructions to CHANGELOG
- Gitignore root-level benchmark chart PNGs (duplicates of docs/)
- Add "Fetch 50 emails" row to README performance table (46x faster)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@imdinu imdinu marked this pull request as ready for review March 11, 2026 02:39
@imdinu imdinu merged commit be97ff6 into main Mar 11, 2026
1 check passed
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.

2 participants