mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
feat: decouple read FeedId from inbound MailboxId
Separate the two feed identities so the public read URL never reveals the inbound address and vice-versa: - FeedId becomes an opaque high-entropy token (read id + KV key); MailboxId (noun.noun.NN) owns the inbound address and the untrusted-input boundary via MailboxId.parse. They map only through the inbound:<mailbox> secondary index, resolved solely at reception. - inbound index lifecycle is owned by FeedRepository: written by save/saveConfig, dropped by removeFromList(Bulk) — symmetric, never mirrored by hand (removes the manual delete in feed-service + the cron loop, and a silent empty-catch). - Feed.mailboxId exposes a MailboxId VO (symmetry with Feed.id); the mailbox@domain shape lives on MailboxId.emailAddress(domain). - Distinguish mailbox_unknown (no feed claims the address) from feed_not_found (dangling index) for observability; both forwardable, both 404. - Drop the redundant EmailParser.extractMailbox pass-through so MailboxId.parse is the single parse boundary. Docs (README/INSTALL/CLAUDE.md/landing) and tests updated; 439 tests green, tsc clean, build dry-run OK. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ const mockFeedConfig: FeedConfig = {
|
||||
title: "Test Newsletter",
|
||||
description: "A test feed",
|
||||
language: "en",
|
||||
mailbox_id: "test.news.42",
|
||||
created_at: 1700000000000,
|
||||
};
|
||||
|
||||
@@ -146,14 +147,15 @@ describe("generateRssFeed", () => {
|
||||
expect(result).not.toContain("<item>");
|
||||
});
|
||||
|
||||
it("feed link points to admin emails page", () => {
|
||||
it("feed link points to the public read URL, never an admin path", () => {
|
||||
const result = generateRssFeed(
|
||||
mockFeedConfig,
|
||||
mockEmails,
|
||||
BASE_URL,
|
||||
FEED_ID,
|
||||
);
|
||||
expect(result).toContain(`${BASE_URL}/admin/feeds/${FEED_ID}/emails`);
|
||||
expect(result).toContain(`<link>${BASE_URL}/rss/${FEED_ID}</link>`);
|
||||
expect(result).not.toContain("/admin/");
|
||||
});
|
||||
|
||||
it("strips html/head/body wrapper from item description", () => {
|
||||
@@ -263,14 +265,15 @@ describe("generateAtomFeed", () => {
|
||||
expect(result).not.toContain("<entry>");
|
||||
});
|
||||
|
||||
it("feed link points to admin emails page", () => {
|
||||
it("feed link points to the public read URL, never an admin path", () => {
|
||||
const result = generateAtomFeed(
|
||||
mockFeedConfig,
|
||||
mockEmails,
|
||||
BASE_URL,
|
||||
FEED_ID,
|
||||
);
|
||||
expect(result).toContain(`${BASE_URL}/admin/feeds/${FEED_ID}/emails`);
|
||||
expect(result).toContain(`${BASE_URL}/rss/${FEED_ID}`);
|
||||
expect(result).not.toContain("/admin/");
|
||||
});
|
||||
|
||||
it("strips html/head/body wrapper from entry content", () => {
|
||||
|
||||
Reference in New Issue
Block a user