From 452e5a3fe44aa2c6f8dd9ca8cc7011076d09db73 Mon Sep 17 00:00:00 2001 From: jay Date: Sat, 6 Jun 2026 19:18:18 +0000 Subject: [PATCH] Hardening pass: scheduler backoff, FK cascade, a11y, test safety net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pre-traffic cleanup from an audit: * Scheduler: poll_due_sources now keys on the last *attempt* (success or failure), not the last success, and scales the wait by the consecutive- failure streak (capped at a day). A failing feed (e.g. Phys.org's HTTP 429s) used to be retried every cycle because it had no successful run; it now backs off and recovers on its own. Extracted due_source_rows() + tests. * FK hygiene: deleting a daily_brief is supposed to cascade to its items, but SQLite enforces foreign keys per-connection — connect() already sets the pragma, so the cascade is correct going forward; added a regression test. (Orphaned items + Phys.org settings were cleaned directly on the live DB.) * a11y: modal/drawer dialogs are now focusable (tabindex), close on Escape (window) and on backdrop click via a target check (dropping the inner stopPropagation handlers). Build is warning-free. * tests: conftest points any un-mocked LLM client at a closed port with a 1s timeout, so an accidental real call fails fast instead of hanging the suite. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/lib/components/FeedbackModal.svelte | 6 +- frontend/src/lib/components/LanePicker.svelte | 6 +- .../src/lib/components/SavedFlyout.svelte | 8 ++- frontend/src/lib/components/SignIn.svelte | 12 +++- goodnews/feeds.py | 43 +++++++++---- tests/conftest.py | 16 +++++ tests/test_briefs_fk.py | 25 ++++++++ tests/test_scheduler.py | 62 +++++++++++++++++++ 8 files changed, 158 insertions(+), 20 deletions(-) create mode 100644 tests/conftest.py create mode 100644 tests/test_briefs_fk.py create mode 100644 tests/test_scheduler.py diff --git a/frontend/src/lib/components/FeedbackModal.svelte b/frontend/src/lib/components/FeedbackModal.svelte index 784da61..c375155 100644 --- a/frontend/src/lib/components/FeedbackModal.svelte +++ b/frontend/src/lib/components/FeedbackModal.svelte @@ -38,8 +38,10 @@ -