secret list gives each secret's own creation and last-update times (closes #142) #168

Merged
clawbot merged 1 commits from fix/142-list-real-times into next 2026-10-15 00:32:06 +02:00
Collaborator

secret list showed the time of the listing as every secret's creation and last-update time (#142), because Secret.LoadMetadata set both to the current time.

LoadMetadata now reads file modification times, so secret list still needs no passphrase:

  • last update (LAST UPDATED, updated_at): when the secret's current file was written, which every add and secret version promote replace;
  • creation (created_at): when the oldest version's value.age was written.

A move to another vault writes new copies of those files, so it now gives each copy the modification time of the file it was copied from. The README and the secret version promote help say that a promote moves the last update.

GetSecretObject no longer loads the times, so secret get keeps its error for a missing current file; secret list calls LoadMetadata itself. A secret whose times cannot be read is listed as before: unknown in the table, no time fields in --json.

The new tests run on a real filesystem. One lists twice with a clock step between, then adds again with --force; the other moves a secret between vaults and compares the times listed on both sides.

  • Deviation from the plan: the creation time comes from the oldest version's value.age, not its directory, whose time changes when the next add rewrites that version's metadata.age.
  • Removing the oldest version with secret version remove makes the next version's time the creation time.
  • Times stay in the local time zone, as the listing printed them before.

Model: opus-5-5

`secret list` showed the time of the listing as every secret's creation and last-update time (https://git.eeqj.de/sneak/secret/issues/142), because `Secret.LoadMetadata` set both to the current time. `LoadMetadata` now reads file modification times, so `secret list` still needs no passphrase: - last update (`LAST UPDATED`, `updated_at`): when the secret's `current` file was written, which every add and `secret version promote` replace; - creation (`created_at`): when the oldest version's `value.age` was written. A move to another vault writes new copies of those files, so it now gives each copy the modification time of the file it was copied from. The README and the `secret version promote` help say that a promote moves the last update. `GetSecretObject` no longer loads the times, so `secret get` keeps its error for a missing `current` file; `secret list` calls `LoadMetadata` itself. A secret whose times cannot be read is listed as before: `unknown` in the table, no time fields in `--json`. The new tests run on a real filesystem. One lists twice with a clock step between, then adds again with `--force`; the other moves a secret between vaults and compares the times listed on both sides. - Deviation from the plan: the creation time comes from the oldest version's `value.age`, not its directory, whose time changes when the next add rewrites that version's `metadata.age`. - Removing the oldest version with `secret version remove` makes the next version's time the creation time. - Times stay in the local time zone, as the listing printed them before. Model: opus-5-5
clawbot added the needs-review label 2026-10-14 21:27:49 +02:00
clawbot self-assigned this 2026-10-14 21:27:49 +02:00
clawbot force-pushed fix/142-list-real-times from 759dbb1b1d to b467b6822a 2026-10-14 22:07:11 +02:00 Compare
Author
Collaborator
  1. README.md line 190 and internal/cli/version.go lines 67–68 still say that secret version promote does not modify any timestamps. With this change a promote replaces the secret's current file and so moves the last-update time that secret list gives, as the new paragraph at README.md lines 153–157 says. Acceptable: both say that a promote leaves the versions' own times unchanged and that secret list then gives the time of the promote as the secret's last update.

  2. A secret moved to another vault is listed with the time of the move as both its creation and its last update. A move between vaults copies each version through CopySecretVersion (internal/vault/secrets.go lines 464–503), which writes a new value.age, and writes a new current (line 820). The move keeps the versions' own creation times on purpose (line 496), its help says it preserves history (internal/cli/secrets.go line 243), and the definition of done asks for times that match when the secret was added or updated. Acceptable: the copy gives each copied value.age and current the modification time of the file it was copied from, and a test moves a secret between vaults and finds the same times in secret list on both sides; or, if the time of the move is the intended answer, the secret list paragraph in README.md says so.

Model: opus-5-5

1. `README.md` line 190 and `internal/cli/version.go` lines 67–68 still say that `secret version promote` does not modify any timestamps. With this change a promote replaces the secret's `current` file and so moves the last-update time that `secret list` gives, as the new paragraph at `README.md` lines 153–157 says. Acceptable: both say that a promote leaves the versions' own times unchanged and that `secret list` then gives the time of the promote as the secret's last update. 2. A secret moved to another vault is listed with the time of the move as both its creation and its last update. A move between vaults copies each version through `CopySecretVersion` (`internal/vault/secrets.go` lines 464–503), which writes a new `value.age`, and writes a new `current` (line 820). The move keeps the versions' own creation times on purpose (line 496), its help says it preserves history (`internal/cli/secrets.go` line 243), and the definition of done asks for times that match when the secret was added or updated. Acceptable: the copy gives each copied `value.age` and `current` the modification time of the file it was copied from, and a test moves a secret between vaults and finds the same times in `secret list` on both sides; or, if the time of the move is the intended answer, the `secret list` paragraph in `README.md` says so. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-14 22:26:15 +02:00
clawbot force-pushed fix/142-list-real-times from b467b6822a to 39c9d1bf88 2026-10-14 23:11:18 +02:00 Compare
clawbot force-pushed fix/142-list-real-times from 39c9d1bf88 to cad38994dd 2026-10-14 23:35:16 +02:00 Compare
Author
Collaborator
  1. README.md and the promote help now say a promote leaves the versions' own times unchanged and that secret list then gives the time of the promote as the last update.
  2. A move to another vault gives each copied value.age and current the modification time of its original; TestMovedSecretKeepsItsTimes moves a secret and compares secret list on both sides, and README.md says a move keeps both times.

Model: opus-5-5

1. `README.md` and the promote help now say a promote leaves the versions' own times unchanged and that `secret list` then gives the time of the promote as the last update. 2. A move to another vault gives each copied `value.age` and `current` the modification time of its original; `TestMovedSecretKeepsItsTimes` moves a secret and compares `secret list` on both sides, and `README.md` says a move keeps both times. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-14 23:35:22 +02:00
clawbot added 1 commit 2026-10-14 23:49:50 +02:00
secret list and secret list --json gave the time of the listing as every
secret's creation and last-update time, because Secret.LoadMetadata set
both to the current time. It now reads file modification times, so
listing still needs no passphrase: the last update is when the secret's
current file was written, and the creation is when its oldest version's
value.age was written. A move to another vault gives the copied files
the times of the originals.

GetSecretObject no longer loads the times, so secret get keeps its error
for a missing current file; secret list calls LoadMetadata itself.

Judgement call: the creation time comes from value.age, not from the
oldest version's directory, whose time changes when the next add
rewrites that version's metadata.age.

Model: opus-5-5
clawbot force-pushed fix/142-list-real-times from cad38994dd to 4cfbfc3719 2026-10-14 23:49:50 +02:00 Compare
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit faf46d12ff into next 2026-10-15 00:32:06 +02:00
clawbot deleted branch fix/142-list-real-times 2026-10-15 00:32:07 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/secret#168