Quiet only the stdout UI under --json, not the log level (closes #112) #145

Open
clawbot wants to merge 1 commits from issue-112-json-decouple-quiet into next
Collaborator

Per the decision recorded on the issue (option 1): --json no longer implies Quiet.

--json was folded into Quiet, which pinned the stderr log level to WARN ahead of --verbose/--debug. So prune --json gave a machine consumer no record of the local index rows it deleted — the audit records were gated off stdout (correct, per #108) and pinned below the level on stderr.

The two effects that one flag conflated are now split. --json quiets only the stdout UI, so the JSON document stays clean; the stderr log level follows --verbose/--debug again, since diagnostics have gone to stderr since #82. Mechanically: a JSON field on log.Options drives the UI-quiet in setupGlobals; log.New deliberately drops it before the log level is chosen.

Per done-item 4, the same coupling is removed for snapshot verify, snapshot remove, and remote info, which carried it for the same outdated reason. snapshot list was already decoupled and is unchanged.

Test: --verbose prune --json emits the cleanup record on stderr while stdout stays exactly one document; --json alone keeps it below the level. It fails without the source change.

Compatibility with #139 (open, touches PruneDatabase's counts): no code overlap beyond a TODO.md Completed Steps entry; expect a rebase there, keeping both entries. Under --json those counts stay UI-suppressed as before.

model: claude-opus-4-8

Per the decision recorded on the issue (option 1): `--json` no longer implies `Quiet`. `--json` was folded into `Quiet`, which pinned the stderr log level to `WARN` ahead of `--verbose`/`--debug`. So `prune --json` gave a machine consumer no record of the local index rows it deleted — the audit records were gated off stdout (correct, per https://git.eeqj.de/sneak/vaultik/issues/108) and pinned below the level on stderr. The two effects that one flag conflated are now split. `--json` quiets only the stdout UI, so the JSON document stays clean; the stderr log level follows `--verbose`/`--debug` again, since diagnostics have gone to stderr since https://git.eeqj.de/sneak/vaultik/issues/82. Mechanically: a `JSON` field on `log.Options` drives the UI-quiet in `setupGlobals`; `log.New` deliberately drops it before the log level is chosen. Per done-item 4, the same coupling is removed for `snapshot verify`, `snapshot remove`, and `remote info`, which carried it for the same outdated reason. `snapshot list` was already decoupled and is unchanged. Test: `--verbose prune --json` emits the cleanup record on stderr while stdout stays exactly one document; `--json` alone keeps it below the level. It fails without the source change. Compatibility with https://git.eeqj.de/sneak/vaultik/pulls/139 (open, touches `PruneDatabase`'s counts): no code overlap beyond a `TODO.md` Completed Steps entry; expect a rebase there, keeping both entries. Under `--json` those counts stay UI-suppressed as before. model: claude-opus-4-8
clawbot added the needs-review label 2026-09-21 21:27:48 +02:00
clawbot self-assigned this 2026-09-21 21:27:48 +02:00
clawbot added 1 commit 2026-09-21 21:50:22 +02:00
--json was folded into Quiet, which pinned the stderr log level to WARN.
So `prune --json` gave a machine consumer no record of the local index
rows it deleted, even under --verbose: the audit records were gated off
stdout and pinned below the level on stderr.

--json now quiets only the stdout UI, keeping the JSON document clean
(issue #108); the stderr log level follows --verbose/--debug again, since
diagnostics have gone to stderr since #82. The same coupling is removed
for `snapshot verify`, `snapshot remove`, and `remote info`, which
carried it for the same outdated reason.

A test asserts `--verbose prune --json` emits the cleanup record on
stderr while stdout stays exactly one document, and that --json alone
keeps it below the level.

model: claude-opus-4-8
clawbot force-pushed issue-112-json-decouple-quiet from 8fefb77e86 to 311756d452 2026-09-21 21:50:22 +02:00 Compare
Author
Collaborator

Rebased onto current next (c355ef4). The only collision was the TODO.md Completed Steps list; kept both entries. The issue #96 prune-summary change and this PR's change touch independent paths, and both behaviours hold: under --verbose --json the cleanup records reach stderr while stdout stays one JSON document, and an unreadable prune count still warns on stderr under --json (the default log level is WARN, so --json no longer forcing it makes no difference). Reconfirmed the regression test still fails without the source change. Gated make check green (one complete run) on head 311756d452cbe9365c0f16475ec9b670278c3a23.

model: claude-opus-4-8

Rebased onto current `next` (`c355ef4`). The only collision was the `TODO.md` Completed Steps list; kept both entries. The [issue #96](https://git.eeqj.de/sneak/vaultik/issues/96) prune-summary change and this PR's change touch independent paths, and both behaviours hold: under `--verbose --json` the cleanup records reach stderr while stdout stays one JSON document, and an unreadable prune count still warns on stderr under `--json` (the default log level is `WARN`, so `--json` no longer forcing it makes no difference). Reconfirmed the regression test still fails without the source change. Gated `make check` green (one complete run) on head `311756d452cbe9365c0f16475ec9b670278c3a23`. model: claude-opus-4-8
Some required checks failed
check / check (pull_request) Failing after 1s
This pull request has changes conflicting with the target branch.
  • internal/cli/app.go
View command line instructions

Checkout

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