Market comp uses base query instead of enriched query — gives wrong median for filtered searches #30
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
When a search uses
must_includewith specific GPU models and a category filter, the market comp call still uses the bare base query (q = "laptop motherboard")._run_comps()inapi/main.py:371callsget_completed_sales(q, pages)— not the filtered query.Result: median captures all sold laptop parts (~$50) instead of boards with those GPUs ($250-$400). The
vs_marketfield becomes noise ("445% above market").Root Cause
Two issues:
api/main.py:_run_comps()always uses bareq, ignoringmust_includeandcategory_id.app/platforms/ebay/scraper.py:529:get_completed_sales()never passes_sacatcategory param.Fix Proposal
Short-term: Derive a smarter comp query in
api/main.py. Whenmust_include_mode == groupsappend the pivot term toqfor the comp call (e.g."laptop motherboard rtx 3070"instead of"laptop motherboard").Full fix: Add
category_idparam toget_completed_sales()and pass it through. Add optionalcomp_queryoverride so callers can specify a targeted query independent of the search query.Impact
All searches with tight
must_includefilters show misleading market deltas. Trust scores are unaffected (scorer ignores market price), butvs_marketin MCP output and UI is wrong.