Skip to content

fix(api-keys): inline confirmation prompt and unify message style#948

Merged
mbevc1 merged 2 commits into
mainfrom
20260609_api-keys_formatting
Jun 11, 2026
Merged

fix(api-keys): inline confirmation prompt and unify message style#948
mbevc1 merged 2 commits into
mainfrom
20260609_api-keys_formatting

Conversation

@mbevc1

@mbevc1 mbevc1 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor
  • The prompt no longer ends with a newline, so the answer is typed on the same line. The cancellation message is now capitalised and the key IDs use the same styling as the prompt.
  • Add new logger helper to print without trailing new line.

The prompt no longer ends with a newline, so the answer is typed
on the same line. The cancellation message is now capitalised and the
key IDs use the same styling as the prompt.
@mbevc1 mbevc1 added tech-debt go Pull requests that update go code labels Jun 9, 2026
@mbevc1 mbevc1 enabled auto-merge (squash) June 9, 2026 21:28
@claude

claude Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Claude finished @mbevc1's task in 2m 17s —— View job


Review: PR #948 — inline confirmation prompt & unified message style

  • Gather context (read changed files)
  • Phase 1: static analysis (go build ./... ✅, go vet ✅)
  • Phase 2: code review
  • Post review

Solid, focused change. It also resolves the coupling concern raised in the previous review: styling decision and the write target now both go through logger.Out (kept in sync via root.go's SetInfoOut), so the prompt and the result/cancellation lines can no longer diverge onto different streams or compute ANSI for the wrong one. Nice.

What's good

  • logger.Print is small, well-documented, and correctly writes through infoLog.Writer() so it follows SetInfoOut redirection. Tests cover the three behaviours that matter: no trailing newline, follows the redirected stream, and survives quiet mode.
  • styleApiKeyIDs removes the duplicated styling loop that previously appeared in both the prompt and the "already deleted" path — good de-duplication.
  • Error propagation from confirmApiKeyDeletion is preserved, and the returned fmt.Errorf stays plain (no ANSI), which is the right call for an error value.
  • Golden/regex test updates match the new on-screen text exactly.

Minor / non-blocking

  1. newDeleteApiKeyCmd(out io.Writer)out is now unused inside the body. Since run no longer takes out and everything styles via logger.Out, the parameter is dead within this function. It still compiles (Go allows unused params) and keeps the signature consistent with the sibling new*Cmd(out io.Writer) factories invoked from delete.go:21, so leaving it is defensible — just flagging it.
  2. Punctuation is slightly inconsistent across messages: success ends with was deleted! (exclamation) while cancellation (was cancelled.) and the failure report (...before this failure:) use a period. Cosmetic, but unifying the tone would read more deliberately.
  3. Print (like Info) does not honour QuietEnabled. For a confirmation prompt this is the correct behaviour — the prompt must always be visible — and TestQuietDoesNotSuppressInfoDebugOrPrint locks it in. Just confirming it's intentional rather than an oversight.

Tests

go build and go vet pass. I couldn't run go test (the command requires approval in this environment), but the logger unit tests are deterministic and read correctly; the cmd/kosli golden assertions line up with the new output strings.

No blocking issues — nice cleanup.

Comment thread cmd/kosli/deleteApiKey.go Outdated
@mbevc1 mbevc1 added enhancement New feature or request and removed tech-debt labels Jun 10, 2026
@mbevc1 mbevc1 merged commit 6dcc303 into main Jun 11, 2026
20 checks passed
@mbevc1 mbevc1 deleted the 20260609_api-keys_formatting branch June 11, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants