Skip to content

refactor(BA-6524): clean up the TUI installer internals#12242

Open
devyubin wants to merge 10 commits into
mainfrom
refactor/installer-cleanup
Open

refactor(BA-6524): clean up the TUI installer internals#12242
devyubin wants to merge 10 commits into
mainfrom
refactor/installer-cleanup

Conversation

@devyubin

@devyubin devyubin commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

resolves #12243 (BA-6524)

Clean up the single-host TUI installer internals: merge the duplicated DevContext/PackageContext install-info builders into a single shared helper, remove the dead python.py/pkg.py modules, and drop 59 of 60 # type: ignore comments in context.py by typing the loaded TOML documents. Along the way, fix --non-interactive --mode PACKAGE never starting the install and run_exec swallowing CancelledError (an aborted install no longer continues silently).

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Mention to the original issue
  • Installer updates including:
    • Fixtures for db schema changes
    • New mandatory config options
  • Update of end-to-end CLI integration tests in ai.backend.test
  • API server-client counterparts (e.g., manager API -> client SDK)
  • Test case(s) to:
    • Demonstrate the difference of before/after
    • Demonstrate the flow of abstract/conceptual models with a concrete implementation
  • Documentation
    • Contents in the docs directory
    • docstrings in public interfaces and type annotations

devyubin added 7 commits June 16, 2026 19:16
…ntext

DevContext and PackageContext defined byte-identical copies of
_configure_mock_accelerator. Move the single implementation onto the base
Context (replacing the abstract stub) and drop both overrides.
python.py's check_python / install_pyenv / install_python were all empty `pass`
stubs; check_python was even called from DevContext.check_prerequisites yet did
nothing. pkg.py's fetch_binaries had no callers. Remove both modules and the
dead call and import.
DevContext and PackageContext hydrate_install_info were ~95% identical and had
drifted (the source of the app-proxy-secrets gap fixed earlier). Move the shared
construction into Context._build_install_info; each context passes only its real
differences: install type, base path, local-proxy port, loopback aliases, and
the optional harbor/sftp agent fields. Also unify the storage secret generation
to token_hex (PACKAGE used token_urlsafe; functionally identical).
start_package_mode switched to the package-type submenu but never advanced it,
so `--non-interactive --mode PACKAGE` stalled with the install task never
started (unlike DEVELOP, which begins immediately). Auto-select the sole
RELEASE PACKAGE option when running non-interactively.
The tomlkit nested-write blocks carried ~60 `# type: ignore` comments (which
CLAUDE.md bans). Annotate each loaded document as `data: Any` -- the right type
for dynamic toml editing -- so mypy accepts the index/membership writes without
suppression. This loses no real checking: the ignores never type-checked those
writes anyway. One unrelated ignore remains (a rich RichCast in check_prerequisites).
A4 moved the optional harbor/sftp fields into `extra_service_kwargs: dict[str, Any]`,
which silenced mypy on both the field names AND the value types -- and the
ServiceConfig dataclass only rejects unknown keys at runtime, never wrong types.
Replace the dict with a `total=False` TypedDict so the DEVELOP dict literal and the
`**`-unpack into ServiceConfig are statically checked again (PACKAGE's `{}` stays
valid). Unlike the C2 tomlkit `Any` (a real library limitation), this Any was
self-inflicted and cheap to undo.
run_exec caught CancelledError, terminated/killed the child, then fell through to
`return exit_code` -- swallowing the cancellation, so an aborted install silently
continued to the next step. Cancellation here is always a global abort (no caller
wraps run_exec in a per-call timeout, it has no internal timeout, and reader-task
failures surface as an ExceptionGroup, not CancelledError). Reap the child for
clean shutdown, then re-raise.
@github-actions github-actions Bot added the size:L 100~500 LoC label Jun 17, 2026
@devyubin devyubin changed the title Refactor/installer cleanup refactor: clean up the TUI installer internals Jun 17, 2026
@devyubin devyubin marked this pull request as ready for review June 17, 2026 00:53
@devyubin devyubin requested a review from a team as a code owner June 17, 2026 00:53
@devyubin devyubin changed the title refactor: clean up the TUI installer internals refactor(BA-6524): clean up the TUI installer internals Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean up duplicated TUI installer context code and fix the non-interactive PACKAGE path

1 participant