fix(BUY-65559): sentinel-price guard for MCP format helpers - #36
Conversation
Adds PRICE_SENTINEL_MIN = 10 guard. Catalog rows where price.amount < 10 (or non-finite / null) are produced by the BuyWhere ingest pipeline when the merchant page had no parseable price; the scraper writes '1' as a placeholder, which the front-end renders as '.00'. Until BUY-52807 ships an ingest-time sanity bound, surface a 'see merchant' hint so MCP clients (AI agents) do not quote a fake price. Targets the three Price: lines in formatProduct, compare_products, and find_best_price. formatProduct and compare_products are the highest traffic formats for AI agents.
Status: PR #36 is the canonical fix; please review + mergePR #35 was a duplicate and is now closed. This PR (#36) adds a Diff: Why this is a "Reed-band-aid" rather than the canonical fix
What's required after merge
Tracked in Paperclip as BUY-65585 (parent: this PR review). cc @BuyWhere/maintainers. |
Heartbeat 2026-08-03T20:02:39ZPR #36 still open, 0 reviews, awaiting human review. BUY-65585 stays in_review per the PR review gate pattern. No new live signal since last heartbeat. |
Heartbeat 2026-08-04T00:01ZPR #36 still open, 0 reviews since 2026-07-31. Awaiting human review per [[buywhere-pr-review-gate-pattern]]. New finding: probed the canonical sentinel product (871873063695734596, FY26 BUY-52807) at https://api.buywhere.ai/v1/products/871873063695734596 — Live state: https://buywhere.ai/ HTTP 200 (66ms), https://mcp.buywhere.ai/ HTTP 200 (82ms), https://api.buywhere.ai/ HTTP 200 (77ms). Sentinel product query: 7ms response, Status: still |
Heartbeat 2026-08-07T20:38:34Z (BUY-67116)PR #36
Per [[buywhere-pr-review-gate-pattern]] and [[buywhere-pr-review-gate-blocked-child]] — band-aid need a human reviewer on BuyWhere/buywhere-mcp. Marking BUY-67116 |
Summary
Adds
PRICE_SENTINEL_MIN = 10guard so MCP tools (get_product,compare_products,find_best_price) surface asee merchanthint instead of a fake.00price when the catalog row has a sentinel value.Root cause
Catalog rows where
price.amountis< 10(or non-finite / null) are produced by the BuyWhere ingest pipeline when the merchant page had no parseable price:1as a placeholder.00(currency formatter strips leading 1)This is the upstream ingest parent (BUY-52807). Until the ingest-time sanity bound ships, this format-side guard prevents AI agents from quoting fake prices.
Changes
src/index.ts: addedPRICE_SENTINEL_MIN,PRICE_UNAVAILABLE_TEXT,isSentinelPrice,formatPriceLinehelpersPrice: ${price?.currency ?? "SGD"} ${price?.amount ?? ...}template literals withformatPriceLine(...)in:formatProduct(single-product lookup)compare_products(multi-product comparison)find_best_price(best-price for query)dist/index.jsrebuilt vianpm run buildVerification
npm run buildproduces clean tsc output. Diff is+49/-6acrosssrc/index.tsanddist/index.js. Commit:ecc97f6.Deployment
prepublishOnlyrunsnpm run buildon npm publish. After merge, the new version can be published. The Railway MCP deployment follows the npm publish.Related issues
Author
Reed (Reed@buywhere.ai) — 2026-07-30T23:10Z