Repository navigation
fix: read a device sign-in's answer from the whole JSON, not its last line - #15
Merged
Merged
Conversation
… line `varlatch login --wait --json` prints indented JSON, so the last line is `}` and a denied or expired sign-in was reported as a generic failure. The answer is now the last whole document in the output (device-wait asks again while the code is pending, so there may be several). The fake CLI prints the real, indented form, and a new case covers a pending answer followed by a denial. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
varlatch login --wait --jsonprints indented JSON, in the TypeScript CLI and in the Go CLI alike:The device sign-in read the state from the output's last line (
tail -n 1 | jq). That line is}, so a denied or expired sign-in was reported as a generic "Sign-in failed" with the CLI's error lines, instead of "was denied" or "expired before it was approved".Changes
bin/varlatch-menu: the state is read from the last whole JSON document in the output (jq -rs 'last | .state').device-waitruns--waitagain while the code is pending, so the output can hold several documents. The last one is the answer.tests/fake-varlatch:login --start --jsonand every--wait --jsonanswer are now printed as the CLIs print them: indented, with"version": 1. The old one-line JSON is what hid the bug.tests/run.sh: a new case, "denied after a pending answer", where the output holds two documents.Tests
tests/run.sh: 88 passed, 0 failed.bin/varlatch-menu: 3 failures ("denied", "the code expired", "denied after a pending answer"). The new fake catches the bug.-S warning, as CI runs it) is clean.No version bump or changelog entry: those come with the next release, which waits for the owner.
🤖 Generated with Claude Code