polish(mail): consistency guards (PR #935 round-7)
Non-blocking consistency fixes: - scanner.py: skip re-queuing a mail_message whose placeholder status is "failed" (mirrors the file scanner's permanent-failure guard); the modified_at branch still retries once the message changes. - search/context.py: return None on an empty get_message payload during context expansion, mirroring the processor's index-time empty-payload guard. - tests: cover the non-numeric mailbox_id fail-open branch in the verifier. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
10e768e414
commit
15042c1b1b
@@ -303,6 +303,22 @@ async def test_verify_mail_missing_mailbox_id_keeps(mocker):
|
||||
list_messages.assert_not_awaited()
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
async def test_verify_mail_non_numeric_mailbox_id_keeps(mocker):
|
||||
"""A non-numeric mailbox_id in metadata is kept without a list call."""
|
||||
list_messages = mocker.AsyncMock()
|
||||
mail_client = SimpleNamespace(list_messages=list_messages)
|
||||
client = SimpleNamespace(mail=mail_client, username="alice")
|
||||
|
||||
result = await _verify_mail_messages(
|
||||
client,
|
||||
[_make_result(42, doc_type="mail_message", metadata={"mailbox_id": "bad"})],
|
||||
_sem(),
|
||||
)
|
||||
assert result == {"42"}
|
||||
list_messages.assert_not_awaited()
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
async def test_verify_mail_non_numeric_id_kept_when_mailbox_listed(mocker):
|
||||
"""A malformed doc_id can't match the numeric listing, so it's kept."""
|
||||
|
||||
Reference in New Issue
Block a user