fix(keychain): export ErrNoDefaultCollection sentinel#539
Merged
Conversation
The errNoDefaultCollection sentinel was package-private, so callers outside the keychain package could not use errors.Is to distinguish "no keychain infrastructure available" from other I/O errors. This matters for headless Linux deployments where the condition is expected and routine, and where an orchestration layer wants to fall back gracefully rather than resort to fragile error message comparisons. Export the sentinel as ErrNoDefaultCollection. It is declared in the cross-platform keychain.go (rather than the Linux-specific file) so that cross-platform callers can reference it on every platform, even though the condition is only ever produced on Linux. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
This is a clean, well-scoped export of a package-private error sentinel. The change correctly:
- Moves
errNoDefaultCollectionto the cross-platformkeychain.goso callers on all platforms can reference it - Removes the Linux-only declaration and updates the single call site to use the exported name
- Updates the test to use
ErrNoDefaultCollectiondirectly, verifyingerrors.Iscompatibility
No bugs were found in the changed code. The errors.Is chain is intact (no wrapping), the sentinel propagates correctly through resolveDefaultCollection, and the test coverage for the new public API is appropriate.
Clarify in the doc comment that the condition is currently specific to the Linux keyring (freedesktop Secret Service) and never returned on macOS or Windows, which have no "default collection" concept. The sentinel still lives in the cross-platform file so platform-agnostic callers can reference it without build tags; on non-Linux platforms it simply never matches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
joe0BAB
approved these changes
Jun 1, 2026
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.
The errNoDefaultCollection sentinel was package-private, so callers outside the keychain package could not use errors.Is to distinguish "no keychain infrastructure available" from other I/O errors. This matters for headless Linux deployments where the condition is expected and routine, and where an orchestration layer wants to fall back gracefully rather than resort to fragile error message comparisons.
Export the sentinel as ErrNoDefaultCollection. It is declared in the cross-platform keychain.go (rather than the Linux-specific file) so that cross-platform callers can reference it on every platform, even though the condition is only ever produced on Linux.