Skip to content

[TW-6922] fix(cli): address remaining OAuth review items (#14, #15, #21, #22, #24, N11) - #126

Open
radenkovic wants to merge 1 commit into
mainfrom
tw-6922-review-followups
Open

radenkovic wants to merge 1 commit into
mainfrom
tw-6922-review-followups

Conversation

@radenkovic

Copy link
Copy Markdown
Contributor

Why this PR exists

These are the last review fixes from the TW-6922 CLI OAuth work. The commit (5ce9a94, 2026-10-08) was made on tw-6922-cli-oauth after #123 had been squash-merged, so it never reached main. GitHub had already auto-deleted the remote branch, which left the local branch as its only copy. This PR cherry-picks it onto current main unchanged; it applied with no conflicts.

What it changes

Verification

On this branch rebased onto main: go build, go vet, make lint (0 issues) and go test -race ./... all pass.

⚠️ Conflicts with #125 (TW-7617, device sign-in)

There's one small hunk in internal/cli/oauth/login.go, around the pre-login prompt. Whichever PR merges second needs a rebase. When resolving it, apply #22's rule to the device prompt too: in structured output (--json / --format yaml), the device code and verification URL go to stderr so stdout carries only the report, and --quiet must not hide the code, since the user can't sign in without it.

🤖 Generated with Claude Code

…N11)

#14: isOAuthSession returns (bool, error). A keyring read error is reported
instead of being read as "not an OAuth session", so refresh no longer calls
account.Refresh on an OAuth session, a failed read no longer counts as "no
dashboard login session", and `orgs switch` reports it.

#15: dpop.New reports a malformed or wrong-length stored seed instead of
replacing it. `oauth logout` checks the dashboard session's origin before it
builds the DPoP service, so it never creates a key when there is no OAuth
dashboard session.

#21: the oauth package no longer wires the dashboard hooks from init();
main.go calls oauth.WireDashboard explicitly.

#22: `oauth status`, `login` and `logout` honour --json, --format yaml and
--quiet through common.GetOutputWriter. Structured output never carries a
token.

#24: ARCHITECTURE.md lists the new ports (oauthas, lock, mcp credentials)
and the oauthas and filelock adapters.

N11: the "kept your dashboard login session" message says to run
`nylas dashboard logout` if that session has expired. Oversized test files
touched by this PR are split under 600 lines with no test changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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