Repository navigation
fix: show errors with --quiet and --verbose/--debug, and stub the macOS browser in tests - #202
Open
pjcdawkins wants to merge 3 commits into
Open
pjcdawkins wants to merge 3 commits into
pjcdawkins wants to merge 3 commits into
Conversation
The root pre-run ignores --quiet when --verbose or --debug is also set, but exitWithError still hid errors, e.g. when the legacy CLI could not start. Both now use isQuiet(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On macOS the CLI opens URLs with `open`, which the fake browser did not stub, so login tests opened a real browser or waited for the timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Note
Reviewed — No blocking findings · 🔵 1 minor point
🔍 Full review · 3 files reviewed
🔵 Minor point
integration-tests/quiet_errors_test.go:33— ThewantErrorcases only checkassert.NotEmpty(t, stderr). They never check that the startup error itself was printed. In the-q --debugcase, any DEBUG line fromdebugLogfmakes stderr non-empty, even without theexitWithErrorfix. For example, the legacy-index debug message inExecuteor a debug line from a future component would do it. So the test would pass with the oldviper.GetBool("quiet")check. It should assert that stderr contains the error text (e.g. "failed to initialize PHP CLI").
Verification
isQuiet()uses the same condition (quiet && !debug && !verbose) as the inline expression it replaces in PersistentPreRun, so the pre-run behaves as before.exitWithErroris only called fromRunand the help func, after flag parsing andviper.BindPFlags, soisQuiet()sees the-v/--debugflags.- Setting
TEST_CLI_TMPto a regular file makesConfig.TempDir'sMkdirAllfail before anyc.debugcall inCLIWrapper.init. Every case therefore exits 1 through the non-ExitError branch ofexitWithError. - The legacy CLI's
Url::getDefaultBrowserreturnsopenon macOS without checking PATH and probesxdg-openon Linux, so stubbing both names covers both platforms.
The new TestQuietErrors integration test covers the quiet/verbose/debug cases. It runs in the integration-test CI job (make integration-test). Nothing tests the open stub on macOS, and the make test unit tests leave out integration-tests.
Review details
- Commit: 63be299
- Model: claude-opus-5-5
Review 1 of 10 for this pull request · View the full run
The test only checked that stderr was not empty, which a debug line would also satisfy with --debug. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Two fixes found while working on the Go auth migration (#195), which also apply to the current auth:
exitWithErrorhid errors when--quietwas combined with--verboseor--debug, although the root pre-run ignores--quietthen. For example, an error starting the legacy CLI was not shown with-qv. Both now useisQuiet().xdg-open, but the CLI usesopenon macOS, so login tests opened a real browser or waited for the login timeout there.🤖 Generated with Claude Code