Repository navigation
fix(auth): restore the /cli/authorize page the device-code login sends you to - #1627
Conversation
…s you to #1534 ("delete retired v2 showcase, marketplace, and persona catalog UI") also deleted `V2CliAuthorize` and its `/cli/authorize` route, while `backend/routes/auth.ts` still answers `POST /api/auth/device/start` with `verifyUrl: <origin>/cli/authorize`. Every `commonly login` since 2026-09-04 opened the marketing 404 ("We couldn't find that page"); Sam hit it today trying to refresh the CLI session that mirrors seat models server-side. Restored verbatim from the parent of #1534: the page, its stylesheet and its four tests (prefill → confirm device facts → authorize; signed-out return path; expired; already-used). Route re-registered in App.tsx beside /verify-email. Guard: `V2ConnectHonesty` now reads the backend's `verifyUrl` path from auth.ts and asserts App.tsx registers exactly that route — the backend is the source, the frontend must match it. Deleting the route again turns that test red (checked by mutation: 1 red, restored 16/16). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JavWvyVL478UfEhJjcfMgX
lilyshen0722
left a comment
There was a problem hiding this comment.
UX-GATE: APPROVED @ 0a62654 — verbatim restore, not a restyle: V2CliAuthorize.tsx/.css and its test are blob-identical to the parent of #1534 (2a5d51f); route re-registered at App.tsx:284 matching auth.ts:200 verifyUrl. No browser walk owed on a byte-identical page. Signal pass on /cli/authorize goes on the Coverage page for later.
lilyshen0722
left a comment
There was a problem hiding this comment.
APPROVED at 0a62654e41a6bb6f1ecdb588fe89f36d166d0a0f.
The defect is real on main
App.tsx on origin/main carries zero /cli/authorize routes, while backend/routes/auth.ts:200 still answers device/start with verifyUrl: `${origin}/cli/authorize`. Every device login has pointed at a route that does not exist.
The restore is verbatim
All three restored files are blob-identical to their versions at the parent of 3ed1bab2 (the #1534 deletion): V2CliAuthorize.tsx, V2CliAuthorize.css, V2CliAuthorize.test.tsx. Nothing unreviewed is riding along under a hotfix label.
The honesty test discriminates in both directions
This is the part worth keeping, and it is rarer than it looks:
| mutation | result |
|---|---|
delete the route from App.tsx (the original defect) |
1 red |
change the backend to `${origin}/cli/approve` |
1 red |
The second is what separates a real coupling from two hardcoded strings that happen to agree. The test regexes the path out of auth.ts and requires App.tsx to carry that exact route, so the backend is the source of truth and the frontend must follow it. A guard written the obvious way — asserting '/cli/authorize' on both sides — would pass that mutation and let the pair drift apart again in the opposite direction.
Control 16/16.
On the class
This is the removed-feature-keyed regression: a deletion that was correct about the UI being retired and wrong about a consumer nobody enumerated. The guard added here is the right shape for it, because it derives the expectation from the producer rather than restating it. Worth noting that the same shape would catch the general case — any backend-emitted URL whose frontend route lives in a different file — and verifyUrl is unlikely to be the only one.
…1631) #1627 restored the React route for the device-code login page and deployed (ec4939e) — and https://commonly.me/cli/authorize still returned the marketing 404. The real-404 change (5829467, 2026-08-24) made nginx an allowlist of SPA routes, and the login path was never on it, so the browser half of `commonly login` has been dead since that day, not since #1534. /settings/devices — the URL the CLI prints after a login for managing devices — has the same gap. Both are added to the SPA location. The honesty guard now reads the real nginx regex, the backend's verifyUrl path and the CLI's devices URL, and runs the regex against them (and against a known-bad path). Removing cli/authorize from nginx again → 1 red, mutation-checked; 13/13 restored. Claude-Session: https://claude.ai/code/session_01JavWvyVL478UfEhJjcfMgX Co-authored-by: Claude Fable 5.1 <[email protected]>
Every
commonly loginhas 404'd since 2026-09-04. #1534 deletedV2CliAuthorizeand its/cli/authorizeroute as retired UI, whilebackend/routes/auth.tsstill answersPOST /api/auth/device/startwithverifyUrl: <origin>/cli/authorize. The browser lands on the marketing 404. Sam hit it today.Fix
App.tsxbeside/verify-email, with a comment naming the backend contract.Guard
V2ConnectHonestyreads the backend'sverifyUrlpath out ofauth.tsand assertsApp.tsxregisters exactly that route. The backend is the source; the frontend must match it. Deleting the route again → 1 red (checked by mutation; restored 16/16).Proof
V2CliAuthorize4/4,V2ConnectHonesty12/12, tsc clean, eslint 0 errors. Live check after deploy:https://commonly.me/cli/authorize?code=…renders the device prompt instead of the 404.🤖 Generated with Claude Code
https://claude.ai/code/session_01JavWvyVL478UfEhJjcfMgX