System design
Paginate account activity while new postings arrive
Bank of America Corporation · Concept
Original practice scenario: A hypothetical banking activity screen loads transaction pages while additional postings and corrections arrive. Design pagination that does not omit or repeat records during scrolling.
Read model answer
Choose whether a browsing session represents a stable snapshot or a continuously changing view. Offset pagination over mutable data can shift records between pages as new entries appear.
Work through it
- Use a stable ordering key such as posting sequence plus unique entry identity, and bind an opaque cursor to account scope, filters and a snapshot boundary.
- Fetch subsequent pages by key range within that boundary, exposing later arrivals through an explicit refresh rather than inserting them invisibly into older pages.
- Define how corrected or reversed entries appear, authorize every page request and test equal timestamps, concurrent postings and expired cursors.
Tradeoffs to discuss
- Snapshot browsing improves consistency but temporarily hides new activity; live updates are fresher while requiring visible change handling.
Common pitfalls
- Do not rely on a timestamp alone when multiple entries can share it.
- A cursor must not permit access to another account merely because its internal identifiers are predictable.