feat: atomic social local writes, remote review enrichment

SocialCommand methods take events. Local follow ops = one FollowCommand::apply
tx (rows + events). k_ap path (remote, block/unblock): best-effort publish in
CompositeSocialAdapter after k_ap write; not atomic, k_ap owns tx.
save_remote_review takes events, enqueued in same tx via
sqlite::persistence::enqueue_events. Deps drop event_publisher: social
command, ReviewObjectHandler.

Remaining .publish( sites:
announce-only: users/delete_account UserDeleted, person/get + get_credits
PersonEnrichmentRequested, jobs/enrichment_staleness, http-axum search,
ImageStored (sync_poster, poster_sync_handler, image-converter backfill,
update_profile; object storage), federation_event_bridge (handler reaction),
nats relay (transport).
non-atomic by necessity: CompositeSocialAdapter::announce (k_ap-owned write).
Everything else rides its write.
This commit is contained in:
2026-10-26 01:12:58 +01:00
parent 6c295866a0
commit 9a4d0c1714
29 changed files with 1115 additions and 408 deletions

View File

@@ -11,7 +11,8 @@ use domain::models::{
WatchEvent, WatchEventSource, WatchlistEntry, WebhookToken,
};
use domain::ports::{
FollowCommand, UserProfileFieldsRepository, WatchEventCommand, WebhookTokenRepository,
FollowCommand, FollowWrite, UserProfileFieldsRepository, WatchEventCommand,
WebhookTokenRepository,
};
use domain::testing::{
MOVIE_CASCADE_TABLES, USER_CASCADE_TABLES, USER_CASCADE_TABLES_OUTSIDE_STORE, test_goal,
@@ -184,11 +185,21 @@ async fn seed_user_with_dependents(
domain::value_objects::InstanceIdentity::new("https://md.example"),
);
social
.add_follow(user_id.value(), REMOTE_ACTOR, FollowStatus::Accepted)
.await
.unwrap();
social
.add_follower(user_id.value(), REMOTE_ACTOR, FollowStatus::Accepted)
.apply(
&[
FollowWrite::AddFollow {
follower_id: user_id.value(),
target_actor_url: REMOTE_ACTOR.into(),
status: FollowStatus::Accepted,
},
FollowWrite::AddFollower {
local_user_id: user_id.value(),
follower_actor_url: REMOTE_ACTOR.into(),
status: FollowStatus::Accepted,
},
],
&[],
)
.await
.unwrap();
// No repository in this crate owns these two tables (federation crate).