Discussion threads and comments for any entity
| Tier | domain |
| Role | unclassified (baselined) |
| Path | crates/domain/comments |
| Edition | 2021 |
| Targets | domain_comments |
| Public items | 0 across 0 modules |
| Tests | 32 |
What it is for
domain-comments: Discussion threads and comments for any entity
Overview
This crate provides a universal comment system that can attach discussion relationships, allowing comments on Orders, Documents, CatalogItems, or any other entity type.
Layer
Domain - depends on: foundation-basemodels
Key Types
CommentThread- A discussion thread attached to an entityComment- A single comment within a threadMention- An @mention of a party in a commentReaction- An emoji reaction to a commentCommentService- High-level business operations
Example
use domain_comments::{CommentService, CreateThreadRequest, AddCommentRequest, EntityRef};
let service = CommentService::new(pool);
// Create a thread for an order
let (thread, event) = service.create_thread(CreateThreadRequest {
tenant_id,
entity_type: "Order".to_string(),
entity_id: order_id,
title: Some("Discussion".to_string()),
created_by: user_id,
}).await?;
// Add a comment with a mention
let user_to_mention = some_party_id;
let (comment, events) = service.add_comment(AddCommentRequest {
tenant_id,
thread_id: thread.id,
body: format!("Hey @{} please check this order", user_to_mention),
format: Default::default(),
parent_id: None,
created_by: user_id,
}).await?;
// The events include both comment.created and comment.mentioned
// Add a reaction
let (reaction, event) = service.add_reaction(comment.id, user_id, "👍").await?;
Capabilities
No public items.
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
No public items.
No pub use re-exports: every item above is declared in this crate.
Boundary
Reaches into foundation.
Shares tier domain with 41 other crates: domain-agreements, domain-ai-report, domain-billing, domain-catalog, domain-classify, domain-competitive-intel, domain-contact, domain-conversation-engine, … (41 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | domain |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/domain/comments |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_domain["domain"] --> n_foundation["foundation"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `foundation-basemodels` | foundation | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
chrono | ^0.4 | serde | no | always |
lazy_static | ^1 | — | no | always |
regex | ^1 | — | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | no | always |
thiserror | ^2 | — | no | always |
uuid | ^1 | v4, serde | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
tokio | ^1 | full, test-util | no | always |
Build. None.
Depended on by. 1 workspace crate.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_comments["application-comments"] -->|uses| SELF SELF["domain-comments"] SELF -->|runtime| n_foundation_basemodels["foundation-basemodels"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | domain_comments | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | yes |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
1 workspace crate depends on this one: application-comments.
Verification
| Kind | Count |
|---|---|
| Unit tests | 32 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
What the tests establish, by name:
test_comment_not_found—src/errors.rstest_duplicate_reaction—src/errors.rstest_thread_locked—src/errors.rstest_thread_not_found—src/errors.rstest_validation_error—src/errors.rstest_comment_created_event—src/events.rstest_event_serialization—src/events.rstest_mentioned_event—src/events.rstest_reaction_added_event—src/events.rstest_thread_created_event—src/events.rstest_comment_events—src/lib.rstest_comment_format—src/lib.rstest_comment_workflow—src/lib.rstest_cross_entity_comments—src/lib.rstest_mention_parsing—src/lib.rstest_reaction_workflow—src/lib.rstest_thread_lock—src/lib.rstest_comment_format—src/models.rstest_comment_new—src/models.rstest_comment_reply—src/models.rstest_comment_soft_delete—src/models.rstest_comment_with_format—src/models.rstest_entity_ref—src/models.rstest_mention_mark_read—src/models.rstest_mention_new—src/models.rstest_parse_mentions—src/models.rstest_parse_mentions_empty—src/models.rstest_parse_mentions_invalid—src/models.rstest_reaction_new—src/models.rstest_thread_lock_unlock—src/models.rs- _… 2 more_
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 0 | 0 |
Public modules with a //! block | 0 | 0 |
Metrics
| Metric | Value |
|---|---|
| Rust source files | 6 |
| Source lines | 1911 |
| Code lines | 1388 |
| Public API items | 0 |
| Public modules | 0 |
| Tests | 32 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 10 |
| Workspace reverse dependencies | 1 |
pie showData
title Rust source composition
"Code" : 1388
"Blank or comment" : 523
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.