refactor(domain): consolidate Feed aggregate invariants in domain/feed.ts
Gather the feed's scattered business rules — expiry, sender allow/block policy, and the email byte-size budget — into one framework-agnostic module. Expiry was duplicated across feed-service, email-processor and the rss/atom/entries routes; the sender policy and trim loop lived inline in email-processor. Each now calls a single function (isExpired, applySenderPolicy, trimToByteBudget, resolveExpiresAt). Drops the now-unused MAX_METADATA_EMAILS constant. Behaviour-preserving; adds feed.test.ts covering every invariant. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
1 parent
2b3f00f7e3
commit
6b51173722
8 files changed
+250
-114
No files matched your search
@@ -16,9 +16,6 @@ export const ADMIN_COOKIE_MAX_AGE = 60 * 60 * 24 * 7; // 1 week
|
||||
/** Maximum number of feed items exposed in RSS/Atom responses. */
|
||||
export const MAX_FEED_ITEMS = 20;
|
||||
|
||||
/** Maximum number of email entries kept in feed metadata. */
|
||||
export const MAX_METADATA_EMAILS = 50;
|
||||
|
||||
/** Default WebSub lease duration (seconds). */
|
||||
export const DEFAULT_LEASE_SECONDS = 86400; // 24 hours
|
||||
|
||||
|
||||
Reference in new issue
Block a user