Technical Debt — Scalable Search Product Gaps

By Engineering Team•September 27, 2026•3 min read
Metadata Details
System Scalable Search Product
Document ID TD-2026-SSP-006
Author Engineering Team
Status Open

This document tracks known implementation gaps in the product search flow as first-class, ongoing debt items. SR-006 links here rather than restating gap detail, so the requirement text itself doesn’t quietly read as an already-met guarantee.


TD-01 — Offset-based pagination degrades at deep pages

  • Status: Open
  • Severity: Low today — becomes Medium as catalog size and typical result-set depth grow.
  • Affected component: search-service — internal/repository/product_search/product_search_crud_rep.go’s SearchProductIDs.
  • Evidence: Pagination is implemented as $skip/$limit inside the $search pipeline’s $facet data branch — MongoDB (Atlas Search included) must still walk and discard every skipped document before returning a page, so latency grows with offset depth rather than staying flat.
  • Impact: A shopper paging deep into a large result set (or an integration that scrapes many pages) sees increasing latency per page, unlike the flat-cost cursor pagination a keyset/searchAfter-style approach would give. No shopper-facing incident today — typical search sessions don’t page deep — but this is the mechanism BRD-006’s BR-06 (“search that scales with the business”) calls out as a scaling requirement.
  • Remediation direction: Introduce cursor-based pagination (e.g. a searchAfter-style token built from the last-seen sort key) for the search results path specifically, following the same shape a future high-offset use case would need; keep offset-based paging only where result depth is inherently shallow.
  • Related requirement: SR-006 FR-06

TD-02 — No server-side cache on the search read path

  • Status: Open
  • Severity: Low — a performance headroom gap, not a correctness issue.
  • Affected component: shop-service’s searchProducts gRPC call to search-service, and search-service’s own Atlas Search query path.
  • Evidence: Neither service places a cache in front of the search read path. This mirrors the repo-wide deferred-Redis stance already documented for shop-service generally, but is called out here specifically because search queries are the highest-cardinality, most-repeated read pattern in the storefront (many shoppers issuing overlapping or identical queries).
  • Impact: Every search request re-runs the full Atlas Search compound query and, for the global strategy, a full gRPC hydration round-trip — no shortcut for a popular or repeated query. Acceptable at current traffic; a genuine scaling risk as BRD-006’s BR-06 traffic-growth goal is realized.
  • Remediation direction: When Redis is introduced repo-wide, prioritize caching search-service’s SearchProductIDs response (keyed by tenant + normalized filter/query) as a first candidate, given its read/write ratio.
  • Related requirement: SR-006 NFR-04

TD-03 — Shared, tenant-filtered index’s scaling ceiling is unverified

  • Status: Open
  • Severity: Low today — unverified, not a known failure.
  • Affected component: search-service’s product_search_index (single Atlas Search index shared across every tenant, isolated by a mandatory tenant_id filter clause).
  • Evidence: buildSearchCompound always includes tenant scoping in its filter clause, but there is no per-tenant or per-shard index — every tenant’s documents live in the same index. No load test or sizing analysis exists for how index size and query latency behave as total document count (summed across all tenants) grows.
  • Impact: None observed today. If one or a few large tenants’ catalogs grow substantially, every tenant sharing the index could see latency degrade together, not just the large tenant — a noisy-neighbor risk BRD-006’s BR-06 is meant to guard against.
  • Remediation direction: Load-test the shared index at a representative multi-tenant document count before this becomes a live risk; if a ceiling is found, evaluate index partitioning strategies (Atlas Search supports this) rather than defaulting to per-tenant indexes.
  • Related requirement: SR-006 NFR-02

TD-04 — search-service’s own documentation contradicts its actual read path

  • Status: Open
  • Severity: Medium — a documentation-correctness issue that risks misleading a future contributor into believing search-service response includes joined product detail, or that it uses a plain text index rather than Atlas Search.
  • Affected component: search-service (this site’s own microservice doc), and search-service/CLAUDE.md (the module’s own source-of-truth file, out of scope for this site to edit but cited here as corroborating evidence).
  • Evidence: search-service states “no request-time join against product-catalog/inventory-service is needed for a search result” — but search-service’s SearchProductIDs returns IDs only (product_search_crud_rep.go’s $project: {_id: 1} in the $facet data branch), and shop-service’s GlobalSearchStrategy.Search (global_search_strategy.go) always performs exactly that join via product-catalog’s GetProductDetailsByIDs and inventory-service’s GetProductPricing after receiving matched IDs. Separately, search-service/CLAUDE.md’s own “Indexes” section describes a plain MongoDB text index rather than the actual Atlas Search $search/compound mechanism, and omits its gRPC/REST read surface (SearchProducts, SuggestProducts) entirely, describing itself as a write-only Pub/Sub sink.
  • Impact: A reader of either document would incorrectly conclude that search results are self-contained (no downstream join) and that the underlying index is a basic text index — both false, and both load-bearing facts for anyone changing the search read path.
  • Remediation direction: This site’s search-service doc’s “no request-time join” line should be corrected to reflect the actual join GlobalSearchStrategy performs (tracked here rather than silently rewritten, per this pipeline’s own convention of routing gap corrections through a Technical Debt entry). search-service/CLAUDE.md’s Atlas Search/read-surface correction is the module owner’s responsibility, outside this site’s scope — flagged here as evidence only.
  • Related requirement: SR-006 FR-04

TD-05 — SR-006 previously conflated search-service’s sync sources with ADR-00005’s event set

  • Status: Resolved (corrected in this change)
  • Severity: Medium — a documentation-correctness issue that risked misleading a future contributor into believing search-service’s indexing depends on product-catalog’s publish-readiness gate, when the two are separate mechanisms with only one topic genuinely shared.
  • Affected component: SR-006 (this site’s own system-requirements doc).
  • Evidence: SR-006’s NFR-03 previously stated that search-service “consumes the identical event sources” as ADR-00005. Reading both the search-service and inventory-service/product-catalog source directly shows this is false except for one topic: ADR-00005 covers inventory-service’s five step-completion events consumed only by product-catalog’s own publish-readiness gate; search-service instead subscribes to four separate streams (product.catalog.updated, inventory-search-event, stock-balance-status-changed, and sku-compliance-pricing-upserted), of which only the last is also one of ADR-00005’s five events — consumed via its own independent subscription, for an unrelated purpose (see ADR-00017).
  • Impact: A reader relying on the old NFR-03 text would incorrectly assume changing or removing one of ADR-00005’s five events safely covers search-service’s freshness too, when three of search-service’s four streams are entirely untouched by ADR-00005.
  • Remediation direction: Already corrected — SR-006’s NFR-03 now carries an inline *(Correction: ...)* note and points to ADR-00017; Architecture-00006 and the search-service/product-catalog/inventory-service microservice docs were updated in the same change to describe the four streams accurately.
  • Related requirement: SR-006 NFR-03

TD-06 — Inconsistent publish reliability across the four sync streams, no failure visibility

  • Status: Open
  • Severity: Medium — a silent-data-loss risk on the search freshness path, not a correctness bug in the request/response path itself.
  • Affected component: product-catalog’s ProductSearchEventPublisher (called from product_crud.svc.go), inventory-service’s InventorySearchEventPublisher, StockStatusChangedEventPublisher, and SkuCompliancePricingUpsertedEventPublisher.
  • Evidence: product-catalog’s five product-mutating operations don’t publish consistently — Create/UpdateBasicInfo/Clone publish via a fire-and-forget goroutine (context.WithoutCancel + go func()), while UpdateSpecifications/Publish/Archive/Delete publish synchronously/inline in the same request path, for the same product.catalog.updated topic. inventory-service’s SkuCompliancePricingUpsertedEventPublisher (sku_compliance_pricing_crud.svc.go’s UpsertSkuCompliancePricing) is synchronous but swallows publish errors — logged only, never surfaced to the caller. In every one of these four publishers, a Pub/Sub publish failure is logged and then discarded — there is no operator-visible alert, no dead-letter inspection step, and no re-drive mechanism beyond whatever retry Pub/Sub itself performs.
  • Impact: A transient Pub/Sub outage or a misconfigured topic/subscription can silently leave product_search stale for an affected product/SKU indefinitely, with no signal to anyone except a log line — and the inconsistent fire-and-forget vs. synchronous split across product-catalog’s own five operations means the operational behavior for something as simple as “user edits a product’s basic info” differs from “user publishes that product,” which is a surprising inconsistency for anyone debugging a missing search result.
  • Remediation direction: Standardize all product-catalog publish call sites on one pattern (fire-and-forget is the documented convention — see the root CLAUDE.md’s context.WithoutCancel rule — so the four synchronous-inline call sites are the ones that should move, not the reverse); add a publish-failure metric/alert (even a simple counter) so a sustained failure streak is operator-visible instead of log-only.
  • Related requirement: SR-006 NFR-06