# WP-37 — Dev-switcher reset fix (scenario/role) Status: done Phase: 8 — platform/DX/showcase ## Why The WP-33 dev switcher can't reset scenario/role back to `default`/`drafter` — it gets "stuck" (e.g. on `slow`). Cause: `currentScenario()`/`currentRole()` read the URL `?scenario=`/`?role=` param **before** sessionStorage, so once a param is in the address bar, `location.reload()` (same URL) re-reads the stale value and overrides what the switcher just stored. ## Decisions - Once the switcher is used, **sessionStorage is authoritative**; a leftover URL param must not win. Strip both dev params from the URL (`history.replaceState`) before reloading. - Extract the URL rewrite as a **pure** `stripDevParams(href)` so it's unit-testable without touching `location.reload()`. ## Files - `src/app/shared/infrastructure/dev-params.ts` (+ `dev-params.spec.ts`) — pure `stripDevParams`. - `src/app/shared/ui/debug-state/debug-state.component.ts` — `switchRole`/`switchScenario` call `applyAndReload()` (replaceState with stripped URL, then reload). ## Acceptance criteria - [x] Switching scenario/role to any value (incl. default/drafter) sticks after reload, even when a `?scenario=`/`?role=` param was in the URL. - [x] `stripDevParams` removes both params, keeps other params + path/hash (spec). - [x] `npm run ci` green.