Skip to content

Phase 4 - Refactoring: Simplifying App#180

Open
lorenzoberts wants to merge 7 commits into
lorenzo/actor-refactor-phase-3from
lorenzo/actor-refactor-phase-4
Open

Phase 4 - Refactoring: Simplifying App#180
lorenzoberts wants to merge 7 commits into
lorenzo/actor-refactor-phase-3from
lorenzo/actor-refactor-phase-4

Conversation

@lorenzoberts

@lorenzoberts lorenzoberts commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Goal

Decompose the monolithic App struct into explicit state containers and remove infrastructure coupling, so the app layer is ready to become an actor. Screens should hold UI state, services should hold dependencies, and the UI layer should not need to import the orchestrator directly.

What this PR does

Renames screen structs to *State suffix (MailingListSelectionState, LatestPatchsetsState, etc.) and splits App into AppState (navigation, lore UI, user lore, config UI, popup) and AppServices (lore, shell, fs, env, render). check_external_deps moves to main.rs startup.

Introduces RenderServiceApi with ShellRenderService for patchset preview, ConfigUpdateDraft/apply_update for the edit-config flow, and PatchsetCommand/AppCommand enums as scaffolding for a future App actor protocol. consolidate_patchset_actions splits into sync_patchset_bookmark, execute_reviewed_reply, and execute_apply_patchset.

Adds AppViewModel as a read-only view of AppState — draw_ui and all screen render helpers take AppViewModel instead of App, breaking the app ↔ ui import cycle. Runtime behavior is unchanged.

This commit renames MailingListSelection, LatestPatchsets,
DetailsActions, EditConfig, and BookmarkedPatchsets to *State
types to clarify they hold UI screen state.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit introduces AppState (navigation, lore UI,
user lore, config UI, config, popup) and AppServices
(lore, shell, fs, env). It also moves check_external_deps
to main.rs.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit introduces render/trait.rs with RenderError and a
mockable RenderServiceApi. ShellRenderService wraps Arc<dyn ShellTrait>
and reuses app cover/patch renderer helpers plus split_cover
for parity with the details screen.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit adds render to AppServices and pass ShellRenderService
from main (sharing shell Arc with LoreService). Besides that,
init_details_actions delegates preview strings to
render_patchset_preview;
It also emoves direct cover/patch render calls from App.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
…fig flow

This commit replaces per-field Ok chains with a single
draft + apply path. Also avoids mutating the buffer during consolidation.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commmit splits consolidate_patchset_actions into sync_patchset_bookmark,
execute_reviewed_reply, and execute_apply_patchset so bookmark sync,
reviewed reply, and apply are separate steps.
It also adds commands with PatchsetCommand and placeholder AppCommand
for a future App actor protocol.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
Thi commit introduces AppViewModel as a read-only view
of AppState, App::to_view_model, and switch draw_ui and
screen render helpers to take &AppViewModel so the UI
layer does not depend on the orchestrator struct.
It tighten lifetimes on footer Span return types where they borrow state.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
@lorenzoberts
lorenzoberts marked this pull request as ready for review May 2, 2026 18:02
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