refactor(tui): centralize terminal session lifecycle - #12
Conversation
- register TerminalLifecycle and UpdateCheckSessionHook - remove update orchestration from TerminalSession - redraw the main menu through RenderRequested
Move repository initialization into the Application layer and keep the TUI startup hook as an adapter. Remove the obsolete TUI Modules path and Navigator startup orchestration.
Expose a neutral content host through the terminal lifecycle context so the repository initialization hook owns recovery, retry, and unsupported format handling while the navigator remains focused on normal navigation.
Require the fully configured navigator and remove the unused fallback navigation path, lifecycle compatibility constructor, and empty page code.
Remove the unused synchronous TryRun overload and IsRunning state, and clean obsolete repository initialization test code from Navigator tests.
Move application metadata, paths, and runtime logging settings into Application. Update application consumers and remove obsolete TUI configuration types.
Keep repository startup pending through interactive recovery and defer MainMenu and session hooks until startup prerequisites complete.
Remove the unused session hook infrastructure and obsolete TUI update tests.
Replace startup hooks with an explicit repository initialization flow. Move lifecycle task and cancellation ownership to the terminal session. BREAKING CHANGE: ITerminalStartupHook and RepositoryInitializationStartupHook have been removed.
Move repository startup and main-menu activation into TerminalSession. Remove the standalone TerminalLifecycle service. BREAKING CHANGE: TerminalLifecycle has been removed.
Start initialization after the shell is running and track all TUI background work through TerminalTaskRunner. Propagate shutdown cancellation, drain tasks before disposal, and dispose views removed during page transitions. BREAKING CHANGE: remove the public TerminalLifecycleContext API.
Remove the shared task runner and obsolete UI dispatch bridge. Use direct async/await handlers with local blocking work offloaded. Own startup cancellation in TerminalSession to avoid shutdown hangs.
Remove redundant Task.Run wrappers around DispatchAsync calls while keeping synchronous repository initialization offloaded.
Review notes — ChatGPTI reviewed the current PR, including the TUI lifecycle refactor and the latest follow-up commit. CI is green, including the NativeAOT publish check, and the overall direction of moving startup/recovery concerns out of There is one behavior regression I would fix before merging: Blocking application work now runs on the TUI threadRemoving That is safe only when the request handler yields quickly. Some handlers do not. For example, The same pattern exists in other synchronous request handlers such as repository recovery/management and listing installed mods, so I would keep the new async flow structure but introduce a thin offload boundary for application operations whose handlers can do synchronous I/O/CPU work (for example, starting the dispatch from Update-check lifecycleThe current Other than that, I did not find another issue I am confident enough to call a merge blocker in the new |
Document the TUI View and Logic separation, UI-thread marshaling, background operation ownership, and the Flows project structure.
Summary
Testing