fix(web): route org and transport refusals through the error screen - #335
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Six more guards in the refusal class, same pattern as the checkout/decrypt fix: throw a coded
CapyErrorso the catch that serves the page actually runs.orgCommandtransportCommandBoth delegate through an
execute()whose catch routes todisplayErrorAndExit, 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()wrapsawait this._execute(). Verified by readingorgCommand:59-67directly. 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 andconnect's own catch blocks are themselvesconsole.error+process.exit(1), andedit'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/branchequivalents were watched serving one, and this is the same mechanism.Suite: 1847 pass, 0 fail.