Design and Implement a Social News Feed Domain
Model users, follows, posts, and a deterministic personalized news feed with pagination.
For this exercise, build an in-memory social news feed. Users can publish posts, follow or unfollow other users, and customize how eligible posts are ranked.
Support a versioned ranking profile with at least reverse chronology and deterministic per-author priority; each mode must use immutable post identity as its final tie-breaker.
A fresh feed freezes the reader's current follow set, ranking-profile version, and current maximum server creation sequence to create an immutable ordered snapshot. Continuation pages read that snapshot, so later publishing, follow changes, or ranking changes cannot duplicate, skip, or insert items.
Request identities are scoped to the calling user and command kind: repeated publish, follow, unfollow, and profile-update requests with the same scoped identity and normalized payload return the original result; reusing that scoped identity with different input returns an explicit conflict, while the same literal identity may be used for a different command kind.
Unknown users, invalid page sizes, and malformed, foreign, out-of-bounds, or expired cursors return explicit errors. Design the domain and interfaces, then implement the core with tests. Exclude likes, comments, media storage, persistence, and real-time push delivery.