Under --json, prune deletes local index rows with no signal in either stream #112
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Split out of PR #111, which
gated
CleanupLocalSnapshots' stdout writes on--json. The gating iscorrect; this is what it exposes.
Under
--json, removing a stale local snapshot record produces nosignal anywhere:
internal/cli/prune.go:49setsQuiet: rootFlags.Quiet || opts.JSON, andinternal/log/log.go:56makes
cfg.Cron || cfg.Quiet→slog.LevelWarnthe first switchcase, ahead of
DebugandVerbose. So--jsonpins the level toWARN and the
log.Inforecords are unreachable. Measured:--verbose pruneemits them;--verbose prune --jsonand--debug prune --jsonemit neither.PruneBlobsResult, since every field there is blob-scoped.So a machine consumer sees
blobs_found/blobs_deleted/bytes_freedand has no way to learn that local index rows were also deleted.
Inherited, not introduced.
PruneBlobs' ownlog.Infocalls areequally invisible under
--jsononmaintoday. #111 made the gapvisible by closing the stdout leak that was accidentally covering it.
Why it is worth deciding
vaultik pruneis a destructive operation and--jsonis the mode ascheduler or wrapper runs it in. "What did you delete?" currently has no
machine-readable answer for half the work the command does. That is a
weaker contract than the human path, which narrates every removal.
There is also a design question underneath: should
--jsonimplyQuiet? Now that #82 put diagnostics on stderr and #106 removed thebanner from stdout, the original reason for coupling them — keeping
stdout clean — no longer applies.
--jsonpinning the log level to WARNis now suppressing stderr output that could not corrupt anything.
Options
--jsonfromQuiet.--jsongates stdout;--verbosecontinues to control stderr independently. Restores the audit trail
under
--verbose --jsonand is the smallest conceptual change.(
stale_records_removedalongside the blob fields). Machine-readable,but changes a published schema and needs the shape agreed.
--jsonreports blob-phase resultsonly.
Recommendation: option 1, and consider 2 separately. 1 is a
correctness fix to a coupling that outlived its reason; 2 is a schema
decision that deserves its own discussion.
Definition of done
--verbose prune --jsonemits the local-cleanup recordson stderr while stdout stays exactly one document. Test both halves.
prune --json | jqmust keep working — that is#108 and must not regress.
--jsontoQuietfor thesame outdated reason, and treat them consistently.
script/cibuildexits 0.