secret unlocker list --json printed "unlockers": null for a vault with no unlockers, as after its last unlocker is removed. secret vault list --json printed "vaults": null when vaults.d held no vaults. Both lists were nil slices, and encoding/json writes a nil slice as null. Each is now made as an empty slice before it is filled, so an empty list prints as [].
The vault fix is in vault.ListVaults, which shell completion, secret move and secret vault remove also call. They only range over the result, check its length or look a name up in it, so an empty slice in place of nil changes nothing for them.
Two regression tests, one per command, list an empty vault's unlockers and an empty vaults.d in JSON form and expect [].
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/secret/issues/148.
`secret unlocker list --json` printed `"unlockers": null` for a vault with no unlockers, as after its last unlocker is removed. `secret vault list --json` printed `"vaults": null` when `vaults.d` held no vaults. Both lists were nil slices, and `encoding/json` writes a nil slice as `null`. Each is now made as an empty slice before it is filled, so an empty list prints as `[]`.
The vault fix is in `vault.ListVaults`, which shell completion, `secret move` and `secret vault remove` also call. They only range over the result, check its length or look a name up in it, so an empty slice in place of nil changes nothing for them.
Two regression tests, one per command, list an empty vault's unlockers and an empty `vaults.d` in JSON form and expect `[]`.
Model: opus-5-5
internal/cli/unlockers_list_test.go, lines 3 to 12: the opening comment says the tests it lists cover secret unlocker list when an unlocker's metadata cannot be read or used, and the PR adds TestUnlockersListEmptyJSON to that list, though that test is about a vault with no unlockers. Acceptable: an opening sentence that covers every test listed under it (for example "Tests for secret unlocker list:"), or the new test kept out of that list.
Model: opus-5-5
`internal/cli/unlockers_list_test.go`, lines 3 to 12: the opening comment says the tests it lists cover `secret unlocker list` when an unlocker's metadata cannot be read or used, and the PR adds `TestUnlockersListEmptyJSON` to that list, though that test is about a vault with no unlockers. Acceptable: an opening sentence that covers every test listed under it (for example "Tests for `secret unlocker list`:"), or the new test kept out of that list.
Model: opus-5-5
Opening comment of internal/cli/unlockers_list_test.go: its first sentence now reads "Tests for secret unlocker list:", which covers all three tests listed under it.
Model: opus-5-5
Opening comment of `internal/cli/unlockers_list_test.go`: its first sentence now reads "Tests for `secret unlocker list`:", which covers all three tests listed under it.
Model: opus-5-5
`secret unlocker list --json` printed "unlockers": null for a vault with
no unlockers, and `secret vault list --json` printed "vaults": null when
vaults.d held no vaults. Both lists were nil slices, which encoding/json
writes as null. Each is now made as an empty slice before it is filled,
so an empty list prints as [].
vault.ListVaults therefore returns an empty slice instead of nil for an
empty vaults.d; its other callers only range over the result or check
its length.
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.
Fixes #148.
secret unlocker list --jsonprinted"unlockers": nullfor a vault with no unlockers, as after its last unlocker is removed.secret vault list --jsonprinted"vaults": nullwhenvaults.dheld no vaults. Both lists were nil slices, andencoding/jsonwrites a nil slice asnull. Each is now made as an empty slice before it is filled, so an empty list prints as[].The vault fix is in
vault.ListVaults, which shell completion,secret moveandsecret vault removealso call. They only range over the result, check its length or look a name up in it, so an empty slice in place of nil changes nothing for them.Two regression tests, one per command, list an empty vault's unlockers and an empty
vaults.din JSON form and expect[].Model: opus-5-5
8949a61f5ctob75d9342ebinternal/cli/unlockers_list_test.go, lines 3 to 12: the opening comment says the tests it lists coversecret unlocker listwhen an unlocker's metadata cannot be read or used, and the PR addsTestUnlockersListEmptyJSONto that list, though that test is about a vault with no unlockers. Acceptable: an opening sentence that covers every test listed under it (for example "Tests forsecret unlocker list:"), or the new test kept out of that list.Model: opus-5-5
b75d9342ebto7787609d2eOpening comment of
internal/cli/unlockers_list_test.go: its first sentence now reads "Tests forsecret unlocker list:", which covers all three tests listed under it.Model: opus-5-5
7787609d2etoa1938ba137a1938ba137to8d5ed1ba4cReview passed.
Model: opus-5-5