Skip to content

Phase 12 - Refactoring: App promotion to Actor#188

Open
lorenzoberts wants to merge 6 commits into
lorenzo/actor-refactor-phase-11from
lorenzo/actor-refactor-phase-12
Open

Phase 12 - Refactoring: App promotion to Actor#188
lorenzoberts wants to merge 6 commits into
lorenzo/actor-refactor-phase-11from
lorenzo/actor-refactor-phase-12

Conversation

@lorenzoberts

@lorenzoberts lorenzoberts commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Goal

With all other actors in place, formally convert App into the central orchestration actor. Application logic should live behind a typed message protocol instead of a free-standing handler loop in main.

What this PR does

Introduces AppMessage, AppTransition, AppError, AppHandle, and AppActor. The former run_app loop in handler/mod.rs moves into AppActor; per-screen flows relocate to app/flows/ and the handler module is deleted. AppHandle exposes shutdown, get_view_model, and get_input_context over an mpsc control channel, separate from the hot input subscriber path.

main.rs spawns AppActor and awaits run_until_done instead of calling run_app directly. Startup dependency checks move into the actor loop and surface as AppError. Structured tracing is added across actor lifecycle, message handling, and per-screen dispatch. Runtime behavior is unchanged.

This commit introduces the application actor protocol without changing
runtime behavior. AppMessage defines the control and query messages for the
upcoming AppActor, AppTransition models frame-cycle outcomes, and AppError
gains variants for UI, input, and dependency failures at the actor boundary.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit wraps the existing event loop in an AppActor and AppHandle without
changing application behavior. main now spawns the actor and awaits
run_until_done, establishing the actor lifecycle entry point while run logic
still flows through the transitional handler path.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit relocates screen-handling and loading logic under the app
boundary and inlines the former run_app loop inside AppActor. The handler
module is removed so application orchestration lives entirely within the app
crate, with per-screen flows dispatched from the actor's input path.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit adds the mpsc control path between AppHandle and AppActor. The
handle exposes shutdown, get_view_model, and get_input_context over the
message protocol while input events continue through the existing subscriber
channel, separating control queries from the hot input loop.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit makes startup validation an AppActor concern. External dependency
checks run at the beginning of the actor loop and surface failures as AppError
through run_until_done, removing the ad hoc validation path from main.
AppHandle::initialize remains available over the message protocol for explicit
queries.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit adds structured tracing across AppActor lifecycle, message
handling, and I/O-heavy flow branches without changing behavior. Actor start,
stop, initialization failures, and per-screen dispatch are observable through
the tracing subscriber.

This commit completes the architecture's refactoring phase 12.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
@lorenzoberts lorenzoberts marked this pull request as ready for review July 9, 2026 13:53
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