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): NewItemsSection MUST be sourced from product-catalog’s GetNewArrivals, a MongoDB aggregation filtering to status: "PUBLISHED" and sorted by created_at descending, joined against inventory-service’s product-pricing lookup by mongo_product_id.
  • FR-02 (Top Products Sourcing): TopProductSection MUST be sourced from product-catalog’s GetTopProductsByCategory, a MongoDB aggregation that groups published products by category and selects the most recently updated product per category, joined against inventory-service’s product-pricing lookup by mongo_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): MostPopularSection MUST be sourced by reusing GetTopProductsByCategory/GetNewArrivals with a different limit/offset than TopProductSection so the two sections do not render an identical product set, joined against inventory-service’s product-pricing lookup by mongo_product_id. (Gap — an interim heuristic with no real popularity signal; the section’s likes field is hardcoded to 0. Tracked as technical debt, see TD-02.)
  • FR-04 (Just For You Sourcing): JustForYouSection MUST be sourced from product-catalog’s GetJustForYou, a MongoDB aggregation optionally filtered by target_demographics/tags and sorted by updated_at descending, joined against inventory-service’s product-pricing lookup by mongo_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-service calls 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): CategorySection MUST be sourced from product-catalog’s GetCategoryProductGroups, 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): FlashSaleSection MUST be driven by inventory-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’s GetProductDetailsByIDs MUST only hydrate display detail (title, image, tags) for the ids inventory-service returns, and MUST preserve the rank order inventory-service established rather than re-sorting.
  • FR-07 (Product-Level Price Aggregation): For any section requiring a price, inventory-service MUST resolve a product’s price as its base selling price and its discount_price as 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-service MUST 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-service MUST be the sole orchestration layer joining product-catalog and inventory-service data for these six sections; product-catalog MUST 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.