feat: atomic wrapup, movie, integration writes

Ride writes: WrapUpRequested/Completed (wrapup create/set_complete),
MovieDiscovered (resolve upsert, new+ext id only), PosterSynced (poster
handler upsert), MovieDeleted (delete_movie), WatchEventIngested (save).
Deps drop event_publisher: wrapup, ingest, delete_review, watchlist add,
review logger.

Remaining .publish( sites:
announce-only: users/delete_account UserDeleted, person/get +
get_credits PersonEnrichmentRequested, jobs/enrichment_staleness,
http-axum search, movies/sync_poster + poster_sync_handler +
image-converter backfill + users/update_profile ImageStored (object
storage), activitypub federation_event_bridge (reacting to events).
rides write, deferred: social/execute (see report),
activitypub review_handler MovieEnrichmentRequested (after
save_remote_review).
This commit is contained in:
2026-10-26 01:02:34 +01:00
parent 2f133afb96
commit 6c295866a0
51 changed files with 1281 additions and 329 deletions

View File

@@ -3,7 +3,7 @@ use std::sync::Arc;
use domain::models::{WatchEvent, WatchEventSource};
use domain::ports::{MovieCommand, WatchEventCommand};
use domain::testing::{InMemoryStore, NoopEventPublisher};
use domain::testing::InMemoryStore;
use domain::value_objects::UserId;
use uuid::Uuid;
@@ -42,7 +42,7 @@ async fn confirms_watch_event_via_review_logger() {
None,
);
let event_id = event.id().value();
watch_events.save(&event).await.unwrap();
watch_events.save(&event, &[]).await.unwrap();
let result = confirm::execute(
&deps(&watch_events, noop_logger()),
@@ -86,7 +86,7 @@ async fn confirms_event_with_external_metadata_id_and_no_movie_id() {
None,
);
let event_id = event.id().value();
watch_events.save(&event).await.unwrap();
watch_events.save(&event, &[]).await.unwrap();
let result = confirm::execute(
&deps(&watch_events, noop_logger()),
@@ -121,7 +121,7 @@ async fn rejects_other_users_event() {
None,
);
let event_id = event.id().value();
watch_events.save(&event).await.unwrap();
watch_events.save(&event, &[]).await.unwrap();
let result = confirm::execute(
&deps(&watch_events, noop_logger()),
@@ -148,7 +148,6 @@ async fn fails_when_event_not_found() {
#[tokio::test]
async fn confirms_event_with_movie_id() {
let watch_events = InMemoryStore::new();
let events = NoopEventPublisher::new();
let uid = Uuid::new_v4();
let movie_uuid = Uuid::new_v4();
@@ -162,7 +161,7 @@ async fn confirms_event_with_movie_id() {
Some(domain::value_objects::MovieId::from_uuid(movie_uuid)),
);
let event_id = event.id().value();
watch_events.save(&event).await.unwrap();
watch_events.save(&event, &[]).await.unwrap();
// Also seed movie repo so review_logger can find it
let movies = domain::testing::InMemoryStore::new();
@@ -174,7 +173,7 @@ async fn confirms_event_with_movie_id() {
None,
None,
);
movies.upsert_movie(&movie).await.unwrap();
movies.upsert_movie(&movie, &[]).await.unwrap();
// Build a real review logger
let reviews = domain::testing::InMemoryStore::new();
@@ -186,7 +185,6 @@ async fn confirms_event_with_movie_id() {
Arc::clone(&reviews) as _,
Arc::clone(&watchlist) as _,
Arc::new(domain::testing::FakeMetadataClient) as _,
Arc::clone(&events) as _,
));
let result = confirm::execute(
@@ -214,7 +212,7 @@ async fn confirms_event_without_movie_id_and_without_external_metadata_id() {
None,
);
let event_id = event.id().value();
watch_events.save(&event).await.unwrap();
watch_events.save(&event, &[]).await.unwrap();
let result = confirm::execute(
&deps(&watch_events, noop_logger()),
@@ -260,8 +258,8 @@ async fn confirms_multiple_events() {
);
let id2 = event2.id().value();
watch_events.save(&event1).await.unwrap();
watch_events.save(&event2).await.unwrap();
watch_events.save(&event1, &[]).await.unwrap();
watch_events.save(&event2, &[]).await.unwrap();
let result = confirm::execute(
&deps(&watch_events, noop_logger()),
@@ -302,7 +300,7 @@ async fn confirms_event_without_year() {
None,
);
let event_id = event.id().value();
watch_events.save(&event).await.unwrap();
watch_events.save(&event, &[]).await.unwrap();
let result = confirm::execute(
&deps(&watch_events, noop_logger()),