fix(federation): fix 27 AP bugs, gaps, and inconsistencies
Some checks failed
lint / lint (push) Failing after 9m26s
test / unit (push) Successful in 16m3s

Round 1 — 18 bug fixes:
- remote likes/boosts now persist in engagement tables
- intern_remote_actor uses name@domain, expanded username to VARCHAR(255)
- PgRemoteActorRepository upsert/find now handles all fields
- update_following_status no longer a no-op, count_followers counts all
- accept/reject follow publishes event before DB mark (atomicity)
- fetch_outbox_page follows pagination via next links
- actor URL canonicalized to /users/{uuid}
- content_to_html escapes single quotes
- WebFinger accepts application/ld+json type
- try_from_ap accepts Article and Page object types
- feed SQL uses parameterized viewer UUID instead of format!
- content cap raised from 500 to 5000 chars
- also_known_as changed from Option<String> to Vec<String>
- connections fetch always triggers from page 1

Round 2 — 9 gap fixes:
- on_announce_removed handler deletes boost row on Undo(Announce)
- on_update handles Person/Service/Group actor profile updates
- sync_remote_actor_to_user syncs remote_actors → users on create/update
- FederationBlockPort: block_by_username sends Block activity to remote
- domain RemoteActor gains inbox_url, shared_inbox_url fields
- remote_actors attachment column (JSONB) with read/write
- .well-known/host-meta endpoint
- 256KB body limit on AP inbox routes
- outbox cleanup job (7-day retention, hourly sweep)
This commit is contained in:
2026-05-29 11:28:40 +02:00
parent f9de21dcfa
commit 84edf58de6
32 changed files with 565 additions and 142 deletions

View File

@@ -8,10 +8,12 @@ pub struct RemoteActor {
pub avatar_url: Option<String>,
pub bio: Option<String>,
pub banner_url: Option<String>,
pub also_known_as: Option<String>,
pub also_known_as: Vec<String>,
pub outbox_url: Option<String>,
pub followers_url: Option<String>,
pub following_url: Option<String>,
pub inbox_url: Option<String>,
pub shared_inbox_url: Option<String>,
pub attachment: Vec<(String, String)>,
pub last_fetched_at: DateTime<Utc>,
}

View File

@@ -360,15 +360,27 @@ pub trait FederationFetchPort: Send + Sync {
) -> Vec<crate::models::actor_connection_summary::ActorConnectionSummary>;
}
#[async_trait]
pub trait FederationBlockPort: Send + Sync {
async fn block_remote(&self, local_user_id: &UserId, handle: &str) -> Result<(), DomainError>;
async fn unblock_remote(&self, local_user_id: &UserId, handle: &str)
-> Result<(), DomainError>;
}
pub trait FederationActionPort:
FederationLookupPort + FederationFollowPort + FederationFollowRequestPort + FederationFetchPort
FederationLookupPort
+ FederationFollowPort
+ FederationFollowRequestPort
+ FederationFetchPort
+ FederationBlockPort
{
}
impl<
T: FederationLookupPort
+ FederationFollowPort
+ FederationFollowRequestPort
+ FederationFetchPort,
+ FederationFetchPort
+ FederationBlockPort,
> FederationActionPort for T
{
}

View File

@@ -846,6 +846,24 @@ impl FederationFetchPort for TestStore {
}
}
#[async_trait]
impl FederationBlockPort for TestStore {
async fn block_remote(
&self,
_local_user_id: &UserId,
_handle: &str,
) -> Result<(), DomainError> {
Ok(())
}
async fn unblock_remote(
&self,
_local_user_id: &UserId,
_handle: &str,
) -> Result<(), DomainError> {
Ok(())
}
}
#[async_trait]
impl RemoteActorConnectionRepository for TestStore {
async fn upsert_connections(