Make keyring availability checks read-only - #165
Open
code-monger-givenall wants to merge 1 commit into
Open
Conversation
code-monger-givenall
force-pushed
the
codex/keyring-concurrency
branch
from
August 19, 2026 17:35
03f855a to
f36ec0f
Compare
code-monger-givenall
marked this pull request as ready for review
August 19, 2026 17:35
Contributor
There was a problem hiding this comment.
Pull request overview
Makes credential-store initialization read-only, preventing concurrent keyring probes from causing false plaintext fallbacks.
Changes:
- Adds an injectable keyring interface.
- Replaces write/delete availability probes with one read.
- Tests read-only probing and fallback behavior.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
internal/auth/store.go |
Implements read-only keyring availability checks. |
internal/auth/store_test.go |
Verifies probe calls and fallback behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
What changed
Credential-store initialization now checks Keychain availability with a read-only lookup. A missing availability entry means the keyring is working. Other errors keep the existing plaintext-file fallback.
The keyring interface lets the tests verify that initialization calls
Getonce and never callsSetorDelete.Why
Every CLI process previously wrote and deleted the same
hey::testitem before loading the real credential. Parallel processes could make that probe fail. The affected process then switched to an empty plaintext store and reportednot logged in, even though valid credentials were still in Keychain.I reproduced this with 60 read-only
hey auth status --jsoncalls at concurrency 6. Before the change, 25 printed the keyring warning and reported unauthenticated. After the change, all 60 completed without either failure.Checks
env GOWORK=off mise x golangci-lint@2.10.1 -- make checkenv GOWORK=off mise x -- go test -race -count=1 ./internal/authSummary by cubic
Makes keyring availability checks read-only to remove concurrency races that caused false plaintext fallbacks. Previously the CLI wrote/deleted "hey::test"; now it does a single Get on "hey::availability" where
ErrNotFoundmeans the keyring is available, and only other errors fall back to the file store.credentialKeyringinterface with a defaultsystemCredentialKeyringwrapper aroundgithub.com/zalando/go-keyring;Storenow depends on this interface so tests assert exactly oneGetand zeroSet/Deleteduring init.github.com/zalando/go-keyringwiths.keyringacross load/save/delete paths. External behavior is unchanged except fewer keyring warnings and no spurious unauthenticated states under concurrency.Written for commit f36ec0f. Summary will update on new commits.