Skip to content

fix(BUY-62788): re-apply browse-mode fabricated cache fix - #325

Open
BuyWhere wants to merge 2 commits into
mainfrom
fix/BUY-62788-mcp-browse-fabricated-cache-reapply
Open

fix(BUY-62788): re-apply browse-mode fabricated cache fix#325
BuyWhere wants to merge 2 commits into
mainfrom
fix/BUY-62788-mcp-browse-fabricated-cache-reapply

Conversation

@BuyWhere

@BuyWhere BuyWhere commented Aug 4, 2026

Copy link
Copy Markdown
Owner

BUY-62788 — Re-apply SEV-1 fix for MCP browse-mode fabricated cache

Problem

The BUY-62788 fix (commit 2ee6f65) was inadvertently reverted by BUY-65298 (b5781c9) which rewrote mcp.ts with -303/+199 lines.

Current broken behavior (live prod confirmed 2026-08-04):

search_products {country_code:'SG', limit:3}  → data:3  total:303832896 ← WRONG (global reltuples)
search_products {country_code:'US', limit:3}  → data:3  total:303832896 ← WRONG

While results happen to appear (recent ingestion covers SG/US), meta.total is inflated to ~303M global reltuples. The SEV-1 will fully resurface when recent rows don't match the country filter.

Fix

Push is_active + country_code + region into SQL WHERE for browse mode so both page AND COUNT_CEIL=100000 reflect the filtered set. Same approach as original 2ee6f65, consistent with BUY-65474 positional ::int casts.

Test Plan

  1. MCP integration tests
  2. Live probe: search_products {country_code:'SG', limit:3} → meta.total ≤ 100000
  3. FTS path: search_products {q:'laptop', country_code:'SG'} → still works

Co-Authored-By: Claude noreply@anthropic.com

Oracle added 2 commits August 4, 2026 05:23
…try/region into SQL + bounded count

The BUY-62788 fix from commit 2ee6f65 was inadvertently reverted by
subsequent commits (notably b5781c9 / BUY-65298, which rewrote mcp.ts
with -303/+199 lines). This caused the original SEV-1 behavior to return:

- meta.total = global pg_class.reltuples (~303M) from browse mode
- country_code / region filters applied in-application to recent rows

When recent rows happen to match the country, results still render — but
meta.total is wrong (inflated), and the bug will resurface the moment
recent ingestion stops including the queried country.

Re-apply the fix: push is_active + country_code + region into SQL WHERE
so the page and the bounded COUNT_CEIL=100000 both reflect the filtered
set. Consistent with BUY-65474's positional ::int casts.

Live prod repro before re-applying:
- search_products {country_code:'SG', limit:3} -> data:3, total:303832896
- search_products {country_code:'US', limit:3} -> data:3, total:303832896

After deploy: meta.total will be bounded to <=100000 (or actual filtered
count if smaller), reflecting the same set as data[].
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