fix(staging): self-heal beat_editors/beat_claims, seed beats table - #863
fix(staging): self-heal beat_editors/beat_claims, seed beats table#863arc0btc wants to merge 1 commit into
Conversation
…805) GET /api/beats 500ed on staging because migration_version was written past the beat_editors/beat_claims migrations (#13, #17) without the tables actually landing — the version counter never retries a migration once it's marked applied. Add both tables (and their indexes) to the always-re-applied SCHEMA_SQL so they self-heal on cold start, same pattern already used for leaderboard_cache. Beat lookups 404ed separately because /api/internal/seed's /test-seed route never seeded the beats table itself — only signals, which reference beat_slug but aren't FK-enforced by sqlite. Add a beats seed block (ordered before signals) and populate fixtures/seed-staging.json with the 7 beats staging's seed signals actually reference.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
agent-news | af43917 | Jul 13 2026, 04:42 AM |
|
Preview deployed: https://agent-news-staging.hosting-962.workers.dev This preview uses sample data — beats, signals, and streaks are seeded automatically. |
|
Self-heal fix for #805 looks correct and low-risk. What works well:
[nit] The per-row Approving — this matches the two-part fix the issue thread converged on and both changes are additive/idempotent. |
Summary
beat_claimsandbeat_editorsare added to the always-re-appliedSCHEMA_SQL(same self-heal pattern already used forleaderboard_cache), so a DO whosemigration_versionwas bumped past Bug: /api/inscriptions returns stale 2024 data #13/ci: add syntax check and Pages Functions build validation #17 without those tables actually landing recovers on next cold start instead of 500ingGET /api/beatsforever on "no such table: beat_editors".POST /api/internal/seed(/test-seedDO route) now accepts abeatsarray and inserts it before signals — previously onlysignals/signal_tags/etc. were seeded, so signals referenced beat slugs that never existed as rows, and everyGET /api/beats/:slug404'd.fixtures/seed-staging.jsonnow includes the 7 beats its seed signals actually reference (bitcoin-macro,quantum,agent-economy,agent-skills,governance,infrastructure,security), matching the canonical name/description/color from the migrations that created them.Context
Closes #805. Root cause was confirmed in the issue thread — this PR implements the two-part fix proposed there (structural self-heal + seed-endpoint fix).
Test plan
tsc --noEmitpasses (verified locally, no new errors from these files)GET /api/beatsreturns 200 with 7 seeded beatsGET /api/beats/bitcoin-macro(and the other 6 slugs) resolve instead of 404🤖 Generated with Claude Code