fix(BUY-62788): re-apply browse-mode fabricated cache fix - #325
Open
BuyWhere wants to merge 2 commits into
Open
Conversation
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[].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
While results happen to appear (recent ingestion covers SG/US),
meta.totalis 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 + regioninto SQL WHERE for browse mode so both page ANDCOUNT_CEIL=100000reflect the filtered set. Same approach as original 2ee6f65, consistent with BUY-65474 positional::intcasts.Test Plan
search_products {country_code:'SG', limit:3}→ meta.total ≤ 100000search_products {q:'laptop', country_code:'SG'}→ still worksCo-Authored-By: Claude noreply@anthropic.com