From 2dd1f276d2fb1da0191a17958c49da6300107ece Mon Sep 17 00:00:00 2001 From: Sweets Sweetman Date: Tue, 16 Jun 2026 14:16:41 -0500 Subject: [PATCH] chore(db): drop songstats_quota_ledger table (chat#1797) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The local quota ledger drifted (filled with phantom 429 hits → premature drain halt). Songstats is the rate authority; api now uses bounded backoff + deferral instead. Code refs removed in api#674. APPLY ORDER: deploy api#674 (stops reading/writing the ledger) before applying this migration, otherwise live inserts fail. Co-Authored-By: Claude Opus 4.8 (1M context) --- ...0260616000000_drop_songstats_quota_ledger.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 supabase/migrations/20260616000000_drop_songstats_quota_ledger.sql diff --git a/supabase/migrations/20260616000000_drop_songstats_quota_ledger.sql b/supabase/migrations/20260616000000_drop_songstats_quota_ledger.sql new file mode 100644 index 0000000..19bd3f7 --- /dev/null +++ b/supabase/migrations/20260616000000_drop_songstats_quota_ledger.sql @@ -0,0 +1,16 @@ +-- Drop the local Songstats quota ledger (recoupable/chat#1797, bullet 2). +-- +-- The ledger mirrored Songstats' rate quota locally so a budget gate could halt +-- the backfill drain before spending. In practice it drifted: the prod 429 storm +-- (2026-06) filled it with phantom 429 "hits" (insert-on-every-call, success or +-- not), so the gate tripped on rate-limit noise, not real quota — a premature +-- drain halt. Songstats is the rate authority; api now relies on per-track +-- bounded exponential backoff and defers rate-limited rows to the next run +-- instead of mirroring a quota. +-- +-- Code references removed in api PR #674 (getBackfillBudgetStep, +-- insertSongstatsQuotaLedger, selectSongstatsQuotaSpent and their tests). +-- Created 20260610010000_create_playcount_measurement_store.sql. +-- CASCADE cleans up the table's indexes, RLS, and FKs. + +DROP TABLE IF EXISTS public.songstats_quota_ledger CASCADE;