Skip to content

fix(OPENFRAM-007): CU-86aknprf9 Warning printed via fmt.Fprintf to stderr in ExecuteWithVersion for config init failure bypasses pterm/ui path - #395

Draft
flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/openfram-007-dcba0353-c7aae0be
Draft

flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/openfram-007-dcba0353-c7aae0be

Conversation

@flamingo

@flamingo flamingo Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

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.

# Fix confidence Finding Location
1 🔴 55 low — review closely Warning printed via fmt.Fprintf to stderr in ExecuteWithVersion for config init failure bypasses pterm/ui path cmd/root.go:248

What 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-b316af390712

Merging 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)

…teWithVersion for config init failure bypasses pterm/ui path

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 What this fix changed, finding by finding

1 finding(s) fixed in this draft — 1 explained inline on the diff; 1 low-confidence hunk(s) need close review before merging.

Comment thread cmd/root.go
@@ -247,7 +247,7 @@ func ExecuteWithVersion(versionInfo VersionInfo) error {
// Initialize configuration using service layer
service := config.NewSystemService()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 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

@flamingo flamingo Bot changed the title fix(OPENFRAM-007): Warning printed via fmt.Fprintf to stderr in ExecuteWithVersion for config init failure bypasses pterm/ui path fix(OPENFRAM-007): CU-86aknprf9 Warning printed via fmt.Fprintf to stderr in ExecuteWithVersion for config init failure bypasses pterm/ui path Sep 23, 2026
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.

0 participants