fix(leaderboard): filter quarantined methodology_version=0 rows (#501)

Pairs with the Supabase migration that added `methodology_version` to
`savings_entries` and demoted 43 corrupt rows (pre-fix telemetry from
March 2026) to version 0. Adds `methodology_version=gte.1` to the
public leaderboard fetch URL so the quarantined rows hide at the query
layer — fewer bytes over the wire than client-side outlier filtering,
and forward-compatible: new clients write `methodology_version >= 1`
and remain visible.

The leaderboard's existing client-side outlier thresholds stay in place
as a second line of defence in case any future v >= 1 row slips past
the bounds.

Smoke-tested live: anon-key fetch against
`mtbtgpwzrbostweaanpr.supabase.co` returns 291 rows (was 334), top
result is the largest-savings user with v=1. A separate `eq.0` probe
confirms quarantined rows are skipped only by the filter (no RLS
policy in place yet — flag for follow-up if you want hard isolation).

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Jon Saad-Falcon
2026-06-04 17:42:19 -07:00
committed by GitHub
co-authored by Claude Opus 4.7
parent 28ef745384
commit 1827c1578b
+8 -1
View File
@@ -152,8 +152,15 @@
}
fetch(
// `methodology_version=gte.1` filter excludes rows that the
// leaderboard-correctness migration quarantined (version 0). Rows
// written by current and future clients carry version >= 1, so this
// is forward-compatible — pre-fix corrupt rows hide at the query
// level (fewer bytes over the wire than client-side outlier
// filtering), and downstream client-side checks remain as a
// belt-and-suspenders second line of defence.
SUPABASE_URL +
"/rest/v1/savings_entries?select=display_name,dollar_savings,energy_wh_saved,flops_saved,total_calls,total_tokens&order=dollar_savings.desc&limit=1000",
"/rest/v1/savings_entries?select=display_name,dollar_savings,energy_wh_saved,flops_saved,total_calls,total_tokens&methodology_version=gte.1&order=dollar_savings.desc&limit=1000",
{
headers: {
apikey: SUPABASE_ANON_KEY,