mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-14 16:20:03 +00:00
36b42c1591
Playwright storage states persist cookies and localStorage only, while the primary-API-token flow authenticates through sessionStorage. Storage states captured after token auth were silently unauthenticated, so whole spec files landed on the login screen whenever the token path happened to win. Storage states now always come from the cookie-backed password login, cached once per run and probed before reuse. Explicit bearer/X-API-Token requests now go through a cookie-less request context: the backend intentionally CSRF-rejects mutations that carry a session cookie without a CSRF token even when the Authorization header is valid, so token-scope coverage could never pass from a logged-in page. Session-semantics specs use the new ensureSessionAuthenticated instead of racing the token path. First-run resets now refuse the implicitly resolved hot-dev runtime (the pid fallback with no explicit base URL and no harness-written runtime state); an ad-hoc spec run wiped the live dev backend's auth twice through that path. Resets can also recover an instance stuck unauthenticated mid-reset by re-reading the rotated bootstrap token through docker exec, and login() retries through the backend's 10-per-minute login limiter instead of failing on burst runs.