Design a Threaded Comment System with User Tags
Model comments, one-level replies, user-tag parsing, edits, deletion, ordering, and mention-intent boundaries for a social application.
Design a comment system for a social application. The source asks for comments, one level of replies, and an algorithm for annotating or tagging users.
For this exercise, assume users comment on posts, reply only to top-level comments, submit text containing user tags that are resolved to stable user identities and text ranges, edit their own comments, and delete a top-level comment without silently removing visible replies. Reads are paginated with stable ordering.
Feed ranking, post storage, and notification delivery infrastructure are out of scope.