Skip to content

Phase 9 - Refactoring: Terminal actor creation#185

Draft
lorenzoberts wants to merge 13 commits into
lorenzo/actor-refactor-phase-8from
lorenzo/actor-refactor-phase-9
Draft

Phase 9 - Refactoring: Terminal actor creation#185
lorenzoberts wants to merge 13 commits into
lorenzo/actor-refactor-phase-8from
lorenzo/actor-refactor-phase-9

Conversation

@lorenzoberts

Copy link
Copy Markdown
Collaborator

No description provided.

This commit introduces the Terminal actor boundary with a typed message
protocol, cloneable handle, terminal session trait, actor error type, and
focused actor tests. The new module follows the existing actor request/reply
pattern while keeping runtime wiring unchanged.

This commit is part of the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit adds the Ratatui/Crossterm-backed terminal session behind the
TerminalSessionApi boundary. Raw event reading, polling, resize/key conversion,
user-IO mode transitions, size lookup, and shutdown restoration are now modeled
as terminal session operations.

It also makes TerminalFrame an explicit owned draw payload so later Phase 9
commits can wire drawing through the terminal actor protocol.

This commit is part of the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit moves early CLI handling ahead of terminal initialization so
--show-configs can print configuration without entering the alternate screen or
requiring an explicit terminal restore. Normal TUI startup still initializes the
terminal only after configuration and CLI resolution have completed.

It also adds focused coverage for the pre-terminal CLI resolution behavior.

This commit is part of the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit updates the main app loop to receive raw TerminalEvent values
through TerminalHandle instead of constructing the Crossterm event source
directly. The runtime now spawns a terminal actor for event reads while leaving
the existing concrete terminal draw path in place for the follow-up handler and
loading-screen migration.

It also adds a transitional Crossterm event session so this step can move event
capture behind the actor protocol without changing application input semantics.

This commit is part of the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit removes concrete Terminal ownership from the mailing list, latest
patchsets, bookmarked patchsets, and system-update handlers. Loading screen
rendering now flows through a LoadingIndicator boundary owned by the main
handler loop, preserving spinner behavior without passing Terminal through
normal screen handlers.

The remaining direct terminal access is isolated to the app loop boundary and
the patchset details interactive user-IO path, which is handled separately.

This commit is part of the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit removes direct terminal access from the patchset details handler.
Preview sizing and user-IO mode transitions now go through a terminal control
boundary owned by the main handler loop, while the post-interactive Enter wait
uses TerminalHandle instead of constructing a crossterm event source directly.

This keeps the details input flow on the Phase 9 terminal protocol path without
changing the existing patchset action behavior.

This commit is part of the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit removes the old input terminal source now that raw terminal event
conversion and reads live behind the terminal actor session boundary. The input
module documentation now describes TerminalEvent production as coming from the
terminal actor, leaving InputMapper as the semantic translation layer for the
current app loop.

It also applies the remaining cleanup needed for the Phase 9 changes to pass
the repository formatting, test, and clippy checks.

This commit completes the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit introduces an owned AppRenderSnapshot so terminal draw requests can
cross the actor channel without borrowing AppState. TerminalFrame now models
main UI and loading-frame draws, and CrosstermTerminalSession can render both
through the existing UI drawing helpers.

It also makes render state and popup values cloneable so the current UI layer
can keep using AppViewModel while the terminal actor receives owned frame
payloads.

This commit is part of the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit makes TerminalActor own the concrete Tui at startup and routes the
main app loop draw and read path through TerminalHandle instead of the split
init plus CrosstermEventSession model. run_app now takes only App and
TerminalHandle, and frame rendering uses TerminalFrame::Main with
App::render_snapshot.

It also rewrites the handler-side loading indicator to hold a TerminalHandle
instead of Terminal<B>, bridging preview sizing and user-IO transitions through
the terminal actor while leaving handle-backed loading frames for the follow-up
commit.

This commit is part of the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit moves loading screen rendering behind TerminalHandle instead of
passing a concrete Terminal through handler code. TerminalLoadingIndicator now
spawns a background task that periodically sends TerminalFrame::Loading draws
while long-running work is in progress, and stop cleanly shuts the spinner task
down before normal UI frames resume.

It also removes the legacy loading_screen render helper and loading_screen!
macro now that loading layout is drawn through CrosstermTerminalSession and the
terminal actor protocol.

This commit is part of the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit removes the handler-side TerminalController boundary and routes
patchset details preview sizing and interactive user-IO transitions through
TerminalHandle instead. Preview scroll amounts now query terminal size
asynchronously, and consolidate actions use setup_user_io, teardown_user_io,
and the existing wait_for_key_press path on the terminal actor protocol.

It also adds actor tests covering setup_user_io and teardown_user_io delegation
through the mock terminal session.

This commit is part of the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit restores the terminal through TerminalHandle::shutdown after
run_app returns instead of calling infrastructure restore directly from
main. The terminal actor session remains the single owner of normal
terminal lifecycle teardown in the runtime path.

It also documents that panic and error hooks keep the direct restore
fallback for fatal failures, and adds an actor test covering repeated
shutdown requests through the mock terminal session.

This commit is part of the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit removes the transitional CrosstermEventSession and finishes
Phase 9 terminal ownership cleanup. Raw Crossterm event reads now live only
in CrosstermTerminalSession, infrastructure terminal helpers are narrowed to
session and emergency restore use, and the terminal and input module docs
describe the current pull loop through TerminalHandle.

It also removes stale Phase 9 dead-code allowances and the unused
App::to_view_model helper now that runtime drawing uses AppRenderSnapshot.

This commit completes the architecture's refactoring phase 9.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
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.

1 participant