fix(BUY-66091): alias domain/original_price in MCP get_deals SELECT [SEV-1] - #332
Open
BuyWhere wants to merge 1 commit into
Open
fix(BUY-66091): alias domain/original_price in MCP get_deals SELECT [SEV-1]#332BuyWhere wants to merge 1 commit into
BuyWhere wants to merge 1 commit into
Conversation
The MCP get_deals handler (handleGetDeals) selected bare `domain` and `original_price` columns from `products`, but neither exists on that table: `domain` lives on `merchants` and `original_price` is a JSONB metadata key. This threw `column "domain" does not exist` for every get_deals call (SEV-1, US first reported in probe #338 2026-08-04 06:28Z). The regression was introduced in 1f84498 (BUY-64112), which flattened the deals query and dropped the aliasing present in the REST /v1/products/deals handler (products.ts) and buildProduct's expected keys (response.ts reads row.domain / row.original_price). Fix aliases them the same way the REST handler does: source AS domain (metadata->>'original_price')::numeric AS original_price Verified the corrected query returns real US deals against prod DB. Co-Authored-By: Claude <noreply@anthropic.com>
BuyWhere
force-pushed
the
fix/buy-66091-mcp-deals-domain-column
branch
from
August 4, 2026 18:36
7fe9c1c to
cdb65bb
Compare
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.
SEV-1 fix — BUY-66091
Symptom:
get_dealsMCP tool returnscolumn "domain" does not existfor every call (US first reported probe #338, 2026-08-04 06:28Z). Previously returnedstatement_timeout.Root cause:
handleGetDealsinapi/src/routes/mcp.tsselected baredomainandoriginal_pricecolumns fromproducts, but neither exists on that table:domainis onmerchants(notproducts)original_priceis a JSONBmetadatakey (not a column)The regression was introduced in
1f84498(BUY-64112, 2026-08-04), which flattened the deals query and dropped the aliasing that the REST/v1/products/dealshandler (products.ts) andbuildProduct(response.tsreadsrow.domain/row.original_price) both rely on.Fix: alias the columns the same way the REST handler does:
Verification:
tsc --noEmit— 0 errorsdomain+original_pricepopulatedDeploy blocker: Railway deploy tokens are
Unauthorized(BUY-56879) — agent cannot deploy. Needs merge + pipeline unblock, or human Railway redeploy ofbuywhere-api.🤖 Generated with Claude Code