ADR-003: Compensate feedback rejected by Catalog
Rating removes feedback when Catalog reports that a feedback-created event referenced a missing book, and treats repeated compensation signals as idempotent no-ops.
1. Context & Problem
Every FeedbackEntityv1.0.0FeedbackRepresents an individual customer's rating and optional written review for a Catalog book.Ownercatalog-experience-teamOpen docs entry references a BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs owned by Catalog. Because ReviewsDomainv1.0.0ReviewsCaptures individual customer feedback for books, publishes rating changes for Catalog discovery, and provides privacy-sc...Ownercatalog-experience-teamDiagramOpen docs and Catalog maintain separate data stores and communicate asynchronously, there is no shared database check or distributed transaction to guarantee that a referenced book still exists in Catalog at the exact moment feedback is created.
If Catalog receives a newly created feedback notice for a book it cannot find, leaving that feedback stored in Reviews would retain orphaned data that can never appear in Catalog’s rating summary.
2. Business Value
- Clean, accurate data: Reviews does not retain orphaned feedback for nonexistent books indefinitely.
- Resilient asynchronous design: Both domains preserve full independence without brittle cross-system locks or distributed transactions.
- Targeted, safe recovery: Cleanup is tightly scoped to the exact rejected feedback record, preventing accidental removal of valid customer reviews.
- Retry resilience: Repeated rejection notices are handled harmlessly, avoiding error loops or dead-letter noise.
3. How It Works
When Catalog rejects a newly created feedback notice because the referenced book does not exist, a targeted compensation flow cleans up the invalid record:
- Catalog signals the missing book: Catalog cannot apply the rating update, so it sends a specific failure notice identifying the rejected feedback entry.
- Reviews removes only that record: The Rating service looks up the specific feedback record using the identifier in the notice and deletes it.
- Repeated notices are harmless: If that feedback entry has already been removed, the service simply finishes without modifying any other feedback for the same book or reviewer and without retrying endlessly.
- Strictly scoped to missing books: This cleanup runs only for missing-book rejections on newly created feedback—not for temporary outages, network glitches, or other processing errors.
4. Trade-offs & Lessons Learned
- Temporary inconsistency window: A feedback record referencing a missing book can exist briefly in Reviews until Catalog processes the creation notice and sends back the rejection signal.
- Operational distinction required: Support and operations teams must distinguish automated missing-book compensation from customer- or administrator-initiated deletions when auditing feedback history.
- Correlation is essential for diagnostics: Investigating why a review disappeared requires tracing the original creation notice, Catalog’s rejection notice, and the targeted feedback identifier together.
- Narrow scope prevents data loss: Limiting compensation strictly to missing-book rejections ensures valid customer feedback is never deleted due to transient consumer or infrastructure failures.
Alternatives Considered
- Share a database or enforce a cross-system foreign key: Rejected because it would couple Reviews persistence to Catalog storage and violate independent domain boundaries.
- Keep the invalid feedback and retry the projection forever: Rejected because repeated retries cannot make a nonexistent book appear, leaving unprojectable data indefinitely.
- Delete feedback for any Catalog processing error: Rejected because treating every error as a business rejection could delete legitimate customer reviews during a transient outage.
5. Technical Reference
- Triggering flow: 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 emits 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 on
bookworm.{env}.rating.feedback-create. - Compensation event & channel: Catalog publishes 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 on
bookworm.{env}.catalog.book-update-rating-failedwhen the referenced book is missing. - Consumer behavior in
rating-api:- Extracts
feedbackIdfromBookUpdatedRatingFailedIntegrationEventand deletes only that matchingFeedbackrecord. - Idempotency: If the record for
feedbackIdis already absent, the handler completes as an idempotent no-op without modifying other records for the same book or reviewer or triggering endless retries. - Scope guard: Strictly limited to missing-book rejection of a created-feedback event; other delivery, validation, or transient Catalog failures use separate error-handling paths.
- Extracts
- Diagnostic correlation: Correlate
FeedbackCreatedIntegrationEvent,BookUpdatedRatingFailedIntegrationEvent, andfeedbackIdacross logs and traces.