Skip to content

Conversation

@oddessentials
Copy link
Owner

@oddessentials oddessentials commented Dec 27, 2025

🛑 Add Cluster Shutdown Feature (Ctrl+Q)

Summary
Adds a safe, one-keystroke shutdown feature to the TUI dashboard. Press Ctrl+Q to stop app-started port-forwards, delete the Kind cluster, and exit. Plain Q remains non-destructive.

Features

  • Q: Quit only (no cleanup)
  • Ctrl+Q: Shutdown cluster + exit
  • Shutdown progress modal with live status
  • PID-scoped cleanup (only kills port-forwards started by this TUI)
  • Web mirror auto-retry after disconnect (20s)

Safety Improvements

  • Single source of truth via CLUSTER_NAME and KUBECTL_CONTEXT
  • No broad pkill / kubectl collateral damage
  • Graceful web disconnect with retry + test hooks

Changes

  • types.rs: constants, ShutdownProgress, PortForwardRegistry
  • cluster.rs: stop_port_forwards, delete_cluster, run_shutdown
  • main.rs: Ctrl+Q handler, shutdown UI
  • terminal.js: auto-retry + test hooks
  • retry-on-disconnect.spec.ts: Playwright test
  • README.md: updated cleanup docs

Testing

  • 167 unit tests pass (15 new)
  • Contract validation: 11/11 passed

Demo
Shutdown modal shows cluster deletion progress and exits cleanly.

- Add CLUSTER_NAME and KUBECTL_CONTEXT constants as single source of truth
- Add ShutdownProgress struct for tracking shutdown state
- Add PortForwardRegistry for PID-scoped port-forward cleanup
- Add AppMode::ShutdownProgress variant for shutdown UI
- Add stop_port_forwards(), delete_cluster(), run_shutdown() functions
- Add Ctrl+Q key handler in Dashboard mode (plain Q unchanged)
- Add shutdown progress modal with spinner and status display
- Update help bar to show '^Q Shutdown'
- Replace all hardcoded 'kind-task-observatory' with KUBECTL_CONTEXT
- Add 20s auto-retry interval to web terminal for disconnect recovery
- Add __odtoTestHooks for Playwright testing of reconnect behavior
- Add retry-on-disconnect.spec.ts visual test
- Update README cleanup section with TUI shutdown option
- Add comprehensive unit tests for new shutdown functionality

Addresses critical concerns:
- PID-scoped cleanup avoids killing unrelated kubectl processes
- Cluster name from constant prevents drift between create/delete
- Web retry test ensures graceful disconnect handling
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@oddessentials oddessentials merged commit d6b44db into main Dec 27, 2025
14 checks passed
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.

3 participants