Files
news/pyproject.toml
T
connor 98bba62976 Fix the 3am notification avalanche and the failing morning digest
Three bugs from the first day of real use.

1. Quiet hours were evaluated in UTC. The router is handed a UTC `now` and
   compared its hour against "22:00-07:00" directly, so notifications were
   silenced from 18:00 local -- prime reading time -- and the whole day's budget
   was released at 03:00 local. The reported avalanche landed at 03:39 and 03:55.
   Quiet hours are now converted to the reader's wall clock first.

2. The timezone never resolved anyway. TZ was "America/Louisville", which exists
   on this Arch host but NOT in a Debian container, which ships only the
   canonical "America/Kentucky/Louisville". The container fell back to UTC and
   `date` printed "America" as the zone abbreviation. The zone is now read from
   config rather than the environment, so a bad TZ cannot silently change
   behaviour, and the compose entry uses the canonical name. NOTE: ~20 other
   services in compose.yml carry the same bad string; they were left alone since
   it only affects their log timestamps.

3. Budgets are not a rate. Six notifications fired in a single minute because
   the daily allowance could all be spent in one cycle. Each lane now has a
   minimum gap (interest 75min, importance 30min) and sends at most one per
   cycle, which turns the budget into a rate spread across the day.

Separately, the morning digest had silently fallen back to the templated list.
The real 28-story payload takes 70.3s to generate against a 60s timeout. Raised
to 180s -- and write_prose now LOGS why it failed instead of returning None in
silence, which is what made a one-line timeout cost a debugging session.
2026-09-09 09:55:49 -04:00

37 lines
1.1 KiB
TOML

[project]
name = "news"
version = "0.1.0"
description = "Personal news aggregator with an embedding-based model of taste"
requires-python = ">=3.12"
dependencies = [
"httpx>=0.27", # conditional GET, async polling
"feedparser>=6.0", # RSS/Atom incl. RSS 1.0/RDF, which the old hand-rolled quick-xml parser could not read
"fastembed>=0.4", # bge-small-en-v1.5 via ONNX on CPU; deliberately not torch/sentence-transformers
"numpy>=1.26",
"starlette>=0.37",
"jinja2>=3.1",
"uvicorn>=0.30",
"python-multipart>=0.0.9",
"tomlkit>=0.13",
# Quiet hours and the digest hour are wall-clock decisions. System zoneinfo
# is normally present, but this makes the zone lookup independent of the
# base image -- Debian ships no America/Louisville, only the canonical
# America/Kentucky/Louisville.
"tzdata>=2024.1",
"tomlkit>=0.15.1",
]
[project.scripts]
news = "news.cli:main"
[dependency-groups]
dev = ["pytest>=8.0", "pytest-asyncio>=0.23", "respx>=0.21"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"