Spec stable paging for a live activity feed
Your task
Your Go service serves a mobile app's activity feed, newest first, 30 items at a time. New events arrive every second, and moderators delete some.
The endpoint pages with ?page=N and SQL OFFSET. Users see the same post twice as they scroll, and deep pages are slow. An agent will rewrite the endpoint.
Write the spec you would hand the agent.
What you know:
- Go,
pgxand Postgres events(id bigint, user_id, created_at timestamptz, body), withidfrom a sequence andcreated_atdefaulting tonow()- a fan-out job writes each batch of events in one transaction
- older app versions send
?page=Nand will be around for 6 months
Then, in a few sentences: what does "add pagination with page and limit" produce on a feed like this?