refactor(BA-6524): clean up the TUI installer internals#12242
Open
devyubin wants to merge 10 commits into
Open
refactor(BA-6524): clean up the TUI installer internals#12242devyubin wants to merge 10 commits into
devyubin wants to merge 10 commits into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves #12243 (BA-6524)
Clean up the single-host TUI installer internals: merge the duplicated
DevContext/PackageContextinstall-info builders into a single shared helper, remove the deadpython.py/pkg.pymodules, and drop 59 of 60# type: ignorecomments incontext.pyby typing the loaded TOML documents. Along the way, fix--non-interactive --mode PACKAGEnever starting the install andrun_execswallowingCancelledError(an aborted install no longer continues silently).Checklist: (if applicable)
ai.backend.testdocsdirectory