Skip to content

fix(auth): restore the /cli/authorize page the device-code login sends you to - #1627

Merged
lilyshen0722 merged 3 commits into
mainfrom
fix/restore-cli-authorize
Sep 8, 2026
Merged

lilyshen0722 merged 3 commits into
mainfrom
fix/restore-cli-authorize

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Every commonly login has 404'd since 2026-09-04. #1534 deleted V2CliAuthorize and its /cli/authorize route as retired UI, while backend/routes/auth.ts still answers POST /api/auth/device/start with verifyUrl: <origin>/cli/authorize. The browser lands on the marketing 404. Sam hit it today.

Fix

Guard

V2ConnectHonesty reads the backend's verifyUrl path out of auth.ts and asserts App.tsx registers 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

V2CliAuthorize 4/4, V2ConnectHonesty 12/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

…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 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@lilyshen0722
lilyshen0722 merged commit ec4939e into main Sep 8, 2026
14 checks passed
lilyshen0722 added a commit that referenced this pull request Sep 8, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant