Report a prune count that could not be read as unknown, not 0 (closes #96) #139

Open
clawbot wants to merge 1 commits from issue-96-gettablecount-errors into next
Collaborator

PruneDatabase read seven table row counts with the error discarded, so a query that could not run silently became 0 and the before/after delta looked like real work — the wrong-number-instead-of-error shape the issue #71 triage was removing.

Each read now goes through tableCountForReport, which logs at warn on failure and returns nil. nil renders as unknown, never 0, so an empty table is distinguishable from one that could not be queried; a delta built from an unknown count is itself unknown.

Design choice (done #1): these are diagnostic counts, so the failure is surfaced (warn log), not propagated — the command's failure conditions are unchanged.

--json (done #3): the local prune counts have no JSON representation. prune --json emits only PruneBlobsResult (remote blob stats); PruneDatabase's result is discarded by Prune, and under --json the text summary is suppressed. No JSON path can show a false 0, and the warn still reaches stderr under --json.

Other discards (done #5): the only remaining , _ := discards in internal/vaultik are fmt.Fprintf/Fprintln stdout writes and os.Hostname; none feeds a user-visible number, so none needs this treatment.

A test forces a read against a nonexistent table and asserts the render is unknown, never 0.

Disclosure: inherited from a stopped worker's single commit. Its test lacked a //nolint:paralleltest directive (it installs the global logger) and failed lint; I added the directive, rebased onto current next, and re-gated green.

model: claude-opus-4-8

`PruneDatabase` read seven table row counts with the error discarded, so a query that could not run silently became `0` and the before/after delta looked like real work — the wrong-number-instead-of-error shape the [issue #71](https://git.eeqj.de/sneak/vaultik/issues/71) triage was removing. Each read now goes through `tableCountForReport`, which logs at warn on failure and returns `nil`. `nil` renders as `unknown`, never `0`, so an empty table is distinguishable from one that could not be queried; a delta built from an unknown count is itself unknown. Design choice (done #1): these are diagnostic counts, so the failure is surfaced (warn log), not propagated — the command's failure conditions are unchanged. `--json` (done #3): the local prune counts have no JSON representation. `prune --json` emits only `PruneBlobsResult` (remote blob stats); `PruneDatabase`'s result is discarded by `Prune`, and under `--json` the text summary is suppressed. No JSON path can show a false `0`, and the warn still reaches stderr under `--json`. Other discards (done #5): the only remaining `, _ :=` discards in `internal/vaultik` are `fmt.Fprintf`/`Fprintln` stdout writes and `os.Hostname`; none feeds a user-visible number, so none needs this treatment. A test forces a read against a nonexistent table and asserts the render is `unknown`, never `0`. Disclosure: inherited from a stopped worker's single commit. Its test lacked a `//nolint:paralleltest` directive (it installs the global logger) and failed lint; I added the directive, rebased onto current `next`, and re-gated green. model: claude-opus-4-8
clawbot added the needs-review label 2026-09-21 20:07:56 +02:00
clawbot self-assigned this 2026-09-21 20:07:56 +02:00
clawbot force-pushed issue-96-gettablecount-errors from 2de79a0897 to 0e57ea874a 2026-09-21 20:45:47 +02:00 Compare
Author
Collaborator

Rebased onto current origin/next. The only conflict was in TODO.md Completed Steps; resolved by keeping both entries (this PR's #96 entry and the #131 entry now on next). No other changes. make fmt clean, authoritative make check green.

model: claude-opus-4-8

Rebased onto current `origin/next`. The only conflict was in `TODO.md` Completed Steps; resolved by keeping both entries (this PR's #96 entry and the #131 entry now on `next`). No other changes. `make fmt` clean, authoritative `make check` green. model: claude-opus-4-8
Author
Collaborator

PASS: prune now reports an unreadable table count as unknown rather than 0 in the human summary (with a warn to stderr, also under --json), and no --json document exposes these counts, so none can show a false 0.

model: claude-opus-4-8

PASS: prune now reports an unreadable table count as unknown rather than 0 in the human summary (with a warn to stderr, also under --json), and no --json document exposes these counts, so none can show a false 0. model: claude-opus-4-8
clawbot added 1 commit 2026-09-21 21:30:13 +02:00
PruneDatabase read seven table counts with the error discarded, so a
query that could not run silently became 0 and the before/after delta
computed from it looked like real work.

Each read now goes through a helper that logs at warn on failure and
returns nil; nil renders as "unknown", never "0", so an empty table is
distinguishable from one that could not be queried. Deltas built from an
unknown count are themselves unknown. The failure is surfaced, not
propagated, so the command's failure conditions are unchanged. These
counts have no --json output — under --json the summary is suppressed
entirely — so nothing there can show a false 0.

Model: opus-4-8
clawbot force-pushed issue-96-gettablecount-errors from 0e57ea874a to 8baa11b6cb 2026-09-21 21:30:13 +02:00 Compare
Author
Collaborator

Rebased onto current origin/next (5927e1a) and force-pushed. The only conflict was in TODO.md Completed Steps; both entries kept. Everything outside TODO.md is byte-identical to the reviewed commit. Authoritative make check passed on the rebased head 8baa11b6cb10cdef3012073da1d24727b7315421.

model: claude-opus-4-8

Rebased onto current `origin/next` (`5927e1a`) and force-pushed. The only conflict was in `TODO.md` Completed Steps; both entries kept. Everything outside `TODO.md` is byte-identical to the reviewed commit. Authoritative `make check` passed on the rebased head `8baa11b6cb10cdef3012073da1d24727b7315421`. model: claude-opus-4-8
All checks were successful
check / check (pull_request) Successful in 4m8s
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-96-gettablecount-errors:issue-96-gettablecount-errors
git checkout issue-96-gettablecount-errors
Sign in to join this conversation.