From 7da14bd4fd6763b22cd1044d7596182fa1b94a38 Mon Sep 17 00:00:00 2001 From: jay Date: Tue, 9 Jun 2026 16:55:17 -0400 Subject: [PATCH] Digest email: 'Daily Highlights' masthead + warm intro, point back to the site MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per user feedback: rename from 'Today's good news' (which implied the site was done for the day) to a publication-style 'Upbeat Bytes — Daily Highlights' masthead with a warm morning intro and a sign-off that links back to the site ('more good news is always waiting'). Adds 'why it's here' to the plain-text part too. No images by design (lightweight, mail-client-safe). Co-Authored-By: Claude Opus 4.8 (1M context) --- goodnews/digest.py | 24 ++++++++++++++++++------ tests/test_digest.py | 3 ++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/goodnews/digest.py b/goodnews/digest.py index b2a01bd..2b438f0 100644 --- a/goodnews/digest.py +++ b/goodnews/digest.py @@ -68,14 +68,21 @@ def build_digest(items: list[dict], brief_date: str, unsub_url: str, base: str | if weekday == "today": subject = f"Today's Upbeat Bytes · {n} calm reads" - text_lines = [f"Today's good news — {n} calm reads.\n"] + text_lines = [ + f"Upbeat Bytes — Daily Highlights", + f"{n} calm read{'' if n == 1 else 's'} for {weekday}.\n", + "Good morning. A small, hopeful handful of what's going right — and there's", + "always more waiting on the site whenever you want it.\n", + ] for it in items: text_lines.append(f"• {it['title']} ({it['source']})") if it.get("summary"): text_lines.append(f" {it['summary']}") + if it.get("reason_text"): + text_lines.append(f" Why it's here: {it['reason_text']}") text_lines.append(f" Read: {base}/a/{it['id']}") text_lines.append(f" Source: {it['canonical_url']}\n") - text_lines.append("That's today's good news. You're caught up — see you tomorrow.") + text_lines.append(f"That's today's highlights — more good news is always waiting at {base}. See you tomorrow.") text_lines.append(f"\nTo stop these emails: {unsub_url}") text = "\n".join(text_lines) @@ -97,11 +104,16 @@ def build_digest(items: list[dict], brief_date: str, unsub_url: str, base: str | html = ( '
' - '

Today’s good news

' - f'

{n} calm reads for {escape(weekday)}

' + '
Upbeat Bytes
' + '
Daily Highlights · {escape(weekday)}
' + '

' + 'Good morning. A small, hopeful handful of what’s going right — and there’s always more ' + f'waiting on the site when you want it.

' + "".join(blocks) - + '

That’s today’s good news. ' - 'You’re caught up — see you tomorrow.

' + + '

That’s today’s highlights — more good news is ' + f'always waiting on Upbeat Bytes. See you tomorrow.

' f'

You’re getting this because you turned on ' f'the daily digest. Unsubscribe.

' '
' diff --git a/tests/test_digest.py b/tests/test_digest.py index b2a7dcb..fd14634 100644 --- a/tests/test_digest.py +++ b/tests/test_digest.py @@ -21,7 +21,8 @@ def test_build_digest_is_calm_and_dated(): items = [{"id": 1, "title": "Good thing", "canonical_url": "http://a/1", "source": "Src", "summary": "nice", "reason_text": "wonder", "paywalled": False}] subject, text, html = digest.build_digest(items, "2026-06-09", "http://ub/unsub") assert "Tuesday's Upbeat Bytes" in subject and "1 calm read" in subject - assert "You're caught up" in text and "http://ub/unsub" in text + assert "Daily Highlights" in text and "Daily Highlights" in html + assert "more good news is always" in text and "http://ub/unsub" in text # points back to the site assert "Good thing" in html and "Read on Upbeat Bytes" in html and "Unsubscribe" in html assert "you missed" not in (text + html).lower() # no guilt language