Rating summary mismatch
Investigate when a book's average rating or review count disagrees with Reviews.
Trigger / Symptom & Blast Radius
A book’s average_rating or total_reviews in 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 disagrees with 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, or 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 appears on <code>bookworm.{env}.catalog.book-update-rating-failed</code>. 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 owns authoritative FeedbackEntityv1.0.0FeedbackRepresents an individual customer's rating and optional written review for a Catalog book.Ownercatalog-experience-teamOpen docs documents 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, while 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 maintains only a derived summary in Catalog DatabaseContainerv1.0.0Catalog DatabaseAuthoritative PostgreSQL system of record owned by the Catalog bounded context for books, authors, categories, publisher...Ownercatalog-experience-teamDiagramOpen docs.
Never invent or hand-edit average_rating or total_reviews in Catalog DatabaseContainerv1.0.0Catalog DatabaseAuthoritative PostgreSQL system of record owned by the Catalog bounded context for books, authors, categories, publisher...Ownercatalog-experience-teamDiagramOpen docs
without deriving the exact aggregate from 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. Replaying already-applied
rating events after the 24-hour idempotency window expires will double-count ratings.
Pre-Flight Check
Compare Catalog’s derived summary in Catalog DatabaseContainerv1.0.0Catalog DatabaseAuthoritative PostgreSQL system of record owned by the Catalog bounded context for books, authors, categories, publisher...Ownercatalog-experience-teamDiagramOpen docs against the authoritative aggregate 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 (ratingdb / feedbacks):
SELECT id, name, average_rating, total_reviews, is_deleted FROM books WHERE id = '<BOOK_ID>';SELECT COUNT(1) AS total_reviews, AVG(c.rating) AS average_rating FROM c WHERE c.bookId = '<BOOK_ID>';Quick Recovery Procedure
Check for missing-book compensation events
Inspect <code>bookworm.{env}.catalog.book-update-rating-failed</code> for 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. If present, 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 could not find
<BOOK_ID>and emitted the compensation event so 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 deletes the orphaned feedback document.Inspect Kafka consumer lag and dead-letter queues
Check consumer lag and 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 logs across <code>bookworm.{env}.rating.feedback-create</code>, <code>bookworm.{env}.rating.feedback-delete</code>, and <code>bookworm.{env}.catalog.dead-letter-queue</code>:
Terminal window az containerapp logs show --name <SERVICE_NAME> --resource-group <RESOURCE_GROUP> --tail 150Recover without double-counting
Unprocessed DLQ messages: Fix the underlying database or handler fault first, then replay only unapplied messages from <code>bookworm.{env}.catalog.dead-letter-queue</code>.
Confirmed multi-event delta drift: Execute an approved reconciliation setting
average_ratingandtotal_reviewsdirectly from the authoritative 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 aggregate, then evictbook:<BOOK_ID>from Catalog CacheContainerv1.0.0Catalog CacheNon-authoritative FusionCache and Redis caching layer owned by the Catalog bounded context for fast book detail lookups ...Ownercatalog-experience-teamDiagramOpen docs.
Verification
Query 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 confirm averageRating and totalReviews match 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:
curl -sS "https://<GATEWAY_HOST>/catalog/api/v1/books/<BOOK_ID>" | jq '{id, averageRating, totalReviews}'Expected output:
{ "id": "<BOOK_ID>", "averageRating": 4.5, "totalReviews": 12}Rollback / Escalation
- Rollback: Re-run the authoritative reconciliation query from 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 and evict
book:<BOOK_ID>in Catalog CacheContainerv1.0.0Catalog CacheNon-authoritative FusionCache and Redis caching layer owned by the Catalog bounded context for fast book detail lookups ...Ownercatalog-experience-teamDiagramOpen docs if a manual correction used wrong values. - Escalation: Escalate persistent projection or compensation failures to Catalog Experience TeamTeamCatalog Experience TeamStream-Aligned team owning BookWorm's product catalog, customer reviews, and storefront/backoffice discovery experience....Open docs with
<BOOK_ID>and event IDs.
| Symptom | Cause | Fix |
|---|---|---|
| Catalog DatabaseContainerv1.0.0Catalog DatabaseAuthoritative PostgreSQL system of record owned by the Catalog bounded context for books, authors, categories, publisher...Ownercatalog-experience-teamDiagramOpen docs matches Cosmos DB, API returns old numbers | Stale entry in Catalog CacheContainerv1.0.0Catalog CacheNon-authoritative FusionCache and Redis caching layer owned by the Catalog bounded context for fast book detail lookups ...Ownercatalog-experience-teamDiagramOpen docs | Evict book:<BOOK_ID> using the stale cache runbook |
total_reviews higher than Cosmos DB count | Duplicate event replayed after 24-hour idempotency expiry | Reconcile directly from 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 and evict cache |
| Messages accumulating in Catalog DLQ | Transient DB or handler error exhausted retries | Fix dependency in 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 logs, then replay unapplied DLQ messages |
Related documentation
- Customer Feedback Publication and ProjectionFlowv1.0.0Customer Feedback Publication and ProjectionRating API persists customer feedback in Cosmos DB and publishes an integration event; Catalog API updates the derived b...Ownercatalog-experience-teamView flowOpen docs — End-to-end review projection and compensation flow.
- ADR-006: Keep only a derived rating summary on Catalog booksDecision Recordv1.0.0ADR-006: Keep only a derived rating summary on Catalog booksReviews owns individual feedback; Catalog stores just an average rating and review count per book, updated from feedback...Ownercatalog-experience-teamOpen docs — Derived rating summary boundary.