Skip to content

fix(BUY-63030): route MCP catalog reads through catalogDb; surface unavailable on zero-count category fallback#235

Open
BuyWhere wants to merge 1 commit into
mainfrom
fix/BUY-63030-catalogdb-read-path
Open

fix(BUY-63030): route MCP catalog reads through catalogDb; surface unavailable on zero-count category fallback#235
BuyWhere wants to merge 1 commit into
mainfrom
fix/BUY-63030-catalogdb-read-path

Conversation

@BuyWhere

Copy link
Copy Markdown
Owner

Context

Parent: BUY-63027 (SEV-1 MCP fabricated cache regression). BUY-63030 is the deploy-and-verify subtask.

Live MCP probe at 2026-07-17T03:24Z showed:

  • search_products(laptop, SG/US) returned rows but polluted cross-market results
  • get_deals(SG/US) returned real rows
  • list_categories(SG/US) still served cached static zero-count categories with unavailable:false

Root cause

MCP catalog reads were routing through the primary maglev DB (the catalog ingestion primary), which has been returning the fabricated/stale total rows seen in BUY-62788 / BUY-63027. The catalogDb pool already exists in mcp-railway/src/config.ts (BUY-53789, pointed at the canonical ~127M-row catalog replica), but src/routes/mcp.ts was never switched to use it for catalog reads.

Local patch

  • Import catalogDb from ../config.
  • Route MCP catalog reads through catalogDb for: search_products, get_product, compare_products, get_deals, list_categories, find_best_price, probeDiscountPctColumn, and the regional FTS fallback in get_deals.
  • Keep ingestion/auth/health writes on primary db (write-path correctness, liveness checks).
  • list_categories already recomputes unavailable from cached rows so pre-fix cache payloads now surface unavailable:true for zero-count static fallbacks.

Test plan

After merge + deploy, expect list_categories to return meta.unavailable:true until cache TTL clears AND mcp_category_summary_by_country is populated; then nonzero counts with unavailable:false.

…available on zero-count category fallback

- Switch search_products, get_product, compare_products, get_deals,
  list_categories, find_best_price, probeDiscountPctColumn, and the
  regional FTS fallback in get_deals from primary db to catalogDb so
  the canonical ~127M catalog is served.
- Keep ingestion/auth/health endpoints on primary db (write paths +
  liveness checks).
- list_categories already recomputes unavailable from cached rows so
  pre-fix zero-count static fallbacks now surface unavailable:true
  after deploy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant