Skip to content

feat: wait for Docker, clean up after Ctrl+C, and show access info on reinstall - #102

Merged
aarthy-dk merged 1 commit into
mainfrom
feat/installer-ux-fixes
Nov 19, 2026
Merged

aarthy-dk merged 1 commit into
mainfrom
feat/installer-ux-fixes

Conversation

@aarthy-dk

@aarthy-dk aarthy-dk commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #101: review and merge that first. This PR's diff is only the last commit.

Summary

  • Waiting for Docker. When Docker is installed but its engine isn't running, the installer asks the user to start Docker Desktop or the Docker service and press Enter.
    • Plain tg install (no --docker/--pip, and always from the .exe menu) offers Docker in this case too. Choosing it leads to the same prompt. Without a terminal, the picker falls back to offering pip only.
    • It waits up to 120 seconds, checking every few seconds with a 5-second timeout per check, then continues.
    • If the engine still isn't running, it stops with the same message as before.
    • With no terminal to answer, it doesn't ask.
    • Events record docker_engine_wait as started, timed_out, or interrupted (including Ctrl+C at the prompt).
  • install on an existing install prints the app's URLs and credentials, plus how to start, upgrade, or remove it, instead of only stopping. The password stays out of the session logs, here and in access-info.
  • Ctrl+C during a step runs the same cleanup as a failed step, so an interrupted install doesn't leave containers and volumes behind for the next install to trip over.
    • Docker installs remove their containers, volumes, and compose file. Pip installs uninstall the TestGen uv tool and remove the TestGen home directory, unless it existed before the install (for example, kept by tg delete --keep-data). Pip installs also clean up this way after a failed step.
    • The step shows INTERRUPTED. Installs print "Cleaning up..." and then "The partial installation was removed." When a cleanup hook fails, or for upgrades, which have nothing to undo, the existing "inconsistent state" warning prints instead.
    • Ctrl+C during demo data generation counts as that step failing: the install finishes and keeps the running app. Ctrl+C during any other step, including the image pull, cancels the action.
    • The Observability upgrade no longer claims Observability isn't running when the user pressed Ctrl+C.
  • An upgrade with nothing to update succeeds instead of aborting, and leaves the install marker untouched. Docker and pip upgrade events report version_updated when both the installed and latest versions are known.
  • The message for an unreachable TestGen image now mentions proxy settings, --image for a registry mirror, and installing with pip.

Test plan

  • ruff check / ruff format --check clean
  • pytest: 326 passed
  • New tests cover:
    • cleanup after Ctrl+C, and the cleanup messages for installs, failed cleanup, and upgrades
    • Ctrl+C in demo data letting the install finish, and Ctrl+C in other optional steps cancelling it
    • an action with nothing to do ending successfully without cleanup or a marker rewrite
    • the Docker wait: started, timed out, no terminal, Ctrl+C at the prompt and during the wait, the short per-check timeout, and no wait when docker -v fails
    • the mode picker offering Docker when only the engine is stopped
    • pip install cleanup, including keeping a TestGen home that predates the install
    • access info printed by tg install over an existing install, and the password staying out of the logs
    • version_updated for Docker and pip upgrades
    • the Observability "not running" message being suppressed after Ctrl+C
  • Ran tg install over an existing pip install: access info and hints printed, and the password is not in the session zip
  • Manual: with Docker Desktop quit, run tg install, start Docker Desktop at the prompt, and the install continues
  • Manual: Ctrl+C during a pip install cleans up
  • Manual: Ctrl+C during the image pull of a Docker install, then run tg install again and it doesn't report an existing install

🤖 Generated with Claude Code

@aarthy-dk
aarthy-dk requested a review from rboni-dk November 18, 2026 17:04

@rboni-dk rboni-dk 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.

Nice work. Routing Ctrl+C through on_action_fail is the right shape, and keeping the password out of the access-info logs fixes a real leak. A few things:

  1. The Docker wait doesn't reach plain tg install. With no --docker/--pip (and always from the .exe menu), _auto_select_mode probes the prereqs quietly. When Docker is installed but the engine is down, it only offers pip, so wait_for_docker_engine never runs. That's the case this feature is meant for. Could the picker offer "start Docker Desktop and press Enter" when Docker is installed but the engine isn't running?
  2. Ctrl+C during demo data now deletes a working Docker install. TestgenQuickStartStep is optional, but an interrupt in it fails the action, so ComposeStartStep.on_action_fail runs down --volumes and the compose file is removed. I'd treat an interrupt in a non-required step like a failure of that step and carry on, or at least skip the teardown once the app is up.
  3. Suggestion: while Docker Desktop is starting, the CLI can hang rather than fail fast, so each poll may block for the full 30-second check timeout and the 60-second wait can stretch to about 90. WSL2 cold starts also often take more than 60 seconds. A shorter timeout per poll plus a longer overall wait (or a re-prompt on timeout) might make this more forgiving.
  4. Pip-mode interrupts still leave config.env and the uv tool behind, since the pip steps have no on_action_fail and the marker is only written on success. The PR description's cleanup claim is Docker-only.
  5. Smaller ones:
    • Ctrl+C at the "press Enter" prompt doesn't set docker_engine_wait=interrupted.
    • After a successful cleanup we still print "may result in an inconsistent application state". For pip and upgrade runs, "Cleaning up..." prints with nothing to clean.
    • NothingToDo still rewrites the install marker's last_updated_on.
  6. Missing tests:
    • Ctrl+C at the prompt and during the wait
    • skipping the wait when docker -v fails
    • the access info printed by tg install over an existing install
    • version_updated
    • the ObsFetchCurrentVersionStep message suppression

… reinstall

- When Docker is installed but its engine is not running, ask the user to
  start it and wait up to 60 seconds instead of stopping.
- Running install over an existing install prints its URLs and
  credentials and how to start it, keeping the password out of the logs
  (access-info too).
- Ctrl+C during a step runs the same cleanup as a failed step, so an
  interrupted install no longer leaves containers and volumes behind.
- An upgrade with nothing to update succeeds instead of aborting, and
  upgrade events report version_updated.
- The message for an unreachable TestGen image mentions proxies, --image,
  and installing with pip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aarthy-dk
aarthy-dk force-pushed the feat/analytics-outcome-fields branch from ad7e3ea to fd47c2c Compare November 19, 2026 05:11
@aarthy-dk
aarthy-dk force-pushed the feat/installer-ux-fixes branch from a3c7172 to b365f41 Compare November 19, 2026 05:11
@aarthy-dk

Copy link
Copy Markdown
Contributor Author

Thanks, all addressed in b365f41 (rebased onto the updated #101):

  1. Docker wait from plain tg install. When Docker and Compose are installed but the engine is stopped, the picker offers Docker again (default d) and says the user will be asked to start it. Choosing it leads to the same start-and-press-Enter wait. Without a terminal, the picker still offers pip only.
  2. Ctrl+C during demo data. Steps can opt into continue_on_interrupt. Only TestgenQuickStartStep and ObsGenerateDemoConfigStep opt in, so an interrupt there counts as that step failing and the install keeps the running app. The image pull is also optional but doesn't opt in, so Ctrl+C there still cancels.
  3. Wait timing. Each check now times out after 5 seconds (a new timeout on Requirement.check_availability), and the overall wait is 120 seconds.
  4. Pip cleanup. UvToolInstallStep uninstalls the uv tool on failure or interrupt and checks that it's gone. TestgenStandaloneSetupStep removes the TestGen home, but only if it didn't exist before the install, so data kept by tg delete --keep-data survives. Both skip when their step never started.
  5. Smaller ones.
    • Ctrl+C or EOF at the prompt records docker_engine_wait=interrupted.
    • "Cleaning up..." prints only for installs, via a MultiStepAction.undoes_on_fail flag. When every cleanup hook succeeds, the final line is "The partial installation was removed." instead of the "inconsistent state" warning. The compose cleanup hooks skip when there's no compose file yet, so an early Ctrl+C doesn't count as a failed cleanup.
    • NothingToDo no longer rewrites the install marker.
  6. Tests. Added all of these, plus tests for the picker, pip cleanup, the cleanup messages, and Ctrl+C in an optional step without the opt-in.

I updated the PR description to match.

Base automatically changed from feat/analytics-outcome-fields to main November 19, 2026 17:22
@aarthy-dk
aarthy-dk merged commit 3f20613 into main Nov 19, 2026
@aarthy-dk
aarthy-dk deleted the feat/installer-ux-fixes branch November 19, 2026 17:23
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.

2 participants