Skip to content

Installer: clean setup output + fix name-prompt escape garble - #362

Merged
LukasWodka merged 5 commits into
developfrom
fix/installer-copy-and-name-garble
Jul 21, 2026
Merged

Installer: clean setup output + fix name-prompt escape garble#362
LukasWodka merged 5 commits into
developfrom
fix/installer-copy-and-name-garble

Conversation

@LukasWodka

@LukasWodkaLukasWodka commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Two installer-polish items on the macOS/Linux install path (scripts/install-k8s.sh + libs), plus Windows parity (install-k8s.ps1).

1. Setup output copy — matches the agreed spec

Before, the setup step printed off-guideline noise (a stray Homebrew, System tools ready (k3d, helm, kubectl), tool-version dumps, and a verified on your PATH claim). Collapsed to exactly:

tracebloc needs your password once to set up Docker and a few tools.
Password:
✔ Docker ready
✔ System tools ready
✔ tracebloc CLI updated (v0.9.2 → v0.9.3) — run `tb` to use it
  • common.sh — password hint installset up.
  • setup-macos.sh — Homebrew lines → log() (hidden); drop the (k3d, helm, kubectl) parenthetical.
  • install-cli.sh — collapse the already-present / re-running / installing / ready pileup into one line: updated (vX → vY) when the CLI was upgraded (prior version captured before the installer runs), else up to date / ready. Edge-case lines (installed-but-not-yet-on-PATH) keep their actionable, shell-correct PATH-fix hints.
  • install-k8s.ps1 — Windows parity for the same three.

2. Name-prompt escape garble (customer-reported 2026-07-20)

Arrow keys at the "Name this client" prompt injected raw ESC[D/ESC[A bytes that slug-ified into a garbage name (d-d-d-a-a-a) when passed to client create. The credential prompt already stripped these; the name prompt did not.

  • provision.shread -e (readline line-editing: arrows move the cursor instead of emitting escapes) + strip anything that still slips through, using the same helper the credential path uses.
  • Reword the prompt to "Name your secure environment" (terminology SoT).
  • Move _strip_paste_garbage from install-client-helm.shcommon.sh so the credential path and the name prompt share one sanitizer (removes a fragile cross-file dependency; fixes bats isolation).

Test plan

  • bats scripts/tests/*.bats — green except two failures that pre-date this change and reproduce on clean develop (validate_config: valid config passes, _extract_yaml_value: single-quoted with '' escape — local bash/locale artifacts, unrelated to this diff).
  • install-cli.bats assertions updated for the new copy; Pester assertions in install-k8s.Tests.ps1 likewise (pwsh not runnable locally — Windows verified in CI).
  • bash -n + shellcheck clean on all changed libs.

Notes

  • read -e is belt-and-suspenders with the strip, not instead of it — a non-readline paste can still deliver escapes.
  • CLI-side hardening (tracebloc client create --name rejecting/stripping control chars as defense-in-depth) is a separate follow-up in the cli repo.

🤖 Generated with Claude Code


Note

Low Risk
Changes are installer messaging, input sanitization, and non-fatal CLI install UX; no auth, data-plane, or cluster logic changes.

Overview
Installer output is aligned to a shorter spec: the sudo hint says “set up” instead of “install”; macOS Homebrew status moves to log() instead of green checks; system-tools success drops the tool list parenthetical; CLI install drops redundant “already present / re-running” chatter and ends with one ✔ (ready, up to date, or updated (vX → vY)), preferring tb when that alias exists. CLI install on bash uses spin instead of spin_cmd so recoverable failures stay soft. Windows (install-k8s.ps1) mirrors the CLI success wording.

Name prompt fix: provisioning rewords the prompt to “Name your secure environment”, uses plain read (avoids garbled echo under tee), and runs input through _strip_paste_garbage moved from install-client-helm.sh into common.sh so credentials and the name prompt share one sanitizer.

Tests:install-cli.bats and install-k8s.Tests.ps1 expectations updated; manifest.sha256 hashes refreshed.

Reviewed by Cursor Bugbot for commit 274b9b4. Bugbot is set up for automated code reviews on this repo. Configure here.

Two related installer polish items on the macOS/Linux install path.
1. Setup output copy (matches the agreed spec)
The password/Docker/tools/CLI lines were noisy and off-guideline
(stray "Homebrew", "(k3d, helm, kubectl)", tool-version dumps, and a
"verified on your PATH" claim). Collapse to the intended sequence:
tracebloc needs your password once to set up Docker and a few tools.
Password:
✔ Docker ready
✔ System tools ready
✔ tracebloc CLI updated (v0.9.2 → v0.9.3) — run `tb` to use it
- common.sh: password hint "install" → "set up".
- setup-macos.sh: Homebrew lines → log() (hidden); drop the
"(k3d, helm, kubectl)" parenthetical from "System tools ready".
- install-cli.sh: collapse the already-present / re-running / installing /
ready pileup into ONE ✔ line with an old→new version delta when the
CLI was upgraded ("updated (vX → vY)"), else "up to date" / "ready";
capture the prior version before the installer runs. Edge-case lines
(installed-but-not-yet-on-PATH) keep the actionable PATH-fix hints.
- install-k8s.ps1: Windows parity for the same three changes.
2. Name-prompt escape garble (customer-reported 2026-07-20)
Typing arrow keys at the "Name this client" prompt injected raw
ESC[D/ESC[A bytes that slug-ified into a garbage name ("d-d-d-a-a-a")
when passed to `client create`. The credential prompt already stripped
these; the name prompt did not.
- provision.sh: `read -e` (readline line-editing so arrows move the
cursor instead of emitting escapes) + strip any sequence that still
slips through, using the same helper the credential path uses.
- Reword the prompt to "Name your secure environment" (terminology SoT).
- Move _strip_paste_garbage from install-client-helm.sh to common.sh so
both the credential path and the name prompt share one sanitizer
(removes a fragile cross-file dependency; fixes bats isolation).
Tests: install-cli.bats assertions updated for the new ✔ copy; ps1 Pester
assertions likewise. Full bats suite green except two failures that
pre-date this change and reproduce on clean develop (validate_config /
_extract_yaml_value — local bash/locale artifacts, unrelated).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

@BugBot run

Comment threadscripts/lib/provision.sh Outdated
Comment threadscripts/lib/install-cli.sh Outdated
…pdated"
Two Bugbot findings on #362.
1. provision.sh (Medium) — "Readline echo breaks under tee".
setup_log_file redirects this process's stdout+stderr through
`exec > >(tee …) 2>&1`. `read -e` (readline) echoes typed characters to
stderr, so under the tee pipe the live echo is delayed/garbled on exactly
the interactive name-prompt path this change targets. Revert to plain
`read -r` — kernel-tty echo is immune to the redirection — and keep relying
on _strip_paste_garbage (the actual escape-garble fix) for the captured
value. No behavioural loss: the strip already neutralizes arrow-key bytes.
2. install-cli.sh (Low) — "False CLI updated verdict".
The upgrade branch fired on any non-empty TB_CLI_OLD_VER != "$ver",
including when $ver was empty after a failed post-install version probe —
printing "tracebloc CLI updated" with no version to back it up. Gate the
branch on `-n "$ver"` too, so an unconfirmed version falls through to the
neutral "up to date".
Tests: install-cli.bats + provision.bats green; the two pre-existing failures
(validate_config / _extract_yaml_value) are unchanged and unrelated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment threadscripts/lib/install-cli.sh Outdated
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

@BugBot run

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0f8df2e. Configure here.

…copy
Bugbot "wrong CLI command in success copy" (Medium) on #362.
The new ✔ verdict lines hardcoded "run `tb`", but the CLI installer only
symlinks `tb` when that name is free — when it's already taken it skips the
alias, leaving only `tracebloc`. In that case the copy pointed the user at a
command that doesn't exist (command-not-found right after a clean install).
Detect the usable command once (`tb` when it resolves, else `tracebloc`) and
use it in all four verdict lines. The short alias is still preferred — and
still what the copy shows in the common case — so the agreed
"… — run `tb` to use it" output is unchanged where `tb` exists.
- install-cli.sh: `local cli_cmd="tracebloc"; has tb && cli_cmd="tb"`, used in
the updated / up-to-date / ready / installed lines.
- install-k8s.ps1: same, `$cli = if (Has "tb") { "tb" } else { "tracebloc" }`.
- install-cli.bats: strengthen the verified-verdict test to assert the `tb`
preference, and add a test that the copy names `tracebloc` when `tb` is absent.
(The round-1 "false updated verdict" thread is already resolved by the earlier
`-n "$ver"` guard; Bugbot did not re-raise it on this HEAD.)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

@BugBot run

Comment threadscripts/lib/install-cli.sh
…in directly)
Bugbot "fatal-looking CLI install failure UX" (Medium) on #362.
Collapsing the CLI-install step onto spin_cmd (earlier in this PR) meant a
failed install now prints spin_cmd's hard red "✖ Installing the tracebloc CLI…"
+ a 10-line log dump BEFORE the soft "your client is set up fine" warn. This
step is non-fatal by design (the client is already connected), so that reads as
a hard failure and reintroduces exactly the noisy output this PR removes.
Drive `spin` directly instead — same transient spinner, but no hard-failure
banner — and let the existing soft warn + "install it later" hint own the
failure path.
Strengthened the non-fatal-failure bats test to assert the hard "✖ …" line and
"Last 10 lines" log dump are absent (they'd be present with spin_cmd).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

@BugBot run

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c68a1fd. Configure here.

scripts/gen-manifest.sh — updates the SHA256 entries for the six installer
files touched in this PR (common.sh, setup-macos.sh, install-client-helm.sh,
install-cli.sh, provision.sh, install-k8s.ps1). Fixes the 'Installer manifest
is current' static-analysis gate.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@aptraceblocaptracebloc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verified — approving.

  • Name-garble fix is correct: plain read -r + _strip_paste_garbage. The strip is the real fix (readline read -e was reverted because it echoes to stderr and garbles under the installer's tee redirect — Bugbot's resolved "readline echo breaks under tee").
  • The shared sanitizer mirrors the CLI side (#364) exactly — same CSI pattern ESC\[[0-9;]*[A-Za-z~], same order (CSI sequences iteratively → literal paste markers → C0/DEL last), UTF-8 preserved. Moving it into common.sh so the credential and name paths share one sanitizer is the right consolidation. #362 (strip at the installer source) + #364 (strip at the CLI --name boundary) are the two consistent halves of defense-in-depth for this customer bug.
  • Manifest integrity verified: I recomputed the sha256 of all three changed lib scripts on the branch and they match manifest.sha256 exactly (provision 725a85e4…, common 1e035f5d…, install-cli 50711ae0…), so the installer's self-verification stays valid. CI green, Bugbot clean.

One doc nit (please fix the description): the body says the fix uses read -e, but the code reverted to plain read -r (the Bugbot tee fix). Worth correcting so the description matches the shipped code.

LGTM.

— drafted with Claude (Opus 4.8), sent by @aptracebloc

@LukasWodka
LukasWodka merged commit b4db2f0 into developJul 21, 2026
31 checks passed
@LukasWodka
LukasWodka deleted the fix/installer-copy-and-name-garble branch August 14, 2026 13:53
Sign up for freeto 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.

3 participants

@LukasWodka@aptracebloc@saadqbal