Fix silent data outage: stale Supabase key, swallowed write errors, no cron alerts
The positions page has been disconnected from Supabase since 2026-03-30. Three compounding failures:
The positions page has been disconnected from Supabase since 2026-03-30. Three compounding failures:
- The Supabase key went stale. Every write from GitHub Actions and every
read from the web app returned 401 Unauthorized. Repo secrets SUPABASE_KEY and SUPABASE_URL updated to the working values.
- Failures were invisible. db.record_chain_snapshot() swallowed write
exceptions and returned len(rows) — the attempted count — so the capture job printed "2675 rows captured" and exited 0 while persisting nothing. It now counts confirmed writes, logs failures, and exits non-zero when zero rows land. /api/paper-trades likewise discarded error and served an all-zeros scorecard with HTTP 200; it now returns 500.
- GitHub auto-disabled all 7 scheduled workflows for repo inactivity
(last commit 2026-04-12). Re-enabled, and every scheduled workflow now has an if: failure() Discord alert so the next outage is visible.
Also:
- score-predictions.yml was invalid YAML (unquoted inline
python -c), so
GitHub could never parse it and the job has never run. Extracted to score_predictions.py.
- Removed a hardcoded Discord webhook URL from api/cron/health/route.ts.
This repo is public; the webhook now comes from secrets.DISCORD_WEBHOOK and needs rotating since it is exposed in git history.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>