Found by #49 (#49 (comment)), which was test-only and left these alone.
Problem
internal/cli declares its own errSecretNotFound, errVaultDoesNotExist, errVersionNotFound and errSecretExistsNoForce for the failures vault.ErrSecretNotFound, ErrVaultNotFound, ErrVersionNotFound and ErrSecretExists already name. Which one a caller gets depends on the command: secret get --version X returns vault.ErrVersionNotFound, secret version promote/rm return the copy, so errors.Is(err, vault.ErrVersionNotFound) is false for them. The same split hits secret mv, secret vault import, secret vault remove and secret version list.
secret.ReadPassphrase returns only unexported errors for "no terminal"; secret.ResolveGPGKeyFingerprint has no error for a key the keyring does not hold; storeInKeychain returns a plain fmt.Errorf with the same text as errNilDataBuffer.
bip85.ErrPasswordTooShort and bip85.ErrEncodedTooShort can never be returned (the length checks before them make them unreachable).
Definition of done
Each failure has exactly one error value, returned by every command that hits it: the internal/cli copies are removed in favour of the vault sentinels, wrapped with %w where context is added.
ReadPassphrase no-terminal failures wrap secret.ErrPassphraseNotRead; an unknown PGP key gets a sentinel; storeInKeychain returns errNilDataBuffer.
The two unreachable bip85 errors and their checks are removed, or the checks made reachable if they guard a real case.
The tests that #49 left comparing text for these cases now use errors.Is.
User-visible messages stay the same unless a message was wrong; TODO.md updated.
Model: opus-5-5
Found by https://git.eeqj.de/sneak/secret/issues/49 (https://git.eeqj.de/sneak/secret/issues/49#issuecomment-125483), which was test-only and left these alone.
## Problem
- `internal/cli` declares its own `errSecretNotFound`, `errVaultDoesNotExist`, `errVersionNotFound` and `errSecretExistsNoForce` for the failures `vault.ErrSecretNotFound`, `ErrVaultNotFound`, `ErrVersionNotFound` and `ErrSecretExists` already name. Which one a caller gets depends on the command: `secret get --version X` returns `vault.ErrVersionNotFound`, `secret version promote`/`rm` return the copy, so `errors.Is(err, vault.ErrVersionNotFound)` is false for them. The same split hits `secret mv`, `secret vault import`, `secret vault remove` and `secret version list`.
- `secret.ReadPassphrase` returns only unexported errors for "no terminal"; `secret.ResolveGPGKeyFingerprint` has no error for a key the keyring does not hold; `storeInKeychain` returns a plain `fmt.Errorf` with the same text as `errNilDataBuffer`.
- `bip85.ErrPasswordTooShort` and `bip85.ErrEncodedTooShort` can never be returned (the length checks before them make them unreachable).
## Definition of done
- Each failure has exactly one error value, returned by every command that hits it: the `internal/cli` copies are removed in favour of the `vault` sentinels, wrapped with `%w` where context is added.
- `ReadPassphrase` no-terminal failures wrap `secret.ErrPassphraseNotRead`; an unknown PGP key gets a sentinel; `storeInKeychain` returns `errNilDataBuffer`.
- The two unreachable `bip85` errors and their checks are removed, or the checks made reachable if they guard a real case.
- The tests that https://git.eeqj.de/sneak/secret/issues/49 left comparing text for these cases now use `errors.Is`.
- User-visible messages stay the same unless a message was wrong; `TODO.md` updated.
Model: opus-5-5
Built in #114. The two bip85 checks guarded no real case, so they were removed, not made reachable. Messages that change are listed in the PR.
Model: opus-5-5
Built in https://git.eeqj.de/sneak/secret/pulls/114. The two `bip85` checks guarded no real case, so they were removed, not made reachable. Messages that change are listed in the PR.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found by #49 (#49 (comment)), which was test-only and left these alone.
Problem
internal/clideclares its ownerrSecretNotFound,errVaultDoesNotExist,errVersionNotFoundanderrSecretExistsNoForcefor the failuresvault.ErrSecretNotFound,ErrVaultNotFound,ErrVersionNotFoundandErrSecretExistsalready name. Which one a caller gets depends on the command:secret get --version Xreturnsvault.ErrVersionNotFound,secret version promote/rmreturn the copy, soerrors.Is(err, vault.ErrVersionNotFound)is false for them. The same split hitssecret mv,secret vault import,secret vault removeandsecret version list.secret.ReadPassphrasereturns only unexported errors for "no terminal";secret.ResolveGPGKeyFingerprinthas no error for a key the keyring does not hold;storeInKeychainreturns a plainfmt.Errorfwith the same text aserrNilDataBuffer.bip85.ErrPasswordTooShortandbip85.ErrEncodedTooShortcan never be returned (the length checks before them make them unreachable).Definition of done
internal/clicopies are removed in favour of thevaultsentinels, wrapped with%wwhere context is added.ReadPassphraseno-terminal failures wrapsecret.ErrPassphraseNotRead; an unknown PGP key gets a sentinel;storeInKeychainreturnserrNilDataBuffer.bip85errors and their checks are removed, or the checks made reachable if they guard a real case.errors.Is.TODO.mdupdated.Model: opus-5-5
Built in #114. The two
bip85checks guarded no real case, so they were removed, not made reachable. Messages that change are listed in the PR.Model: opus-5-5