Skip to content

fix(web): route org and transport refusals through the error screen - #335

Merged
cvince merged 1 commit into
feat/portabilityfrom
claude/web-refusal-org-transport
Aug 28, 2026
Merged

fix(web): route org and transport refusals through the error screen#335
cvince merged 1 commit into
feat/portabilityfrom
claude/web-refusal-org-transport

Conversation

@cvince

@cvince cvince commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Six more guards in the refusal class, same pattern as the checkout/decrypt fix: throw a coded CapyError so the catch that serves the page actually runs.

file guards
orgCommand auth failure, both missing-refresh-token sites
transportCommand no email, no master key on this machine, unwrap failure

Both delegate through an execute() whose catch routes to displayErrorAndExit, so the throw reaches the page and the exit code stays 1.

Two things I checked rather than assumed

An analyzer I wrote said none of these routed. It looked for a lexically enclosing try — but the routing catch is in the caller: execute() wraps await this._execute(). Verified by reading orgCommand:59-67 directly. Acting on that analyzer would have skipped every fix in this PR as unsafe.

Four files are deliberately excluded. editCommand, kickCommand, recoverCommand, connectCommand — their guards do not sit under a routing catch. kick's and connect's own catch blocks are themselves console.error + process.exit(1), and edit's guards fall outside its routing try. Converting them needs the catch rewritten too: different change, different blast radius.

Not behaviourally verified — stated plainly

These guards need a live session to reach, so no run in this repo arrives at them. Structure verified by reading, suite green, but I have not watched these particular refusals serve a page. The checkout/decrypt/branch equivalents were watched serving one, and this is the same mechanism.

Suite: 1847 pass, 0 fail.

Six more guards in the refusal class, same pattern as the checkout/decrypt fix:
throw a coded CapyError so the catch that serves the page actually runs.

  orgCommand       auth failure, and both missing-refresh-token sites
  transportCommand no email, no master key on this machine, unwrap failure

Both files delegate through an `execute()` whose catch routes to
displayErrorAndExit, so a throw reaches the page and the exit code stays 1.

TWO THINGS I CHECKED RATHER THAN ASSUMED, because an earlier pass got both
wrong:

An analyzer I wrote to find each guard's enclosing try reported that NONE of
these routed. It was looking for a LEXICALLY enclosing try, and the routing
catch is in the CALLER — `execute()` wraps `await this._execute()`. Verified by
reading orgCommand 59-67 directly. Acting on that analyzer would have skipped
every fix in this commit as unsafe.

editCommand, kickCommand, recoverCommand and connectCommand are deliberately
NOT included. Their guards do not sit under a routing catch — kick's and
connect's own catch blocks are themselves `console.error` + `process.exit(1)`,
and edit's guards fall outside its routing try. Converting them needs the catch
rewritten too, which is a different change with a different blast radius.

NOT BEHAVIOURALLY VERIFIED, and worth saying plainly: these guards need a live
session to reach, so no run in this repo arrives at them. The structure is
verified by reading and the suite is green, but I have not watched these
particular refusals serve a page. The checkout/decrypt/branch equivalents were
watched, and this is the same mechanism.

Suite: 1847 pass, 0 fail.
@cvince
cvince merged commit 0b86ddc into feat/portability Aug 28, 2026
2 checks passed
@cvince
cvince deleted the claude/web-refusal-org-transport branch August 28, 2026 19:56
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