[gmail-safety-and-standards-hardening] #02: Domain Model Immutability & Dedup Encapsulation #21

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

Feature: gmail-safety-and-standards-hardening | Source: .scratch/gmail-safety-and-standards-hardening/issues/02-domain-model-immutability-and-dedup-encapsulation.md

02: Domain Model Immutability & Dedup Encapsulation

What to build: Refactor EmailHeader to restore immutability and provide clean domain methods for message identity and label merging (dedup_key, with_merged_labels), eliminating Feature Envy and Primitive Obsession in MailboxGateway.scan(). Centralize category mailbox prefixes into the rules registry.

Blocked by: None (can start immediately)

Status: completed

  • Add dedup_key domain property or method to EmailHeader replacing ad-hoc string formatting in gateway.py.
  • Add immutable with_merged_labels(new_labels) or clean domain method to EmailHeader instead of in-place tuple mutation in scan().
  • Move hardcoded category path prefixes (categories/, luokat/, etc.) from MailboxGateway into the rules/fixtures registry.
  • Ensure all existing and new gateway tests pass without regression.
**Feature**: `gmail-safety-and-standards-hardening` | **Source**: `.scratch/gmail-safety-and-standards-hardening/issues/02-domain-model-immutability-and-dedup-encapsulation.md` # 02: Domain Model Immutability & Dedup Encapsulation **What to build:** Refactor `EmailHeader` to restore immutability and provide clean domain methods for message identity and label merging (`dedup_key`, `with_merged_labels`), eliminating Feature Envy and Primitive Obsession in `MailboxGateway.scan()`. Centralize category mailbox prefixes into the rules registry. **Blocked by:** None (can start immediately) **Status:** completed - [x] Add `dedup_key` domain property or method to `EmailHeader` replacing ad-hoc string formatting in `gateway.py`. - [x] Add immutable `with_merged_labels(new_labels)` or clean domain method to `EmailHeader` instead of in-place tuple mutation in `scan()`. - [x] Move hardcoded category path prefixes (`categories/`, `luokat/`, etc.) from `MailboxGateway` into the rules/fixtures registry. - [x] Ensure all existing and new gateway tests pass without regression.
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#21
No description provided.