[gmail-safety-and-standards-hardening] #05: Decouple IMAP Protocol Extension Codecs #24

Closed
opened 2026-08-28 17:32:18 +03:00 by jalmari · 1 comment
Owner

Feature: gmail-safety-and-standards-hardening | Source: .scratch/gmail-safety-and-standards-hardening/issues/05-decouple-imap-extension-codecs.md

05: Decouple IMAP Protocol Extension Codecs

What to build: Extract pure IMAP text decoding for X-GM-MSGID and X-GM-LABELS out of gateway.py and into codecs.py (parse_gmail_msgid and parse_gmail_labels) to strictly adhere to ADR-0004.

Blocked by: None (can start immediately)

Status: ready-for-agent

  • Implement parse_gmail_msgid(response_str: str) -> str in src/mailsweep/codecs.py.
  • Implement parse_gmail_labels(response_str: str) -> tuple[str, ...] in src/mailsweep/codecs.py.
  • Refactor MailboxGateway.fetch_headers() in src/mailsweep/gateway.py to use these pure codec functions.
  • Add unit tests in test_mailsweep.py verifying parsing of plain labels, quoted labels, system flags, and empty responses.
**Feature**: `gmail-safety-and-standards-hardening` | **Source**: `.scratch/gmail-safety-and-standards-hardening/issues/05-decouple-imap-extension-codecs.md` # 05: Decouple IMAP Protocol Extension Codecs **What to build:** Extract pure IMAP text decoding for `X-GM-MSGID` and `X-GM-LABELS` out of `gateway.py` and into `codecs.py` (`parse_gmail_msgid` and `parse_gmail_labels`) to strictly adhere to ADR-0004. **Blocked by:** None (can start immediately) **Status:** ready-for-agent - [ ] Implement `parse_gmail_msgid(response_str: str) -> str` in `src/mailsweep/codecs.py`. - [ ] Implement `parse_gmail_labels(response_str: str) -> tuple[str, ...]` in `src/mailsweep/codecs.py`. - [ ] Refactor `MailboxGateway.fetch_headers()` in `src/mailsweep/gateway.py` to use these pure codec functions. - [ ] Add unit tests in `test_mailsweep.py` verifying parsing of plain labels, quoted labels, system flags, and empty responses.
Author
Owner

Completed in commit 58928fe.

  • Implemented parse_gmail_msgid(response_str: str) -> str in src/mailsweep/codecs.py.
  • Implemented parse_gmail_labels(response_str: str) -> tuple[str, ...] in src/mailsweep/codecs.py with full RFC 3501 quoted string support.
  • Refactored MailboxGateway.fetch_headers() in src/mailsweep/gateway.py to use pure codec functions.
  • Added unit test coverage in test_mailsweep.py verifying plain labels, quoted labels, system flags, and empty responses.
  • 107/107 tests passing.
Completed in commit `58928fe`. - Implemented `parse_gmail_msgid(response_str: str) -> str` in `src/mailsweep/codecs.py`. - Implemented `parse_gmail_labels(response_str: str) -> tuple[str, ...]` in `src/mailsweep/codecs.py` with full RFC 3501 quoted string support. - Refactored `MailboxGateway.fetch_headers()` in `src/mailsweep/gateway.py` to use pure codec functions. - Added unit test coverage in `test_mailsweep.py` verifying plain labels, quoted labels, system flags, and empty responses. - 107/107 tests passing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Lavisys/mailsweep#24
No description provided.