Skip to content

fix(cli): report invalid log levels for maintenance runs - #5586

Open
justadityaraj wants to merge 1 commit into
kopia:masterfrom
justadityaraj:fix/invalid-log-level-error
Open

fix(cli): report invalid log levels for maintenance runs#5586
justadityaraj wants to merge 1 commit into
kopia:masterfrom
justadityaraj:fix/invalid-log-level-error

Conversation

@justadityaraj

Copy link
Copy Markdown

Context

maintenance run --safety=none could replace an invalid global flag error with the unrelated unhandled safety level message because the safety flag's backing value remained empty until Kingpin applied its default.

Changes

Initialize the backing value to the safety flag's documented default before parser hooks run, and cover the invalid log-level path with a regression test.

User impact

Invalid log levels used with maintenance runs now report the allowed values so the flag can be corrected directly.

Verification

  • go test ./cli -run '^TestMaintenanceRunReportsInvalidGlobalFlag$' -count=1 -v
  • go test ./cli -count=1
  • go vet -all ./cli
  • golangci-lint run ./cli/...
  • gopls check cli/app.go cli/command_maintenance_run_test.go

Fixes #4008

@justadityaraj
justadityaraj requested a review from a team August 27, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect log-level flag use shows incorrect error on safety flag

1 participant