Context
Commentable marks a model whose records take comments, but @stackra/collaboration held only presence, cursors and
snapshots, so the OS collaboration service owns bespoke comment tables (its SPEC, Stackra gap 1). Every product with a
record page (a matter, a class, an order) needs the same threads, edit history, tombstones and mentions.
Decision
- Threads and comments. A
CommentThreadhangs on a record by its model key and public id (never a foreign key), optionally anchored inside it, and is open or resolved; a reply reopens it. ACommentkeeps its author, level, text and mentions; an edit keeps the old text as aCommentRevision; a delete leaves a tombstone whose text and mentions no view shows. Tablescollaboration.comment_threads,comments,comment_revisionsandcomment_mentions, each under the forced scope policy. - Levels.
internalorshared(with the record’s external participants). Floors in code: an external author never posts internal; a shared comment is refused while the consumer’ssharedCommentssetting is off. The default level and who may edit or delete are the consumer’s settings and policy. - Mentions. Member, team, role, external participant or the assistant. Floors in code: each target once, an id on
every target but the assistant, no external participant on an internal comment, no assistant while the consumer’s
assistantHandleis empty. Whether an id exists is theMentionDirectoryport’s answer, which the consumer binds. Each mention is also aCommentMentionrow for the inbox read. - Events.
CommentCreated(collaboration.comment.created.v1) per post andMentionCreated(collaboration.mention.created.v1) per new target (an edit announces only targets it added); neither carries text. An assistant mention is how the AI sidekick is summoned. - Holds. An edit or a tombstone of a comment under a legal hold is refused through
@stackra/database’sHoldRegistry(asked as a delete until an edit disposal exists).
Consequences
- The OS collaboration service drops its comment tables and binds a
MentionDirectory; its migration moves the rows. - Notification digests, the activity feed and moderation stay the consumer’s.
- The package depends on
@stackra/modeland@stackra/events.
Enforcement
comment.service.test.ts, check-mentions.function.test.ts, comment-events.test.ts and
0002-create-comments.migration.test.ts in packages/experience/collaboration.
Supersedes and sources
Supersedes: none. Sources: OSservices/collaboration/SPEC.md (gap 1); OS-224, OS-225, OS-226.