Skip to content

Phase 15 - Refactoring: Actual final phase, closing all relevant gaps #191

Open
lorenzoberts wants to merge 18 commits into
lorenzo/actor-refactor-phase-14from
lorenzo/actor-refactor-phase-15-final
Open

Phase 15 - Refactoring: Actual final phase, closing all relevant gaps #191
lorenzoberts wants to merge 18 commits into
lorenzo/actor-refactor-phase-14from
lorenzo/actor-refactor-phase-15-final

Conversation

@lorenzoberts

@lorenzoberts lorenzoberts commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Goal

Close the remaining behavior and maintainability gaps after the actor migration — harden error handling, tighten startup and shutdown, extract patchset side effects from screen state, and add integration coverage so the hybrid architecture is production-ready, not just structurally complete.

What this PR does

Fixes silent failure modes: patchset-open errors surface as popups instead of being ignored, Lore bootstrap failures propagate at startup instead of defaulting to empty state, and external dependency checks run before terminal raw-mode init. InputActor gets explicit production shutdown wired into main's documented teardown order. Details preview scroll bounds use rendered text height instead of raw line counts.

Extracts patch apply and reviewed-by reply into app/actions/ behind PatchsetActionService, removing fs/shell/git execution from PatchsetDetailsState. Adds integration tests for navigation, patch-open errors, apply/reviewed-by consolidation, and actor lifecycle teardown. Includes formatting-only cleanup (imports, decorative comments). Runtime behavior is improved where previously failing silently; otherwise unchanged.

This commit makes InputActor shutdown part of the production lifecycle
instead of a test-only API. main retains a cloned input handle and shuts
the actor down explicitly after AppActor exits, so the documented teardown
order includes the input pump rather than relying on handle drops.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit handles patchset-open results explicitly in the latest and
bookmarked flows instead of ignoring unexpected errors. PatchNotFound keeps
its existing popup while other Lore, render, or parser failures surface as
a generic error popup, leaving the user on the originating list screen.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit stops defaulting Lore bootstrap to empty state when the actor
request fails. Bootstrap errors now propagate through startup with context,
so channel failures and unexpected bootstrap issues are visible instead of
appearing as an app with no mailing lists, bookmarks, or reviewed state.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit moves external dependency validation out of AppActor and into
startup before the terminal enters raw mode. Missing b4 remains fatal while
missing optional render tools still log warnings, preserving existing policy
while failing fast before terminal initialization.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit bases patchset preview scroll bounds on the same rendered text
projection used by the details view model instead of raw string line counts.
Scroll-down and go-to-last-line behavior now match what the UI actually
displays, without changing the short-preview saturating behavior.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit replaces fully qualified std, tokio, ratatui, and other common
paths with module-level imports across app, UI, terminal, render, config,
and infrastructure code. The change is formatting-only and does not alter
runtime behavior.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit removes artificial section divider comments from app and UI
modules. Normal blank-line spacing between types and functions is preserved
without changing code behavior.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit moves patch-apply side effects out of PatchsetDetailsState into
a focused application action service. App still builds the request and sets
the resulting popup, but git command execution and failure handling live
behind a named action boundary.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit moves reviewed-by reply preparation and interactive command
execution into a focused application action service. App retains reviewed-state
persistence and UI reset while the reply workflow lives behind a named
action boundary.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit clarifies App's patchset action orchestration by extracting
request builders and action-selection checks around the apply and
reviewed-by reply services. Remaining App-side mapping logic is kept
small and testable at the orchestration layer.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit introduces a PatchsetActionService facade over the apply and
reviewed-by reply action modules. App now depends on a single named action
boundary instead of calling loose execution functions directly.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit introduces a dedicated app integration test module for
behavior-oriented flow coverage. The module is wired into the app crate
without moving existing unit tests, establishing a compilable home for the
follow-up helper and flow tests.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit adds shared helpers for building minimal App state, sample
Lore and render data, dummy actor handles, and a fake loading indicator.
The helpers provide a reusable foundation for behavior-oriented app flow
tests without depending on terminal loading frames.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit covers latest and bookmarked patchset navigation through the
app flow handlers. The tests exercise opening patchset details from both
origins and returning with Back using helper-backed Lore and Render handles.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit covers app behavior when opening patchset details fails from
latest and bookmarked origins. The tests assert that render and Lore failures
surface as error popups, preserve the originating screen, and avoid leaving
stale details state behind.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit covers app-level apply patchset behavior through
consolidate_patchset_actions. The tests assert success and failure popups,
verify apply action reset after consolidation, and ensure failed git-am
runs abort before returning to the previous branch.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit covers app-level reviewed-by reply behavior through
consolidate_patchset_actions. The tests assert successful replies record
and persist reviewed indexes, failed interactive replies do not, and reply
selection state is reset after consolidation.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
@lorenzoberts lorenzoberts marked this pull request as ready for review July 9, 2026 19:30
This commit covers main-like actor lifecycle wiring with AppActor, InputActor,
UiActor, and TerminalActor. The test stops the app through a semantic quit
event and verifies input shutdown completes before terminal shutdown,
matching the documented teardown order.

This commit completes the architecture's refactoring phase 15.

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
@lorenzoberts lorenzoberts force-pushed the lorenzo/actor-refactor-phase-15-final branch from ef3ce2d to 73a9ff7 Compare July 9, 2026 19:33
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