mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
## Problem The Phase 1 mw_diag monitoring dashboard wasn't showing any data despite the middleware PR (#43413) being live in production. Next.js `response.cookies.set()` URL-encodes cookie values, so `hit=1&would_stamp=0&has_cookie=0` becomes `hit%3D1%26would_stamp%3D0%26has_cookie%3D0` in `document.cookie`. Our `parseMwDiagCookie` was passing that encoded string directly to `URLSearchParams`, which splits on literal `&` and `=` — the encoded `%26`/`%3D` delimiters were invisible to it. Result: `params.get('hit')` always returned `null`, so every diagnostic cookie was silently dropped. ## Changes - Add `decodeURIComponent()` before `URLSearchParams` in `parseMwDiagCookie` - Add 3 test cases covering URL-encoded cookie values (matching what Next.js actually produces in production) ## Testing - All 34 unit tests pass (31 existing + 3 new) - Verified locally with Playwright: manually set the URL-encoded cookie format on localhost:8082, confirmed `parseMwDiagCookie` now returns `{hit: true, ...}` and the data flows through to `PageTelemetry` GROWTH-625