Repository navigation
fix(OPENFRAM-007): CU-86aknprf9 Warning printed via fmt.Fprintf to stderr in ExecuteWithVersion for config init failure bypasses pterm/ui path - #395
Conversation
…teWithVersion for config init failure bypasses pterm/ui path
| @@ -247,7 +247,7 @@ func ExecuteWithVersion(versionInfo VersionInfo) error { | |||
| // Initialize configuration using service layer | |||
| service := config.NewSystemService() | |||
There was a problem hiding this comment.
🦩 🟠 Warning printed via fmt.Fprintf to stderr in ExecuteWithVersion for config init failure bypasses pterm/ui path
In ExecuteWithVersion (cmd/root.go), replaced the direct fmt.Fprintf(os.Stderr, "Warning: initialization failed: %v\n", err) with pterm.Warning.WithWriter(os.Stderr).Printf("initialization failed: %v\n", err), matching the suggested fix and the existing pterm usage pattern later in the same function (pterm.Info.WithWriter(os.Stderr)). This routes the message through pterm's printer as requested. Note: pterm's Warning printer does not itself check the --silent flag, so full silent-mode suppression still depends on how ui.ApplyGlobalOutputFlags configures pterm's global output writer/level elsewhere in the codebase — I could not verify from this file alone that pterm.Warning is fully gated by --silent at this call site, since Initialize() runs before PersistentPreRunE (which applies the silent flag) in the command lifecycle.
🤖 Prompt for AI agents
In cmd/root.go around line 248, review and complete this code-review fix: Warning printed via fmt.Fprintf to stderr in ExecuteWithVersion for config init failure bypasses pterm/ui path.
What the draft fix changed: In ExecuteWithVersion (cmd/root.go), replaced the direct `fmt.Fprintf(os.Stderr, "Warning: initialization failed: %v\n", err)` with `pterm.Warning.WithWriter(os.Stderr).Printf("initialization failed: %v\n", err)`, matching the suggested fix and the existing pterm usage pattern later in the same function (`pterm.Info.WithWriter(os.Stderr)`). This routes the message through pterm's printer as requested. Note: pterm's Warning printer does not itself check the `--silent` flag, so full silent-mode suppression still depends on how `ui.ApplyGlobalOutputFlags` configures pterm's global output writer/level elsewhere in the codebase — I could not verify from this file alone that pterm.Warning is fully gated by `--silent` at this call site, since Initialize() runs before PersistentPreRunE (which applies the silent flag) in the command lifecycle.
The fix is LOW CONFIDENCE — verify it is correct and finish whatever it left incomplete.
fix confidence: 🔴 55 low — review closely — react 👍/👎 to teach the reviewer
Closes findings from rule OPENFRAM-007 — Warning printed via fmt.Fprintf to stderr in ExecuteWithVersion for config init failure bypasses pterm/ui path.
Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.
cmd/root.go:248What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.
Run: https://product-hub.flamingo.so/admin/code-review
Run id:
c7aae0be-2e37-42d8-9976-b316af390712Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.
ClickUp task: CU-86aknprf9 OpenFrame CLI code duplication and manager fixes (13 PRs)