fix: suppress banner in completion and redirected output#1376
fix: suppress banner in completion and redirected output#1376Alix-007 wants to merge 3 commits intosipeed:mainfrom
Conversation
yinwm
left a comment
There was a problem hiding this comment.
PR #1376 Review: suppress banner in completion and redirected output
✅ Strengths
- Clean logic: Extracted banner printing condition into a standalone
shouldPrintBanner()function with clear responsibilities - Test coverage: Added 4 sub-tests covering main scenarios
- Environment variable support:
PICOCLAW_NO_BANNERprovides flexible user control - Cross-platform: Uses
golang.org/x/termfor reliable terminal detection
⚠️ Issues & Suggestions
1. Incomplete environment variable value handling
func bannerDisabledByEnv() bool {
value := strings.TrimSpace(strings.ToLower(os.Getenv(noBannerEnv)))
switch value {
case "", "0", "false", "no", "off":
return false
default:
return true
}
}Issue: Tests only cover "1", but not "true", "yes", "on" which are common truthy values.
Suggestion: Either add test cases for these values, or unify the logic:
func bannerDisabledByEnv() bool {
value := strings.TrimSpace(strings.ToLower(os.Getenv(noBannerEnv)))
switch value {
case "", "0", "false", "no", "off":
return false
case "1", "true", "yes", "on":
return true
default:
return true
}
}2. Test cases could be more comprehensive
Suggested additions:
- Test
"true","yes","on"env values - Test empty args
[]string{"picoclaw"}(no subcommand) - Test unknown subcommand behavior
3. Minor: Constant grouping
noBannerEnv mixed with color constants feels semantically inconsistent. Consider moving it to a separate group.
📝 Summary
| Category | Rating |
|---|---|
| Code Quality | ⭐⭐⭐⭐ Good |
| Test Coverage | ⭐⭐⭐ Basic, could be improved |
| Design | ⭐⭐⭐⭐ OK |
| Maintainability | ⭐⭐⭐⭐ Good |
Verdict: This is a quality PR with clear logic that solves a real problem. Suggest adding env value test cases before merging.
Request changes mainly for the test coverage improvement, but the core implementation is solid. 👍
|
CLA has been signed. This PR is currently blocked because the There are 4 related small bugfix PRs from the same contributor also waiting on workflow approval: #1377, #1378, #1379, #1380. |
|
Thanks for the careful review and the concrete suggestions. I pushed an update on this branch to address the coverage gaps you called out:
I also re-ran:
Please take another look when you have a moment. |
|
Quick follow-up on the fork workflow approvals: besides the earlier batch, the additional small-fix PRs #1384, #1385, #1386, #1391, #1392, and #1393 are also still showing |
|
Addressed the requested banner coverage gap on this branch. Updates:
I could not run Please take another look when convenient. |
|
New low-risk fix PRs are up and all five are currently mergeable=true but still blocked with no checks created yet, so they likely need maintainer approval to run fork workflows as well:
When you have a moment, could you approve workflow execution for these too? Thanks. |
|
The review items should be addressed on the branch now:
I also re-ran:
|
|
Closing this old review thread for queue hygiene. The requested changes were addressed long ago, but the branch is now part of an old, workflow-polluted queue and no longer worth carrying as an active PR. If the fix is still desired, I can rebuild it cleanly from current main. |
Summary
completion,__complete, and__completeNoDescPICOCLAW_NO_BANNERand unit coverage for the new guard pathsFixes #1305
Testing
go test ./cmd/picoclaw -run TestShouldPrintBanner