[Debt] Refactor high-complexity mail profile and transport functions #12

Closed
opened 2026-07-11 12:51:20 +02:00 by zemion · 2 comments
Owner

Xenon/Radon identify D-ranked mail profile and transport functions. These areas are security-sensitive because they handle server/credential policy inheritance and IMAP/SMTP operations.

Classification: structural maintainability work.

Report evidence:

  • _merge_policy rank D.
  • update_mail_server_profile rank D.
  • _validate_policy_against_parent rank D.
  • list_imap_messages rank D.
  • _send_smtp_payload rank D.

Suggested next steps:

  • Extract policy merge/validation into smaller pure functions with fixtures.
  • Split transport request preparation from execution and response handling.
  • Use the refactor to support the planned clearer IMAP/SMTP server/credential split.

Baseline report directory: audit-reports/govoplan-full-20260711-1238

<!-- codex-audit-full-2026-07-11:mail-complexity-baseline --> Xenon/Radon identify D-ranked mail profile and transport functions. These areas are security-sensitive because they handle server/credential policy inheritance and IMAP/SMTP operations. Classification: **structural maintainability work**. Report evidence: - `_merge_policy` rank D. - `update_mail_server_profile` rank D. - `_validate_policy_against_parent` rank D. - `list_imap_messages` rank D. - `_send_smtp_payload` rank D. Suggested next steps: - Extract policy merge/validation into smaller pure functions with fixtures. - Split transport request preparation from execution and response handling. - Use the refactor to support the planned clearer IMAP/SMTP server/credential split. Baseline report directory: `audit-reports/govoplan-full-20260711-1238`
zemion added the
type
debt
priority
p3
status
ready
module/mail
codex/ready
labels 2026-07-11 12:51:20 +02:00
zemion added the
audit/complexity
audit/structural
source/security-audit
labels 2026-07-11 16:09:08 +02:00
Author
Owner

Consolidated into govoplan-mail#10 so the complexity/audit work is handled where the server/credential split is already being implemented.

The audit evidence and suggested refactor steps were copied into #10 as folded acceptance notes. Closing this issue as consolidated, not discarded.

Consolidated into `govoplan-mail#10` so the complexity/audit work is handled where the server/credential split is already being implemented. The audit evidence and suggested refactor steps were copied into #10 as folded acceptance notes. Closing this issue as consolidated, not discarded.
Author
Owner

Codex State: done

Summary

  • Folded into mail#10: profile transport update is split into next-state calculation, policy check, and persistence helpers.
  • SMTP send handling is split into preparation, mock delivery, network delivery, and result assembly helpers.
  • Policy merge and parent-lock validation are split into focused helpers with regression coverage.

Changed Files

  • govoplan-mail/src/govoplan_mail/backend/mail_profiles.py
  • govoplan-mail/src/govoplan_mail/backend/sending/smtp.py
  • govoplan-mail/src/govoplan_mail/backend/sending/imap.py
  • govoplan-mail/tests/test_mail_profile_helpers.py
  • govoplan-mail/tests/test_smtp_helpers.py

Verification

  • python -m unittest discover -s tests (govoplan-mail)
## Codex State: done ### Summary - Folded into mail#10: profile transport update is split into next-state calculation, policy check, and persistence helpers. - SMTP send handling is split into preparation, mock delivery, network delivery, and result assembly helpers. - Policy merge and parent-lock validation are split into focused helpers with regression coverage. ### Changed Files - `govoplan-mail/src/govoplan_mail/backend/mail_profiles.py` - `govoplan-mail/src/govoplan_mail/backend/sending/smtp.py` - `govoplan-mail/src/govoplan_mail/backend/sending/imap.py` - `govoplan-mail/tests/test_mail_profile_helpers.py` - `govoplan-mail/tests/test_smtp_helpers.py` ### Verification - `python -m unittest discover -s tests (govoplan-mail)`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-mail#12
No description provided.