refactor: extract activity dispatcher middleware to eliminate handler boilerplate #10

Closed
opened 2026-05-30 01:32:05 +00:00 by GKaszewski · 0 comments
Owner

Closed: activitypub_federation owns the ActivityHandler trait, so k-ap can't introduce a true middleware layer without fighting the framework. The guard boilerplate is only 2 lines per handler via check_guards. The remaining per-handler logic (actor resolution, user lookup, logging) genuinely differs between activity types — it's not duplicated, it's type-specific. The cost of the abstraction outweighs the boilerplate savings.

**Closed:** `activitypub_federation` owns the `ActivityHandler` trait, so k-ap can't introduce a true middleware layer without fighting the framework. The guard boilerplate is only 2 lines per handler via `check_guards`. The remaining per-handler logic (actor resolution, user lookup, logging) genuinely differs between activity types — it's not duplicated, it's type-specific. The cost of the abstraction outweighs the boilerplate savings.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GKaszewski/k-ap#10