Repository navigation
Say an app is already disconnected on Connected apps - #885
Conversation
Settings → Connected apps put the service's developer-facing "no such connected app" straight into the error box when an organizer disconnected an app that was already disconnected (from another tab, say). Map the error code to plain words instead, the way the status and remove refusals do, and revalidate the list so a stale row disappears. Fixes #882. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9STHXfoMYjpHcFNwJ97
Tophat: passedI ran 549d84b locally with
Not this PR, seen in passing: on the phone, the breadcrumb's last item ("Connected apps") wraps onto two lines and runs into the Help link in the header (visible in For the owner (UX): an organizer who clicks Disconnect on an app that was already disconnected (from another tab, say) now reads "That app is already disconnected." instead of the developer message "no such connected app". Any other failure now reads "Couldn’t disconnect. Try again." instead of "Could not disconnect. Try again.". Compare Screenshots are in https://claude.ai/code/session_016YZ9STfnsZ1neVB8581Jrb. Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 1)
This PR maps the Disconnect action's failures to plain words, as #882 asks. Before, the action put serviceError.message into ?error=. Now it passes disconnectRefusal(code): not_found gives "That app is already disconnected.", and any other code, or no code at all (an unexpected error), gives "Couldn’t disconnect. Try again." The new helper has the same shape as status-refusal.ts and remove-refusal.ts. Logging works as before: unexpected errors are still logged, and a ServiceException refusal isn't. redirect() is called inside catch, not try, so NEXT_REDIRECT can't be caught by mistake. revalidatePath(PATH) now runs before the error redirect too, so the stale row is dropped. The only not_found that revokeConnectedApp throws (src/oauth/grants.ts:173) is the missing-grant case, so the wording fits. Every "Done when" item is met: the unit test pins not_found plus three other codes and undefined, and serviceError.message no longer goes into the URL. The help article doesn't quote this error. The CHANGELOG entry is accurate.
Blocking (0)
Optional (0)
Earlier threads: none. Copilot couldn't review (quota).
Checks: CI is green on 549d84b (lint-type-test, e2e, CodeQL), and the branch is up to date with main (001a284). The tophat passed on 549d84b, the head. I read the diff, revokeConnectedApp and the sibling refusal helpers. I didn't need to run anything locally to prove a finding.
Why the owner: this is UX. An organizer who disconnects an app that's already gone now reads "That app is already disconnected." where they used to read "no such connected app", and the generic failure now reads "Couldn’t disconnect. Try again." Compare 885-before-already-gone with 885-after-already-gone in the tophat session.
https://claude.ai/code/session_016YZ9SWUovHvvhXCkA2ydUW
Generated by Claude Code
|
Approved by the owner at Not merged yet: the branch now conflicts with https://claude.ai/code/session_016YZ9SSnMjoyJ4iWMXTbyJg Generated by Claude Code |
|
Stopping here: the conflict with Since this PR opened (base
A trial merge conflicts in
I pushed nothing and left the branch as it was. Labelled Session: https://claude.ai/code/session_016YZ9SW7egY2cFvqa1GJa4i Generated by Claude Code |
|
Merged Ran and passed: No tophat has passed yet on the rebuilt code ( https://claude.ai/code/session_016YZ9SSrXmBYEKU54oeMPzi Generated by Claude Code |
…onnect-refusal # Conflicts: # CHANGELOG.md
|
Merged Ran and passed: No tophat has passed yet on the rebuilt code ( https://claude.ai/code/session_016YZ9SUQgoWBCjsRZy12vMm Generated by Claude Code |
Tophat: passedI ran 2f033eb locally with
Not from this PR: on a phone, the Swedish header's crumbs overlap Hjälp and Konto (visible at the top of For the owner (UX): on Settings → Connected apps, clicking Disconnect on an app that's already gone (disconnected in another tab, say) used to say "No longer available." It now says "That app is already disconnected." (Swedish: "Appen är redan frånkopplad."). A disconnect that fails for any other reason now reads "Couldn’t disconnect. Try again." instead of "Could not disconnect. Try again." Nothing else on the page changes. Screenshots are in https://claude.ai/code/session_016YZ9STGQxC6ipYDNEWxFYA. Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 2)
This PR is the rebuilt version of the #882 fix (option 1 in the hand-back comment). It gives Settings → Connected apps its own line for not_found ("That app is already disconnected.") and rewords disconnectFailed to "Couldn’t disconnect. Try again." Both strings come from the catalog through connectedAppsLines, and every other code still gets the shared line. The page's disconnect action is unchanged from main. It redirects with ?error=<code> for a ServiceException, and with internal (logged) for anything else. The only not_found that revokeConnectedApp throws (src/oauth/grants.ts:173) is the case where the organizer has no such grant, so "already disconnected" is accurate. Each of the description's claims holds. disconnect-refusal.ts is gone, and nothing on the branch still uses "Could not disconnect" or the old helper. page.tsx is identical to main's. Swedish has both keys, translated-from/sv.json records the new English for both, and en.d.json.ts is regenerated. Dropping the revalidatePath part is backed by the tophat, which saw the deleted app gone from the list after the redirect. The tests pin both lines in English and in every other catalog language, and pin a code with no line of its own (rate_limited) still falling back to the shared line. The connected-apps help article doesn't quote either message. The CHANGELOG entry is accurate.
Blocking (0)
Optional (0)
Earlier threads: none. Copilot couldn't review (quota).
Checks: CI is green on 2f033eb (lint-type-test, e2e, CodeQL), and mergeable_state is clean against main (9420f21). The tophat passed on 2f033eb, the head. Locally I read the diff, the action in page.tsx and revokeConnectedApp, and searched for leftovers of the old wording. I didn't need to run anything to prove a finding.
Why the owner: this is UX, and the approval at 549d84b doesn't carry over, because the PR was rewritten on main. On Connected apps, Disconnect on an app that's already gone now says "That app is already disconnected." (Swedish: "Appen är redan frånkopplad."), where main says "No longer available." Any other failure reads "Couldn’t disconnect. Try again." Compare 885-before-already-gone with 885-after-already-gone, and see 885-after-sv-phone-already-gone, in the latest tophat's session.
https://claude.ai/code/session_016YZ9SUA1WmahVibZZdHdts
Generated by Claude Code
|
Approved by the owner at The owner approved this head in a live session and asked for it to be merged after #871. Every gate passes at https://claude.ai/code/session_016YZ9SUTbBzWCJ45BqmkVnV Generated by Claude Code |
The only conflict was CHANGELOG.md, against #885's entry under Fixed. Kept both entries, with this PR's first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SUTbBzWCJ45BqmkVnV
main (#885) added organizer.errors.alreadyDisconnected and changed disconnectFailed's English from "Could not" to "Couldn't". German gets "Diese App ist schon getrennt." (trennen, as the glossary says), and its disconnectFailed line, which still says the same, is marked against the new English. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SU3Lv9FSy3pvxEE8zf
Fixes #882.
Rebuilt on
main(option 1 in the hand-back comment). Since this PR first opened,mainmoved the page under(organizer)and words organizer refusals from the message catalogs, which already fixed the core of #882: the server's "no such connected app" no longer reaches the page. This PR is now just the wording that was left.What changes
On Settings → Connected apps:
main)?error=not_found)?error=internal)organizer.errors.alreadyDisconnectedis new andorganizer.errors.disconnectFailedis reworded, both inen.json.connectedAppsLines(refusal-lines.ts) now gives the page its own line fornot_foundas well asinternal. Every other code still gets the line every screen gives it, and a viewer'sforbiddenreads as everywhere else.disconnect-refusal.ts, which returned hard-coded English, is gone.main's catalog rules don't allow English typed into an organizer screen.page.tsxis unchanged frommain.Dropped: the list refresh. The first version also called
revalidatePathbefore the error redirect, so an app that was already gone would drop out of the list. That isn't needed. I checkedmain's page as it is, underpnpm devand under a production build (pnpm build && pnpm start), at desktop and phone width: after Disconnect on an app deleted behind the page, the redirect renders the page again and the list is already empty (1 row before, 0 after). So that part of #882 never happened onmain.Translation
Swedish is updated with the
translateskill (organizer audience):organizer.errors.alreadyDisconnected: "Appen är redan frånkopplad.", the same wording as the page's "Appen är frånkopplad." after a successful disconnect.organizer.errors.disconnectFailed: the Swedish ("Det gick inte att koppla från. Försök igen.") still fits, since only the English apostrophe changed. Read against the new English and marked without a change.to-translate.mjs svnow lists nothing for either audience.Review: a different model (Sonnet) read both keys beside the rest of
organizer.connectedAppsin both catalogs, along with screenshots of the Swedish and English page showing each message, at 1280 and 390 pixels wide. Findings: none. It confirmed the meaning, the glossary's koppla från, the du tone, and that each message fits on one line on a phone. It had no view on the glossary's open questions, since none touch these keys.Tests
page.test.tsx: the page shows each message for?error=not_foundand?error=internal, in English, and in every other catalog language from that language's keys.organizer-errors.test.ts: Connected apps' lines throughrefusalFromQuery, including a code it has no line of its own for.organizer-reasons.test.ts(unchanged) still checks that every Connected apps refusal comes from the catalog.pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test(245 files, 3520 tests pass) andpnpm build && pnpm budgets(all pages within budget).pat@example.comand an account storing Swedish), Disconnect on an app deleted behind the page shows the new line, in English and in Swedish, and leaves an empty list.?error=internalshows the new failure line in both.The help article on connecting an AI assistant doesn't quote either message, so it needs no change.
🤖 Generated with Claude Code
https://claude.ai/code/session_016YZ9SWNjJFtdBmT8WihHf8