fix(news): drop future-dated items at ingest, hide them in /api/news

wiseye.org public-affairs event listings carry pubDate 3-6 days ahead; with
ORDER BY timestamp DESC they pinned the top of the feed for a week and made
the news list look frozen.

- PostgresPipeline drops items whose parsed publish date is >2h in the
  future, counts future_dated_dropped (stats + one INFO line per run).
  Unparseable dates keep the old behaviour (kept, timestamped now()).
- GET /api/news filters timestamp > now() in the query while still returning
  timestamp IS NULL rows; limit/offset/domain/since unchanged.
- docs/news.md documents the guard.
- tests: pipeline drop/keep unit tests, API future-row exclusion + limit.
This commit is contained in:
backend 2026-11-13 21:41:44 -05:00
commit c42d375d6c
5 changed files with 176 additions and 3 deletions

View file

@ -43,7 +43,10 @@ feeds (`GET /api/news` exact key set is unchanged on purpose).
URLs from `urls.txt` (homepages autodiscover RSS; feed URLs are parsed
directly), follows each `<item>` link, extracts the main article body, and
the `PostgresPipeline` writes to `articles` with URL-based dedup
(`ON CONFLICT (url) DO NOTHING`).
(`ON CONFLICT (url) DO NOTHING`). Items whose parsed publish date is more
than 2 hours in the future are dropped at ingest (`future_dated_dropped`)
and never surface via `/api/news`, which additionally hides any
`articles.timestamp > now()` row until its date arrives.
2. **Summarizer** — `news/summerizer/run_news_summarizer.py` runs
`summarizer.py` every `NEWS_SUMMARIZE_INTERVAL_S` (default 900) over the
last `SUMMARY_WINDOW_MINUTES` (default 15), and again at 23:00