cleanup_unused_content decides whether to delete a deduplicated blob by
running a Tantivy Count of envelopes referencing each content_hash. The
searcher it used reflected only the committed index state at the time it
was built, so an envelope that shared a content hash but was still
sitting uncommitted in the IndexWriter buffer (for example added by the
background ingest task before the delete operation acquired the writer
lock) was invisible to the count. The count read 0 and a
still-referenced blob was deleted, permanently 404ing that envelope's
download-message.
Pass the locked IndexWriter into cleanup_unused_content and fatal_commit
it immediately before creating the searcher. create_searcher already
reloads the reader, so the Count is now evaluated against a fully
committed, freshly-reloaded index state. The barrier is local to the GC
path and self-contained, independent of what the caller committed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add GET /envelope/{account_id}/{message_id} endpoint to retrieve message envelope (metadata)
- Add get_envelope_by_id method to ENVELOPE_INDEX_MANAGER for querying single envelope
- Move message_id from query parameter to path parameter for clearer API paths:
- /message-content/{account_id}/{message_id}
- /download-message/{account_id}/{message_id}
- /download-attachment/{account_id}/{message_id}
- /envelope/{account_id}/{message_id}
- Fix API documentation descriptions to be more accurate:
- search_messages: Now correctly describes search functionality
- get_thread_messages: Mentions thread_id requirement
- proxy endpoints: Fixed copy-paste errors from OAuth2 docs
- Update frontend API client to use new path-based URLs
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix Path import in message.rs, account.rs, mailbox.rs, oauth2.rs,
and auto_config.rs to use poem_openapi::param::Path instead of
poem::web::Path
- This ensures path parameters appear in OpenAPI/Swagger documentation
- Update frontend API calls to use message_id parameter
- Add parameter documentation comments for better API clarity
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rename the `id` query parameter to `message_id` in three message API
endpoints for better API clarity and consistency:
- GET /api/v1/message-content/:account_id
- GET /api/v1/download-message/:account_id
- GET /api/v1/download-attachment/:account_id
This is a breaking change for API clients that use these endpoints.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>