Skip to content

fix: prevent mailbox parsing from expanding delivery recipients - #117

Merged
LIghtJUNction merged 2 commits into
mainfrom
fix/single-mailbox-delivery-20260928
Sep 28, 2026
Merged

LIghtJUNction merged 2 commits into
mainfrom
fix/single-mailbox-delivery-20260928

Conversation

@LIghtJUNction

Copy link
Copy Markdown
Member

Scope

Refs #81, #85. Narrow follow-up to #114, based on merged #115 (eb67b5a3976fd520668a2b302b74df62cf207667). No umbrella issue is closed.

A delivery/email endpoint must represent one exact mailbox. The previous regex accepted some header/list syntax, while SMTP.send_message() inferred envelope recipients from To/Cc/Bcc. This could change the recipient set despite matching the stored endpoint string.

Changes

  • One shared core validator for market binding and SMTP: reject lists/groups/display names/comments, parser-recovered syntax, controls and normalization to a different mailbox. Preserve ordinary addresses, SMTPUTF8 and valid quoted-comma local parts.
  • Revalidate every queued recipient, including verification mail and legacy jobs, before opening SMTP or reading SMTP credentials.
  • Give stdlib send_message an explicit singleton to_addrs; never derive recipients from headers.
  • Retain refactor: reuse delivery guards and derive order email status from EffectJob #114 buyer/endpoint-generation checks and EffectJob-only state; leave workers/effects.py, leases.py, account authorization, order state machine and all published Operation versions unchanged.
  • Update existing msg.security rule to v3 and _index to v4, preserving rule IDs.

Evidence

Local Python 3.13.5: PYTHONPATH=src python -m pytest -q tests/test_single_mailbox_delivery.py

  • Before production changes: 73 failed, 54 passed.
  • After: 127 passed, 0 failed, 0 skipped.
  • Uses the real stdlib email parser, send_message and serializer with only the SMTP transport replaced by a recording subclass. Checks explicit and actual envelope recipients, invalid targets never connect, legacy verified rows fail closed, and after-DATA uncertainty is unchanged. No external mail is sent.
  • Final head 4be8a9d2c9107a3254162e1433b3478f39400fd0, tree aa6241d577e95ed867b7aa038402f0786ffe5ce0.

Target Python3.15/PostgreSQL16/Valkey9 four-shard CI, exact node-ID gate, conformance and wheel/sdist are still required before merge. Local unit evidence is not production SMTP or full lifecycle acceptance.

A/B/C retain their declared files/branches. No deployment, production Root/PIN/keys/funds, recovery, destructive cleanup or real outbound notifications.

Share a strict addr-spec validator between market recipient binding and the SMTP boundary. Revalidate legacy jobs before opening a connection and explicitly pin a singleton envelope recipient. Preserve SMTPUTF8, quoted comma local parts, current buyer/endpoint generation checks and uncertain semantics.

127 local regressions passed (Python 3.13.5; stdlib SMTP parser/serializer with a recording transport, no external sends). Before fix: 73 failed, 54 passed. Update versioned security rule and _index. Refs #81, #85.
Copilot AI lite review requested due to automatic review settings September 28, 2026 09:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-28T09:15:40.134185Z 4be8a9d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

CI36401618834 correctly rejected the initial msg.security shard at 233 tokens (>200). Compress prose while retaining root/secret isolation, release-owned rules, EffectJob-only mail state, explicit buyer acceptance and single-mailbox SMTP binding. Do not change the tokenizer, token budget or test assertions.

Production source and all 127 mailbox regressions are unchanged; local tests still pass. Final-head full CI remains required. Refs #81, #85.

Copy link
Copy Markdown
Member Author

目标CI发现并已修复一项真实文档回归:初始head4be8a9d在CI36401618834的security规则为233 tokens,超过既有200预算。仅压缩正文为新head 1e66532c450c0dad0233a956f3b9a713c1783f16 / tree ad0a3055f79470a370af680722a78562de6efa23,原tokenizer/阈值/断言未改,全部生产代码和127个邮箱回归不变。

最终head CI36403033365正在完成剩余分片;现已下载并校验分片0/1/3的provider SHA-256,355/386/342真实JUnit node IDs均与manifest精确一致且零失败/错误/跳过,shard0另有8 conformance及wheel/sdist。之前失败的规则测试已在新shard3通过;六个变更文件与新sdist字节完全一致。尚不把部分产物当完整成功。组合恢复PR#118已包含这个最终规则版本。

Copy link
Copy Markdown
Member Author

最终串行核验完成:head 1e66532c450c0dad0233a956f3b9a713c1783f16,tree ad0a3055f79470a370af680722a78562de6efa23,完整CI36403033365及contracts gate成功。已下载全部四份产物,逐一核provider SHA-256,并独立比较真实JUnit msg.nodeid和manifest:355/386/386/342=1469 core,完整互斥并集、0重复/缺失、0失败/错误/跳过;8 conformance及wheel/sdist通过。发布包中的全部六个变更文件与审查源码逐字一致。

当前0个未解决review threads;Codex安全review覆盖生产代码初始head4be8a9d,此后仅压缩security规则且人工复核约束完整,Copilot配额失败不当作批准。未放宽原200-token预算;第一次失败如实保留。

将以固定head合并。此切片修复单邮箱被SMTP展开,不宣称完成#81完整现场SMTP、#85全部架构迁移或任何生产验收。

@LIghtJUNction
LIghtJUNction merged commit 072776f into main Sep 28, 2026
10 checks passed
LIghtJUNction added a commit that referenced this pull request Sep 28, 2026
…rization

Preserve #112/#116 recovery history and merged #115/#117 guards. Exact combined tree 1a8a28f passed CI36404029543 and Recovery safety36404029733: 1544 core + 8 conformance, four SHA-verified artifacts with exact disjoint JUnit node IDs, zero failures/errors/skips, wheel/sdist. Both integration-test failures fixed without changing quarantine or OS-admin/console gates. Reviewed exact head. Refs #64, #65, #68, #69, #70, #81, #83, #84, #85. Full policy promotion and production field evidence remain incomplete; no production actions.
@github-actions
github-actions Bot deleted the fix/single-mailbox-delivery-20260928 branch September 28, 2026 10:15
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