ADR-BW-007: Distinguish authoritative state from derived views
Treat search and rating projections as derived information with explicit consistency limits rather than alternative sources of truth.
| Field | Value |
|---|---|
| Status | Proposed |
| Date | 2026-11-07 |
| Owners | Architecture Enabling TeamTeamArchitecture Enabling TeamEnabling team facilitating BookWorm's architecture governance, ADRs, arc42 documentation, engineering standards, testing...Open docs |
| Affected Resources | BookWormDomainv1.0.0BookWormCore e-commerce domain for the BookWorm online bookstore, coordinating catalog discovery, customer baskets, order fulfil...Ownerarchitecture-enabling-teamDiagramRepositoryOpen docs, Product Catalog SystemSystemv1.0.0Product Catalog SystemInternal BookWorm system that owns catalog management, product discovery, and catalog search index ingestion within the ...Ownercatalog-experience-teamDiagramOpen docs, Rating SystemSystemv1.0.0Rating SystemInternal Reviews system that owns customer feedback, publishes rating changes to Catalog, and provides read-time feedbac...Ownercatalog-experience-teamDiagramRepositoryOpen docs |
| Related ADRs | ADR-BW-006: Keep business state and persistence access capability-ownedDecision Recordv1.0.0ADR-BW-006: Keep business state and persistence access capability-ownedPreserve one accountable owner for each business model and integrate through contracts rather than shared mutable tables...Ownerarchitecture-enabling-teamOpen docs, ADR-002: Use Qdrant hybrid vector and keyword search for product discoveryDecision Recordv1.0.0ADR-002: Use Qdrant hybrid vector and keyword search for product discoveryText search finds candidate book IDs in Qdrant using embeddings plus keyword matching, then loads canonical records from...Ownercatalog-experience-teamOpen docs, 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, ADR-002: Publish feedback events for Catalog's rating projectionDecision Recordv1.0.0ADR-002: Publish feedback events for Catalog's rating projectionRating publishes committed feedback-created and feedback-deleted events so Catalog can maintain its own eventually consi...Ownercatalog-experience-teamOpen docs |
Context & Problem Statement
Book discovery relies on fast semantic search in Catalog VectorContainerv1.0.0Catalog VectorNon-authoritative Qdrant vector search index owned by the Catalog bounded context for hybrid semantic and keyword book d...Ownercatalog-experience-teamDiagramOpen docs and pre-aggregated rating summaries on BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs records, while authoritative product and review records live 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 and 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. Treating derived caches or search projections as authoritative truth risks exposing stale prices or orphaned data.
Decision Drivers
- Read performance: Support rich search and fast browsing without overloading primary stores.
- Commercial accuracy: Ensure checkout and mutations always read authoritative state.
- Rebuildability: Allow derived views to be reconstructed from source data after drift or loss.
Options Considered
| Option | Pros | Cons |
|---|---|---|
| Separate derived views with explicit eventual consistency | High read throughput; derived stores can be rebuilt anytime | Users may see brief staleness windows during async propagation |
| Treat search index / projections as authoritative | Single read/write path | Risks silent drift, lost history, and stale checkout pricing |
| Synchronous two-phase updates to all views | Zero propagation lag | Outages in search or projections block core writes |
| Query primary stores for every search | Always up to date | Slow cross-service reads and poor semantic search capabilities |
Decision & Consequences
Chosen Option: Treat search indexes, read caches, and cross-domain projections as non-authoritative derived views updated asynchronously. Purchase validation and mutations must always resolve against the authoritative system of record.
- Positive: Derived stores scale independently and can be rebuilt from primary records without data loss.
- Negative: UIs and operators must account for bounded eventual consistency windows.
Compliance Criteria
- Checkout price and availability checks must read from Catalog DatabaseContainerv1.0.0Catalog DatabaseAuthoritative PostgreSQL system of record owned by the Catalog bounded context for books, authors, categories, publisher...Ownercatalog-experience-teamDiagramOpen docs (via 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), never from Catalog VectorContainerv1.0.0Catalog VectorNon-authoritative Qdrant vector search index owned by the Catalog bounded context for hybrid semantic and keyword book d...Ownercatalog-experience-teamDiagramOpen docs or cache payloads.
- Every derived view must document its authoritative source, expected lag, and rebuild/reconciliation procedure.
- Derived projections must be read-only to external callers.