Skip to content

Phase 6 - Refactoring: Lore promotion to an Actor#182

Open
lorenzoberts wants to merge 8 commits into
lorenzo/actor-refactor-phase-5from
lorenzo/actor-refactor-phase-6
Open

Phase 6 - Refactoring: Lore promotion to an Actor#182
lorenzoberts wants to merge 8 commits into
lorenzo/actor-refactor-phase-5from
lorenzo/actor-refactor-phase-6

Conversation

@lorenzoberts

@lorenzoberts lorenzoberts commented May 31, 2026

Copy link
Copy Markdown
Collaborator

Goal

Promote LoreService to a proper actor with an async message-based interface. Lore owns all remote data access, caching, and user-local persistence — App should request Lore operations through a typed handle instead of calling the synchronous service directly.

What this PR does

Adds Tokio as the async runtime and introduces LoreApiMessage, LoreApiActor, and LoreApiHandle. The actor wraps LoreService, receives requests over mpsc, replies over oneshot, and runs blocking work via spawn_blocking. App bootstrap, mailing-list refresh, feed pagination, patchset details, bookmark/reviewed persistence, and reply command preparation all migrate to LoreApiHandle; affected App and handler paths become async.

Removes LoreServiceApi from the public boundary — LoreService becomes the internal core behind LoreApiActor. Adds structured tracing around actor lifecycle and message handling. Runtime behavior is unchanged.

This commit adds Tokio as the async runtime dependency and introduces
LoreApiMessage as the message protocol for the upcoming LoreAPI actor.
The protocol mirrors the current LoreServiceApi surface without wiring
App or main to the actor yet.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit introduces LoreApiHandle and LoreApiActor around the existing
LoreService core. The actor owns LoreService state, receives LoreApiMessage
requests over mpsc, replies over oneshot, and runs service operations through
spawn_blocking so blocking Lore work stays behind the actor boundary.
It also adds actor-level tests for bootstrap data loading and preserving
Lore cache state across sequential requests.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit starts the LoreAPI actor during application startup and loads
BootstrapLoreData through LoreApiHandle before constructing App. App::new now
receives the already-resolved Lore bootstrap data instead of warming Lore cache
itself.

The remaining App Lore flows still use the existing LoreServiceApi path and
will be migrated in follow-up commits.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit wires App with LoreApiHandle for mailing-list refresh and latest
feed pagination. The affected App methods and handler paths become async so
these flows request Lore data through the LoreAPI actor instead of calling the
synchronous LoreServiceApi path.
The legacy LoreServiceApi service remains temporarily for patchset details and
review actions, which will be migrated in follow-up commits.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit migrates patchset detail retrieval from the synchronous
LoreServiceApi path to LoreApiHandle. App::open_patchset_details is now async,
and the latest/bookmarked handlers await it while preserving the existing
preview rendering flow.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit migrates bookmark persistence, reviewed-state persistence,
git signature lookup, and reply command preparation to LoreApiHandle.
Patchset action consolidation and the details handler are now async so
Lore-owned review data flows through the LoreAPI actor.

It also removes the remaining production AppServices.lore injection because
App no longer needs to call LoreServiceApi directly.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit removes the old LoreServiceApi trait and MockLoreServiceApi export
now that App no longer calls LoreService directly. LoreService becomes the
internal stateful core used by LoreApiActor, with the application-facing Lore
boundary provided by LoreApiHandle.

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

Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit adds structured tracing around the LoreAPI actor lifecycle and
message handling. Each LoreApiMessage now has a stable request name used in
logs, and actor replies log Lore failures or dropped response receivers.

This commit is the last one of the architecture's refactoring phase 6.

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