[gmail-safety-and-standards-hardening] #06: Encapsulate Label Queries on Domain Model #25
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Reference
Lavisys/mailsweep#25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Feature:
gmail-safety-and-standards-hardening| Source:.scratch/gmail-safety-and-standards-hardening/issues/06-encapsulate-label-queries-on-emailheader.md06: Encapsulate Label Queries on Domain Model
What to build: Add domain query properties and methods to
EmailHeader(normalized_labels,has_label(),is_promotional,is_social), eliminating Primitive Obsession and Feature Envy inClassificationEngine.classify(). Remove unrequested top-level export ofDEFAULT_GMAIL_CATEGORY_PREFIXES.Blocked by: None (can start immediately)
Status: ready-for-agent
normalized_labelsproperty toEmailHeader.has_label(label: str) -> bool,is_promotional -> bool, andis_social -> booltoEmailHeader.ClassificationEngine.classify()insrc/mailsweep/classifier.pyto use domain methods instead of ad-hoc set comprehensions.DEFAULT_GMAIL_CATEGORY_PREFIXESfrom__all__insrc/mailsweep/__init__.py.test_mailsweep.pyverifying label query methods and backwards-compatibility.Implemented label query encapsulation on
EmailHeader(normalized_labels,has_label(),is_promotional,is_social), refactoredClassificationEngine.classify()to eliminate primitive obsession, removedDEFAULT_GMAIL_CATEGORY_PREFIXEStop-level export, and added unit tests in commit3a13959.