From c0f221b1ca2e4cfab0726e100e6f303557d954b1 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 19 Feb 2026 23:57:39 -0800 Subject: [PATCH] Change missing metadata log from Debug to Warn for visibility without --verbose Per review feedback: missing unlocker metadata should produce a warning visible in normal output, not hidden behind debug flags. --- internal/secret/debug.go | 10 ++++++++++ internal/vault/unlockers.go | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/secret/debug.go b/internal/secret/debug.go index e85b8dc..c38d4ad 100644 --- a/internal/secret/debug.go +++ b/internal/secret/debug.go @@ -58,6 +58,16 @@ func IsDebugEnabled() bool { return debugEnabled } +// Warn logs a warning message to stderr unconditionally (visible without --verbose or debug flags) +func Warn(msg string, args ...any) { + output := fmt.Sprintf("WARNING: %s", msg) + for i := 0; i+1 < len(args); i += 2 { + output += fmt.Sprintf(" %s=%v", args[i], args[i+1]) + } + output += "\n" + fmt.Fprint(os.Stderr, output) +} + // Debug logs a debug message with optional attributes func Debug(msg string, args ...any) { if !debugEnabled { diff --git a/internal/vault/unlockers.go b/internal/vault/unlockers.go index c0f501a..a20ce41 100644 --- a/internal/vault/unlockers.go +++ b/internal/vault/unlockers.go @@ -213,7 +213,7 @@ func (v *Vault) ListUnlockers() ([]UnlockerMetadata, error) { return nil, fmt.Errorf("failed to check if metadata exists for unlocker %s: %w", file.Name(), err) } if !exists { - secret.Debug("Skipping unlocker directory with missing metadata file", "directory", file.Name()) + secret.Warn("Skipping unlocker directory with missing metadata file", "directory", file.Name()) continue }