Dashboard: content + source-health; per-viewer local dates

* Date fix: introduce GOODNEWS_TZ (goodnews/localtime.py) so the brief's "today"
  rolls over in a pinned zone (Eastern) instead of UTC — robust to host-clock
  resets. The home page now formats the brief's date in each VISITOR's local
  timezone (from its UTC freshness stamp), so nobody ever sees "tomorrow."

* Admin "Content served": articles live, fresh (7d), ingested (24h), summaries,
  active sources, today's brief size — queries.content_stats().

* Admin "Source health": per active source, the failure streak, last error,
  accepted contribution, and computed next-poll time (so backoff / "resting
  until" is visible), via queries.source_health() reusing the feeds backoff
  math. Failing sources sort to the top; times render in the viewer's zone.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay
2026-06-06 19:34:22 +00:00
parent 452e5a3fe4
commit d87347b032
7 changed files with 227 additions and 6 deletions
+3 -3
View File
@@ -3,11 +3,11 @@ from __future__ import annotations
import argparse
import os
import sqlite3
from datetime import date
from pathlib import Path
from .briefs import build_daily_brief, show_brief
from .db import connect, init_db
from .localtime import local_today
from .dedup import DEFAULT_THRESHOLD, DEFAULT_WINDOW_DAYS, dedup as run_dedup
from .enrich import enrich_brief_images
from .summarize import generate_summary, get_summary
@@ -300,7 +300,7 @@ def main() -> None:
replace=args.replace,
)
print(f"Built brief {brief_id}")
bdate = args.date or date.today().isoformat()
bdate = args.date or local_today()
found = enrich_brief_images(conn, bdate)
if found:
print(f"Enriched {found} hero image(s)")
@@ -445,7 +445,7 @@ def _run_cycle_locked(conn: sqlite3.Connection, args: argparse.Namespace) -> Non
print(f"dedup: skipped ({exc})")
if not args.no_brief:
today = date.today().isoformat()
today = local_today()
try:
brief_id = build_daily_brief(conn, brief_date=today, limit=7, replace=True)
found = enrich_brief_images(conn, today)