Repository navigation
fix(tools/mail-source/imap): accept bare Message-IDs - #1953
xiaobai0529 wants to merge 2 commits into
Conversation
Normalize caller-supplied thread IDs at the read and archive-link boundaries so the documented bare and bracketed forms resolve to the same thread. Generated-by: Codex (GPT-6)
Keep caller-side bare Message-ID normalization separate from the bracketed-token rule used for mail headers. Generated-by: Codex (GPT-6)
Kaap10
left a comment
There was a problem hiding this comment.
Thanks for the clean fix @xiaobai0529!
Separating caller input normalization (canonical_thread_id) from mail header parsing (normalise_message_id) is a very thoughtful design choice that keeps RFC 5322 header extraction strict while accepting bare inputs per contract:mail-source. The regression tests in test_operations.py, test_threads.py, and test_config_and_urls.py cover the equivalence nicely.
There is just one pre-commit check to address so CI can turn green:
Line Endings (CRLF to LF)
The 6 modified files were committed with Windows CRLF (\r\n) line endings. Apache Magpie's mixed-line-ending pre-commit hook enforces LF (\n).
You can normalize line endings and amend your commit with:
git add --renormalize .
git commit --amend --no-edit
git push --force-with-leaseAlternatively, running prek run mixed-line-ending --all-files will automatically convert them to LF.
(Left one minor nit inline in read_thread.py as well). Once line endings are normalized, this is good to go!
potiuk
left a comment
There was a problem hiding this comment.
Makes read_thread and thread_url accept a bare Message-ID and return the bracketed form, as the mail-source contract asks; the other three operations that take a thread id still need the same treatment.
GitHub has not yet computed whether this branch merges cleanly with its base.
Smaller observations
- See inline comments on
tools/mail-source/imap/src/imap_source/threads.py:49.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The findings
below are observations, not blockers; an Apache Magpie
maintainer — a real person — will take the next look at the
PR. If you think a finding is mis-applied, please reply on
the PR and a maintainer will weigh in.More on how Apache Magpie handles maintainer review:
Contributing guide.
|
The remaining operations ( |
potiuk
left a comment
There was a problem hiding this comment.
This fixes read_thread and thread_url for bare Message-IDs as #1924 asks, with tests for both spellings. The same fix for create_draft, list_drafts and list_sent_since follows in #1962, so this can go in as it is. Approving.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.More on how Apache Magpie handles maintainer review:
Contributing guide.
|
Thanks! Your two commits landed in |
Summary
read_threadreturn the documented bracketed identifier and makethread_urlreport the same canonical value for either accepted input form.Type of change
tools/*/withpyproject.toml)Test plan
uv run pytest -q(34 passed)uv run ruff check src testsuv run ruff format --check src testsuv run mypy src testsprek run --all-files --skip workspace-pytestprek run workspace-pytest --from-ref origin/main --to-ref HEADThe new regression failed before the fix because
read_threadcompared the bare caller input verbatim. The same test passes after normalization.thread_urlalso now returns the canonical bracketed ID instead of echoing the bare spelling.RFC-AI-0004 compliance
No RFC-AI-0004 surface changes: the patch adds no new mutation, network access, skill behavior, or write-access path.
Linked issues
Closes #1924
Generative AI disclosure
Generative AI was used. Codex (GPT-6) helped implement the patch, tests, and this description. The contributor reviewed the full diff, confirmed understanding, and takes ownership of responding to review feedback.