ADR-001: Use PostgreSQL as the feedback system of record
Rating Database (PostgreSQL) is the authoritative store for individual customer feedback; no other domain may read or write feedback records directly.
1. Context & Problem
Individual customer FeedbackEntityv1.0.0FeedbackRepresents an individual customer's rating and optional written review for a Catalog book.Ownercatalog-experience-teamOpen docs carries its own lifecycle rules, reviewer details, a rating, and an optional comment. CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs needs rating summaries to support product discovery, but storing or querying individual feedback records inside Catalog would shift ReviewsDomainv1.0.0ReviewsCaptures individual customer feedback for books, publishes rating changes for Catalog discovery, and provides privacy-sc...Ownercatalog-experience-teamDiagramOpen docs ownership into the wrong domain and tightly couple the two areas.
To keep creation, browsing, and deletion consistent, BookWorm needs a single authoritative home for feedback identity, reviewer constraints, and review content—preventing duplicate copies from drifting out of sync across domains.
2. Business Value
- Single source of truth: One authoritative store ensures customer reviews are never fragmented across multiple domains.
- Protected domain boundaries: Other parts of the platform cannot bypass validation, authorization, or business rules by reaching directly into Reviews data.
- Transactional reliability: Creating, listing, and removing feedback operate against consistent, integrity-checked records.
- Privacy isolation: Review text and reviewer names stay inside Reviews rather than being copied unnecessarily into Catalog’s product discovery store.
3. How It Works
Rating DatabaseContainerv1.0.0Rating DatabaseAuthoritative Azure Cosmos DB system of record owned by the Reviews bounded context for customer feedback documents part...Ownercatalog-experience-teamDiagramOpen docs serves as the sole authoritative store for all individual FeedbackEntityv1.0.0FeedbackRepresents an individual customer's rating and optional written review for a Catalog book.Ownercatalog-experience-teamOpen docs records, and only the Rating service (Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs) is permitted to write to or manage them.
- When a customer submits feedback, the service checks that the rating is between 0 and 5 and saves the rating, book reference, reviewer information, and optional comment in one place.
- The store enforces uniqueness for each combination of book and reviewer name so duplicate submissions with the same details are prevented.
- Other domains interact only through published integration notices or supported service queries—never by reading the Rating store directly.
- Catalog receives only the identifiers and rating needed to maintain its own derived summary, without receiving review comments or reviewer details.
- Both AI-generated summaries and Catalog’s aggregate rating view are treated as separate, rebuildable derived views rather than replacements for the authoritative feedback store.
4. Trade-offs & Lessons Learned
- Availability dependency: Both the Rating service and Rating AgentAgentv1.0.0Rating AgentRead-only review intelligence specialist that summarizes customer feedback over A2A gRPC and map-reduce workflows while ...PublishesAnalyzeText, AnonymizeTextOwnercatalog-experience-teamDiagramRepositoryOpen docs depend on the database being available for feedback writes, listings, and summarization reads.
- Eventual consistency for consumers: Because external domains cannot query the database directly, cross-domain views such as Catalog’s rating summary must tolerate brief delays between a review change and its reflection elsewhere.
- API validation remains essential: Database uniqueness and integrity rules complement, but do not replace, service-level validation of the 0-5 rating range and request rules.
- Name uniqueness is not identity verification: Preventing duplicate entries by book and reviewer name does not constitute verified customer identity; downstream callers should not treat it as proof of identity.
- No cross-database foreign keys: A feedback entry can reference a book that Catalog later reports as missing. That mismatch is resolved via an asynchronous compensation flow rather than a direct cross-domain database constraint.
Alternatives Considered
- Store individual feedback in Catalog: Rejected because it would move Reviews lifecycle and customer-content ownership into the Catalog domain.
- Let consumers read the Rating Database directly: Rejected because direct access couples downstream services and agents to internal storage structures and bypasses validation, authorization, and integration contracts.
- Use Catalog’s rating projection as the review source: Rejected because the projection holds only aggregate numbers, not individual review records or their lifecycle.
5. Technical Reference
- Authoritative store: Rating DatabaseContainerv1.0.0Rating DatabaseAuthoritative Azure Cosmos DB system of record owned by the Reviews bounded context for customer feedback documents part...Ownercatalog-experience-teamDiagramOpen docs (PostgreSQL) for the FeedbackEntityv1.0.0FeedbackRepresents an individual customer's rating and optional written review for a Catalog book.Ownercatalog-experience-teamOpen docs aggregate.
- Exclusive writer: Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs.
- Validation & constraints:
rating-apivalidates ratings in the inclusive0-5range at the API boundary before persistence.- PostgreSQL enforces a uniqueness constraint on the book and reviewer name combination alongside relational integrity for feedback IDs, book IDs, reviewer details, and optional comments.
- Downstream contract boundary: Projection events emitted to CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs carry only identifiers and the rating value—omitting comment text and reviewer details.
- Dependencies: Feedback listing,
rating-apiwrites, and Rating AgentAgentv1.0.0Rating AgentRead-only review intelligence specialist that summarizes customer feedback over A2A gRPC and map-reduce workflows while ...PublishesAnalyzeText, AnonymizeTextOwnercatalog-experience-teamDiagramRepositoryOpen docs reads rely on PostgreSQL availability; missing-book references are handled asynchronously via the Catalog rejection compensation flow rather than cross-database foreign keys.