addLogin wrote logins.json before the credential was stored, and a
keychain write that failed (the login keychain out of reach over ssh)
left the account kept all the same: importing the same file again
reported it as already there. The credential is stored first now; the
login is written only once it is in.
Reviewed and applied from #4563 (ggbdpq, 7b42e98a1, SHA-256 matches).
The test runs in signIn's sandbox HOME with a fake `security` first on
PATH that exits 51. proc.Command looks PATH up at call time, so the real
Keychain is never reached. Switching to a saved login still writes its
On marks before the credential: #4592.
Broken by hand: signin.go back at main with the test kept, and
TestClaudeLoginKeychainWriteFailureKeepsLoginsFile fails.
Run (on mote, through mote-run):
- Full `go test -tags nogui -count=1 -timeout 45m ./...` with this stack
on c30d3b7b6: 82 packages ok. internal/gui was red only on
TestSettingsSaveKeepsWhatItDoesNotSend (#4514, SearchAll from
b09349d17) and TestColdTurnsTaken (#4510). Both are filed, and neither
touches this stack.
- Rebased onto 29d0ab39f, which changed internal/gateway since then:
gofmt -l, go vet (darwin, GOOS=linux -tags nogui, GOOS=windows) and
go test -count=1 ./internal/gateway ./internal/usage ./internal/provider
./internal/sessions all ok at the pushed head. go build ./... ok for
darwin, linux (nogui) and windows.
- go test -race of the gateway tests this stack adds or touches, on
the stack at fb29cd30f: ok.