Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

Feedback ownership, concurrency, and compensation

Domain invariants, Cosmos DB concurrency, caching, and cross-domain compensation rules for Rating API.

Architecture

Purpose & Scope

This document defines the data ownership, optimistic concurrency, caching, and cross-domain compensation boundaries for 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 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 in the ReviewsDomainv1.0.0ReviewsCaptures individual customer feedback for books, publishes rating changes for Catalog discovery, and provides privacy-sc...Ownercatalog-experience-teamDiagramOpen docs subdomain. Use it when modifying feedback mutations, Azure Cosmos DB persistence, Kafka rating events, or read-only AI summarization.

Visual Reference

The visual below illustrates how 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 persists feedback in 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, caches reads in Rating CacheContainerv1.0.0Rating CacheNon-authoritative FusionCache and Redis caching layer owned by the Reviews bounded context for AI-generated book feedbac...Ownercatalog-experience-teamDiagramOpen docs, exchanges rating events with Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs, and serves read-only summarization.

Loading graph...

Feedback Persistence, Catalog Projection, and Summarization Boundaries

Core Invariants & Design Rules

Warning

Never emit FeedbackDeletedIntegrationEvent during compensation. Deleting an orphaned feedback in response to Book rating update failedEventv1.0.0Book rating update failedIndicates that Catalog could not apply a feedback-created event because the referenced book was not found. Ownercatalog-experience-teamSchemaDiagramOpen docs must use the revert path rather than the standard delete path; otherwise Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs would receive a spurious decrement for a book it already rejected.

Boundaries & Guarantees

ConcernStrategy & GuaranteeFailure / Edge-Case BehaviorRelated Resources
Persistencerating-database stores feedback documents partitioned by /bookId with Wolverine Cosmos DB persistence for durable messaging.Missing feedback on DELETE returns 404 Not Found (never masked as 204); compensation delete for an already-absent record completes as a no-op.rating-database, feedback, adr-001-postgresql-feedback-system-of-record
Cachingrating-cache caches paged feedback reads (ListFeedbacks) via FusionCache with a 10m TTL tagged by BookId.Feedback creation, deletion, or compensation invalidates the affected BookId tag so subsequent reads reflect the updated list.rating-cache, ListFeedbacks
MessagingEmits FeedbackCreatedIntegrationEvent and FeedbackDeletedIntegrationEvent partitioned by BookId / FeedbackId; consumes BookUpdatedRatingFailedIntegrationEvent.Exhausted retries route to <code>bookworm.{env}.rating.dead-letter-queue</code>; missing-book compensation deletes the orphaned feedback cleanly.<code>bookworm.{env}.rating.feedback-create</code>, <code>bookworm.{env}.rating.feedback-delete</code>, <code>bookworm.{env}.catalog.book-update-rating-failed</code>, <code>bookworm.{env}.rating.dead-letter-queue</code>
Concurrency & IdempotencyCosmos DB ETag optimistic concurrency prevents lost updates on feedback documents; inbound compensation events use a 24h Redis integration-event idempotency guard; HTTP routes enforce PerUserRateLimit.Concurrent ETag conflicts fail fast rather than overwriting newer state; duplicate BookUpdatedRatingFailedIntegrationEvent deliveries within 24h are safely ignored.rating-api, feedback-publication, adr-003-compensate-invalid-feedback-after-catalog-rejection

Safe Change & Verification Checklist

  • Preserve the /bookId partition key and ETag optimistic concurrency configuration on 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 (feedbacks container).
  • Verify Feedback createdEventv1.0.0Feedback createdIndicates that a customer feedback rating was created for a book. Rating API publishes this event so Catalog can update ...Ownercatalog-experience-teamSchemaDiagramOpen docs and Feedback deletedEventv1.0.0Feedback deletedIndicates that a customer feedback rating was deleted for a book. Rating API publishes this event so Catalog can remove ...Ownercatalog-experience-teamSchemaDiagramOpen docs emit only post-commit, and that compensation revert never emits Feedback deletedEventv1.0.0Feedback deletedIndicates that a customer feedback rating was deleted for a book. Rating API publishes this event so Catalog can remove ...Ownercatalog-experience-teamSchemaDiagramOpen docs.
  • Confirm BookId cache-tag invalidation in Rating CacheContainerv1.0.0Rating CacheNon-authoritative FusionCache and Redis caching layer owned by the Reviews bounded context for AI-generated book feedbac...Ownercatalog-experience-teamDiagramOpen docs on create, delete, and compensation paths.
  • Keep 0–5 rating validation, PII log redaction, and admin / read authorization policies intact.
  • Run mise run format, mise run build, and mise run test to verify Rating unit tests and Pact contracts (Rating-Catalog, Catalog-Rating).