SR-008 — Storefront Product Discovery Sections System Requirements
By Engineering Team•September 29, 2026•6 min read
Metadata
| Field | Value |
|---|---|
| Project Name | Storefront Product Discovery Sections |
| Document ID | SR-008 |
| Author | Engineering Team |
| Status | Draft |
| Traces to | BRD-008 |
This document derives the concrete requirements behind BRD-008 from shop-service’s actual section-sourcing implementation. shop-service is the join layer for all six sections below — it calls product-catalog and inventory-service directly by gRPC and joins their results by mongo_product_id, rather than either downstream service assembling a combined response itself. See ADR-00016 for why this request-time join was chosen over a dedicated recommendation/ranking engine.
1. Functional Requirements (FR)
Section sourcing
- FR-01 (New Arrivals Sourcing):
NewItemsSectionMUST be sourced fromproduct-catalog’sGetNewArrivals, a MongoDB aggregation filtering tostatus: "PUBLISHED"and sorted bycreated_atdescending, joined againstinventory-service’s product-pricing lookup bymongo_product_id. - FR-02 (Top Products Sourcing):
TopProductSectionMUST be sourced fromproduct-catalog’sGetTopProductsByCategory, a MongoDB aggregation that groups published products by category and selects the most recently updated product per category, joined againstinventory-service’s product-pricing lookup bymongo_product_id. (Gap — this ranks by recency, not a genuine popularity or sales signal; no such field exists in either data store today. Tracked as technical debt, see Technical Debt — Storefront Merchandising Section Accuracy Gaps, TD-01.) - FR-03 (Most Popular Sourcing):
MostPopularSectionMUST be sourced by reusingGetTopProductsByCategory/GetNewArrivalswith a different limit/offset thanTopProductSectionso the two sections do not render an identical product set, joined againstinventory-service’s product-pricing lookup bymongo_product_id. (Gap — an interim heuristic with no real popularity signal; the section’slikesfield is hardcoded to0. Tracked as technical debt, see TD-02.) - FR-04 (Just For You Sourcing):
JustForYouSectionMUST be sourced fromproduct-catalog’sGetJustForYou, a MongoDB aggregation optionally filtered bytarget_demographics/tagsand sorted byupdated_atdescending, joined againstinventory-service’s product-pricing lookup bymongo_product_id. When no demographics/tags are supplied, the query MUST degrade gracefully to the recency-sorted result rather than erroring or returning empty. (Gap —shop-servicecalls this with no demographics/tags today, so every shopper receives the same recency-sorted result; no per-shopper personalization signal exists. Tracked as technical debt, see TD-03.) - FR-05 (Category Groups Sourcing):
CategorySectionMUST be sourced fromproduct-catalog’sGetCategoryProductGroups, a MongoDB aggregation returning, per curated category, up to four representative product images and a total count of published products in that category. This section requires no pricing join. - FR-06 (Flash Sales Sourcing):
FlashSaleSectionMUST be driven byinventory-service’s flash-sale ranking query, which selects products with at least one active SKU carrying a positive discount and ranks them by savings amount descending;product-catalog’sGetProductDetailsByIDsMUST only hydrate display detail (title, image, tags) for the idsinventory-servicereturns, and MUST preserve the rank orderinventory-serviceestablished rather than re-sorting. - FR-07 (Product-Level Price Aggregation): For any section requiring a price,
inventory-serviceMUST resolve a product’spriceas its base selling price and itsdiscount_priceas the lowest active-SKU discount price greater than zero, aggregated across that product’s SKUs — a product has no single stored price; it is always computed at query time from its underlying SKUs. - FR-08 (Cross-Service Join-Mismatch Handling): When a product id returned by one side of a section’s join (MongoDB detail or PostgreSQL pricing) has no counterpart on the other side,
shop-serviceMUST drop that id from the section’s result rather than rendering it with a missing or zero price, and MUST log the drop at info level. (Gap — a dropped product produces no merchandising-visible signal anywhere; an operator has no way to notice a section is silently smaller than intended. Tracked as technical debt, see TD-04.) - FR-09 (Single Join Owner):
shop-serviceMUST be the sole orchestration layer joiningproduct-catalogandinventory-servicedata for these six sections;product-catalogMUST NOT reintroduce a combined cross-service query RPC of its own for this purpose.
2. Non-Functional Requirements (NFR)
- NFR-01 (Multi-Tenancy): Every query behind every section in this document MUST be scoped by
tenant_id, sourced from the calling request’s auth context, consistent with the platform’s security standards. - NFR-02 (No Behavioral Signal Pipeline Exists Yet): No pipeline capturing shopper views, clicks, or purchases exists in any data store this feature reads from today — this is the root constraint behind FR-02/FR-03/FR-04’s interim ranking logic, and MUST be treated as a prerequisite for any future genuine popularity or personalization signal, not something those sections can work around independently. (Gap — tracked as technical debt, see TD-05.)
- NFR-03 (Empty-Result Safety): Every section’s underlying query MUST return an empty result set safely (no error, no partial/malformed response) when no products match its criteria, rather than assuming at least one match always exists.
- NFR-04 (Real-Time Price/Availability Reflection): Because price and discount are computed at request time from
inventory-service’s current SKU data rather than cached or precomputed, every section’s displayed price MUST reflect the product’s current state at the moment of the request — satisfying BRD-008’s BR-07.
Related Documents
- BRD-008 — Storefront Product Discovery Sections
- ADR-00016 — Query-Time Computation vs. a Dedicated Recommendation Engine for Storefront Merchandising Sections
- ADR-00008 — Polyglot Persistence: MongoDB for Product-Catalog, PostgreSQL for Inventory-Service
- Architecture: shop-service — Mobile Storefront Screen Delivery (GraphQL)
- Technical Debt — Storefront Merchandising Section Accuracy Gaps
- Microservices: shop-service, product-catalog, inventory-service