feat: unified social identity layer — SocialIdentity, ports, use cases, adapter

SocialIdentity value object (Local|Remote), SocialCommand/SocialQuery
domain ports, 11 CQRS use cases w/ 14 tests, CompositeSocialAdapter
wrapping k_ap, 6 new domain events, handlers migrated from ap_service
to use cases. Closes #12 foundation — AP handlers + legacy cleanup TBD.
This commit is contained in:
2026-07-10 15:29:46 +02:00
parent 96ce5f7d26
commit 322e9ee81a
45 changed files with 2095 additions and 160 deletions

View File

@@ -1,16 +1,39 @@
use super::*;
use crate::value_objects::UserId;
use crate::value_objects::{SocialIdentity, UserId};
#[test]
fn follow_accepted_matches() {
let uid = UserId::from_uuid(uuid::Uuid::new_v4());
let event = DomainEvent::FollowAccepted {
local_user_id: uid.clone(),
remote_actor_url: "https://remote.example/users/alice".to_string(),
outbox_url: "https://remote.example/users/alice/outbox".to_string(),
owner: uid.clone(),
requester: SocialIdentity::Remote {
actor_url: "https://remote.example/users/alice".to_string(),
},
};
let DomainEvent::FollowAccepted { outbox_url, .. } = event else {
let DomainEvent::FollowAccepted { requester, .. } = event else {
panic!("wrong variant");
};
assert_eq!(outbox_url, "https://remote.example/users/alice/outbox");
assert_eq!(
requester,
SocialIdentity::Remote {
actor_url: "https://remote.example/users/alice".to_string()
}
);
}
#[test]
fn follow_requested_local() {
let follower = UserId::from_uuid(uuid::Uuid::new_v4());
let target = UserId::from_uuid(uuid::Uuid::new_v4());
let event = DomainEvent::FollowRequested {
follower: follower.clone(),
target: SocialIdentity::Local(target.clone()),
};
assert!(matches!(
event,
DomainEvent::FollowRequested {
target: SocialIdentity::Local(_),
..
}
));
}