v0.5.0 — codebase refinement, flexible API, architecture cleanup
Error handling:
thiserror enum (NotFound/BadRequest/Unauthorized/Forbidden/Internal)
eliminates 41 boilerplate .map_err() calls
signature failures return 401, not 500
Named types:
Keypair, LocalObject (with to/cc/bto/bcc addressing), Addressing
Readability:
descriptive names everywhere, small functions, breathing room
noisy comments removed, intent-explicit error handling (no let _ =)
types.rs per module separating data from behavior
File organization:
handlers/ module (actor, featured, followers, inbox, nodeinfo, outbox, webfinger)
actors/ split (mod.rs + person.rs + types.rs)
service/ split (builder, broadcast, collections, delivery, fetch, follow, lookup, types)
tests next to modules
Repository traits:
FollowRepository → 5 sub-traits (FollowerWriter/Reader, FollowingWriter/Reader, FollowMigration)
ActorRepository → 3 sub-traits (KeypairRepository, RemoteActorCache, AnnounceRepository)
BlocklistRepository → 2 sub-traits (DomainBlocklist, ActorBlocklist)
supertraits with blanket impls — existing consumers unchanged
FollowMigration has default no-op
delete dead get_following_outbox_url
Testing:
mock_repo! macro generates mock builders from compact specs
MockFollowRepo, MockActorRepo, MockBlocklistRepo, MockActivityRepo,
MockUserRepo, MockContentReader, MockObjectHandler, MockEventPublisher
all hand-written test stubs replaced
Flexibility:
UrlScheme trait — configurable URL patterns (DefaultUrlScheme = /users/{uuid})
on_unknown_activity hook for custom AP extensions
broadcast_raw_to_followers for arbitrary activity JSON
broadcast_create/broadcast_update (renamed from Note-centric names)
internal modules locked to pub(crate), clean public re-exports
actor_handler, followers_handler, following_handler re-exported for custom routers
Security:
SSRF: block IPv6-mapped private IPv4, TEST-NET, benchmarking, reserved ranges
verify_attributed_to rejects missing/array attributedTo
remove .expect() from outbox handler
Architecture:
handlers/followers.rs delegates to serialize_ordered_collection (no more UrlScheme bypass)
extract dispatch_sends, prepare_addressed_broadcast (eliminate duplication)
DbActor::object_id(), RemoteActor::from/from_ap_person/placeholder
send_activity unifies prepare+dispatch, deterministic_activity_id helper
pass-through wrappers grouped in lookup.rs
This commit is contained in:
46
CHANGELOG.md
46
CHANGELOG.md
@@ -1,5 +1,51 @@
|
||||
# Changelog
|
||||
|
||||
## [0.5.0] — 2026-07-25
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- `broadcast_create_note` renamed to `broadcast_create`, `broadcast_update_note` renamed to `broadcast_update`
|
||||
- `LocalObject` is now a named struct with addressing fields: `to`, `cc`, `bto`, `bcc`
|
||||
- `ApContentReader::get_local_objects_page` returns `Vec<LocalObject>` instead of `Vec<(Url, Value, DateTime)>`
|
||||
- `Error` is now a thiserror enum with `NotFound` / `BadRequest` / `Unauthorized` / `Forbidden` / `Internal` variants
|
||||
- Repository traits split into sub-traits — `FollowRepository` is now a supertrait of `FollowerWriter`, `FollowerReader`, `FollowingWriter`, `FollowingReader`, `FollowMigration`; `ActorRepository` is a supertrait of `KeypairRepository`, `RemoteActorCache`, `AnnounceRepository`. Existing consumers implementing the supertrait continue to work unchanged.
|
||||
- `ActorRepository::save_local_actor_keypair` now takes a `Keypair` named struct instead of two strings
|
||||
- `NoteType` re-export removed
|
||||
- Internal modules (`activities`, `actors`, `handlers`, `data`, `content`, `error`, `user`, `federation`) are now `pub(crate)`
|
||||
- `get_following_outbox_url` removed (dead code)
|
||||
|
||||
### New features
|
||||
|
||||
- `UrlScheme` trait + `DefaultUrlScheme` — configurable URL patterns via `.url_scheme(Arc::new(MyScheme))` on the builder
|
||||
- `broadcast_raw_to_followers` — send arbitrary AP activity JSON to all accepted followers
|
||||
- `on_unknown_activity` hook on `ApObjectHandler` — handle custom AP extensions (EmojiReact, Question, Flag, etc.)
|
||||
- `DbActor::object_id()` convenience method
|
||||
- `RemoteActor::from_ap_person()`, `RemoteActor::placeholder()` constructors
|
||||
- Mock builder framework: `MockFollowRepoBuilder`, `MockActorRepoBuilder`, `MockBlocklistRepoBuilder`, `MockActivityRepoBuilder`, `MockUserRepoBuilder`, `MockContentReaderBuilder`, `MockObjectHandlerBuilder`, `MockEventPublisherBuilder`
|
||||
- `Keypair` named struct (was anonymous tuple)
|
||||
- `LocalObject` named struct with addressing (was anonymous tuple)
|
||||
- `FollowMigration::migrate_follower_actor` has a default no-op implementation
|
||||
- `actor_handler`, `followers_handler`, `following_handler` re-exported for custom router construction
|
||||
- Constants: `AP_CONTENT_TYPE`, `AP_CONTEXT`, `INBOX_BODY_LIMIT`
|
||||
|
||||
### Bug fixes / security
|
||||
|
||||
- Fix SSRF bypass via IPv6-mapped IPv4 addresses
|
||||
- Block additional reserved IP ranges (TEST-NET, benchmarking, reserved, IPv6 documentation)
|
||||
- `verify_attributed_to` now rejects missing `attributedTo` and handles array form
|
||||
- Signature failures return 401 instead of 500
|
||||
- Remove `.expect()` panics from outbox handler
|
||||
- Unknown activity types accepted gracefully instead of returning 500
|
||||
|
||||
### Internal improvements
|
||||
|
||||
- thiserror enum for `Error` type (41 boilerplate `.map_err` calls eliminated)
|
||||
- File organization: `handlers/`, `actors/`, `service/` with `types.rs` per module
|
||||
- `mock_repo!` macro replaces 980 lines of hand-written mocks
|
||||
- Small focused functions and descriptive variable names throughout
|
||||
|
||||
---
|
||||
|
||||
## [0.4.6] — 2026-07-16
|
||||
|
||||
### New features
|
||||
|
||||
Reference in New Issue
Block a user