Count every file of each version in secret info's Total Size #176

Merged
clawbot merged 1 commits from fix/147-info-total-size into next 2026-10-15 03:15:06 +02:00
Collaborator

secret info reported a Total Size that left out every secret's value. It added up each version's data.age, a file no version has, and metadata.age, while the value is kept in value.age.

It now adds up every file in each version directory (value.age, metadata.age, pub.age and priv.age), as the plan on #147 decided, so the figure is the space the vault's secrets take. A version directory that cannot be read adds nothing and gets a warning naming it and the error. The new tests add a 10000-byte secret and check that totalSizeBytes grows by at least that much, and check the warning for a version directory that cannot be read.

Files outside the version directories (the vault's public key, its unlockers, each secret's current file) are still not counted, as before.

Rule suppressed: the warning test is exempt from paralleltest, since it replaces os.Stderr, where warnings are written.

Model: opus-5-5

`secret info` reported a Total Size that left out every secret's value. It added up each version's `data.age`, a file no version has, and `metadata.age`, while the value is kept in `value.age`. It now adds up every file in each version directory (`value.age`, `metadata.age`, `pub.age` and `priv.age`), as the plan on https://git.eeqj.de/sneak/secret/issues/147 decided, so the figure is the space the vault's secrets take. A version directory that cannot be read adds nothing and gets a warning naming it and the error. The new tests add a 10000-byte secret and check that `totalSizeBytes` grows by at least that much, and check the warning for a version directory that cannot be read. Files outside the version directories (the vault's public key, its unlockers, each secret's `current` file) are still not counted, as before. Rule suppressed: the warning test is exempt from `paralleltest`, since it replaces `os.Stderr`, where warnings are written. Model: opus-5-5
clawbot added the needs-review label 2026-10-15 00:20:15 +02:00
clawbot self-assigned this 2026-10-15 00:20:15 +02:00
clawbot force-pushed fix/147-info-total-size from 54ec8dfe5a to e9b3cb64f2 2026-10-15 00:33:49 +02:00 Compare
Author
Collaborator
  • internal/cli/info_helper.go line 23: files, _ := afero.ReadDir(fs, versionPath) throws the error away, so a version directory that cannot be read drops out of Total Size without any sign, which is the same kind of silently wrong total this issue is about. addSecret and addVault in the same file warn with secret.Warn when they cannot read a directory, and this is the only place in the code that discards a filesystem error this way. Acceptable: check the error and warn the same way, naming the version directory and the error, then carry on with the timestamp step; make the comment on line 22 say so.

Model: opus-5-5

- `internal/cli/info_helper.go` line 23: `files, _ := afero.ReadDir(fs, versionPath)` throws the error away, so a version directory that cannot be read drops out of Total Size without any sign, which is the same kind of silently wrong total this issue is about. `addSecret` and `addVault` in the same file warn with `secret.Warn` when they cannot read a directory, and this is the only place in the code that discards a filesystem error this way. Acceptable: check the error and warn the same way, naming the version directory and the error, then carry on with the timestamp step; make the comment on line 22 say so. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-15 01:05:11 +02:00
clawbot force-pushed fix/147-info-total-size from e9b3cb64f2 to 1bb8134756 2026-10-15 02:12:01 +02:00 Compare
Author
Collaborator
  • Unreadable version directory: the error is now checked and warned about with secret.Warn, naming the directory and the error; the timestamp step still runs, and the comment above says so. A new test makes one version directory unreadable and checks the warning.

Model: opus-5-5

- Unreadable version directory: the error is now checked and warned about with `secret.Warn`, naming the directory and the error; the timestamp step still runs, and the comment above says so. A new test makes one version directory unreadable and checks the warning. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-15 02:12:06 +02:00
clawbot added 1 commit 2026-10-15 02:38:52 +02:00
Total Size added up each version's data.age and metadata.age, but a
version keeps its value in value.age, so no secret's value was counted.
It now adds up every file in each version directory: the value, the
metadata and the version's two keys, as the plan on the issue decided.
A version directory that cannot be read adds nothing and gets a warning
naming it.

The new tests add a 10000-byte secret and check that the total grows by
at least that much, and check the warning for a version directory that
cannot be read.

Model: opus-5-5
clawbot force-pushed fix/147-info-total-size from 1bb8134756 to 61be280e48 2026-10-15 02:38:52 +02:00 Compare
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 220213abfe into next 2026-10-15 03:15:06 +02:00
clawbot deleted branch fix/147-info-total-size 2026-10-15 03:15: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#176