fix(#380): unify resolve-time leading blank across resources show/set - #468
Merged
Conversation
saadqbal
self-requested a review
August 7, 2026 10:02
saadqbal
previously approved these changes
Aug 7, 2026
saadqbal
left a comment
Collaborator
There was a problem hiding this comment.
Clean, well-reasoned spacing fix 👍 Centralizing the redirect blank in discoverRelease so every caller self-leads is the right altitude. A few non-blocking nits inline — the one worth a look is that the single-blank tests don't actually exercise the multi-client redirect path they exist to protect.
Removing the intro Banner (#375) left `resources show` and `resources set` handling the leading blank differently, so the multi-client resolve-time redirect line got a blank on show but not on set (Bugbot "Missing lead blank on set path"). The naive fix — give set the same pre-resolve Newline() — would re-introduce the #375 double-blank (it stacks with the self-leading confirm PromptHint / dry-run Section). Standardize the spacing at the source instead of per-caller: - discoverRelease's multi-client redirect Infof now self-leads its own single blank, so every command that hits it gets exactly one leading blank — no per-command pre-resolve Newline() needed. - resources show moves its leading blank from before resolveClusterTarget into renderResources (before the first Stat), so it no longer stacks on the now-self-leading redirect in the multi-client case. - resources set keeps no command-level pre-resolve Newline() (preserves the #375 double-blank fix); its self-leading confirm/dry-run paths are unchanged. Tests: added a self-lead assertion to TestDiscoverRelease_ScanFindsSingleClient- Elsewhere; refreshed the stale comment in TestShow_OpensWithSingleBlank (the blank moved into renderResources). go build/test, gofmt -s, and go vet all pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eview) The self-lead blank in discoverRelease's multi-client redirect fired wherever discoverRelease ran in each caller's output. For resolve-first commands (resources show/set, data list, seal) that's a clean leading blank. But cluster info, data ingest, and data delete all print output BEFORE resolving, so the self-lead landed mid-output — splitting cluster info's Kubeconfig section between the server and namespace Fields, and data ingest between "Connecting…" and its note (saadqbal review). Thread a leadRedirect bool through discoverRelease / resolveClusterTarget: true for resolve-first callers (redirect self-leads its one blank), false for output-first callers (note stays inline, no mid-output blank — restoring pre-PR spacing). resources set keeps NO pre-resolve Newline(), so the #375 confirm/dry-run double-blank fix is preserved. Add real MULTI-CLIENT tests for resources show and set that run through the actual resolve seam (loadClusterFn/newClientsetFn, not the resolveClusterTargetFn stub) so the redirect actually fires, asserting exactly one leading blank. Fix the overclaiming comment on TestShow_OpensWithSingleBlank (it only covers the single-client open). Drop the redundant "\n\n" disjunct in the clustertarget_test assertion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
divyasinghds
force-pushed
the
fix/380-resolve-leading-blank
branch
from
August 7, 2026 10:51
2a58ead to
1d56fbe
Compare
saadqbal
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #380
Follow-up to #375 (banner removal). Removing the intro
Bannerleftresources showandresources sethandling the leading blank differently: in the multi-client case the resolve-time redirect line (discoverRelease'sInfof) got a leading blank onshow(which printed a pre-resolveNewline()) but not onset(Bugbot "Missing lead blank on set path"). The naive fix — givesetthe same pre-resolveNewline()— re-introduces the #375 double-blank, since a leadingNewline()stacks with the self-leading confirmPromptHint/ dry-runSection.Changes
discoverRelease(internal/cli/clustertarget.go) — the multi-client redirectInfofnow self-leads its own single blank (p.Newline()immediately before it). Any command that hits the redirect now gets exactly one leading blank without a per-command pre-resolveNewline().resources show(internal/cli/resources.go) — moved the leading blank from beforeresolveClusterTargetinrunResourcesShowto insiderenderResources(before the firstStat), so it no longer stacks on the now-self-leading redirect in the multi-client case.resources set(internal/cli/resources_set.go) — unchanged: it already has no command-level pre-resolveNewline(), preserving the ui: remove the shared Banner method (no intro banner on any command) #375 double-blank fix; its self-leading confirm (PromptHint) / dry-run (Section) paths are untouched.Acceptance
resources setnow opens with exactly one leading blank (self-leading redirect).resources show(single + multi) still opens with exactly one blank — no double. Single-client: no redirect, therenderResourcesblank leads the view. Multi-client: one blank before the redirect, one before the view — no double-blank anywhere.setstill has no pre-resolveNewline(); confirm/dry-run paths unchanged.discoverRelease-resolving commands (data list/delete/ingest, cluster info, seal) still open with one leading blank — none had a pre-resolveNewline()to stack against, andcluster info's openingSection("Kubeconfig")self-leads as before; the now-self-leading redirect just gets its own separator on their multi-client paths.Tests / validation
TestDiscoverRelease_ScanFindsSingleClientElsewhere(redirect output must open with exactly one\n).TestShow_OpensWithSingleBlank(the blank moved intorenderResources); the end-to-end single-blank assertion still holds.go build ./...,go test ./...(all packages),gofmt -s -l, andgo vet ./internal/cli/all pass. Copy/string catalog goldens unchanged (no user-facing string changed).🤖 Generated with Claude Code
Note
Low Risk
CLI presentation-only changes around newlines and discovery messaging; behavior and exit codes unchanged aside from spacing.
Overview
Fixes #380 (follow-up to #375): when cluster discovery retargets to another namespace, terminal output should have exactly one leading blank—not zero on
resources set, and not a double whenshowprinted a blank before resolve.discoverReleasegains aleadRedirectflag. On a successful single-client scan redirect, it optionally printsp.Newline()immediately before the redirectInfofso resolve-first commands get one separator from the shell prompt without each command adding its own pre-resolve blank.resolveClusterTargetthreadsleadRedirectthrough todiscoverRelease. Callers passtruewhen resolve is the first output (resources show/set,data list,seal) andfalsewhen something already printed (cluster infokubeconfig section,data ingest“Connecting…”,data deletewarning).resources showdrops the pre-resolveNewline()inrunResourcesShowand moves the view’s opening blank intorenderResources(before the firstStat) so it does not stack with the self-leading redirect on the multi-client path.resources setkeeps no pre-resolve blank;leadRedirect=truesupplies the multi-client case while confirm/dry-run paths still self-lead.Tests add §380 assertions (redirect opens with
\n, no\n\n) and end-to-endTestShow_MultiClientRedirectOpensWithSingleBlank/TestSet_MultiClientRedirectOpensWithSingleBlankthrough real resolve seams.Reviewed by Cursor Bugbot for commit 1d56fbe. Bugbot is set up for automated code reviews on this repo. Configure here.