Skip to content

fix(web): extension verdict, cheaper-elsewhere and inspect skip sold-out offers - #1180

Merged
JOY (JOY) merged 2 commits into
devfrom
claude/web-1177-extension-sold-out
Oct 28, 2026
Merged

JOY (JOY) merged 2 commits into
devfrom
claude/web-1177-extension-sold-out

Conversation

@JOY

@JOY JOY (JOY) commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up from #1170 / #1176: the browser extension and the inspect surfaces no longer cite sold-out or discontinued listings as the market reference, as cheaper options, or as a fallback match.

Changes

  • evaluateExtensionPriceVerdict (extension.ts) drops out_of_stock / discontinued offers before computing:

    • the market min, median and max;
    • the cheaper-offer count and the savings;
    • the implausibly-low check.

    This covers both the extension lookup and GET /api/v1/rate/inspect. The observed price is still judged when its own listing is sold out.

  • lookupExtensionProduct: the "cheaper elsewhere" list and the no-URL-match fallback use in-stock offers only. A URL-matched listing is still the matched offer, whatever its availability.

  • inspectProductOrShopUrl (rate-api.ts): neither fallback match picks a sold-out listing.

  • Deep Inspect page: the client-side fallback match does the same filter, so a null server match no longer brings back a sold-out allOffers[0].

  • Unchanged on purpose: allOffers in full mode, the price history and the radar input still receive every offer. They are for display and history, and the radar has filtered by availability since fix(web): batch offers read availability; radar and best offer skip sold-out listings #1176.

Trade-off

Bait detection (plausibleOffers / isImplausiblyLowPrice, #797) now runs on in-stock offers only, the same convention as #1176 and the stored min_price (#1141). On a thin market the outlier check needs a minimum number of offers. So when a sold-out listing was the third offer, a bait price among the remaining two is no longer flagged.

Tests

  • New block 126l in core-rate-architecture.test.ts. On Buds3 Pro-shaped data it checks:
    • the verdict's market reference and cheaper count ignore sold-out offers, including on a sold-out listing's own page;
    • lookupExtensionProduct shows only the in-stock cheaper store, and falls back to the cheapest in-stock offer.
  • The block fails on the code before this change.
  • Local: pnpm --filter @repo/web test, tsc --noEmit and eslint on the changed files are green.

Closes #1177

🤖 Generated with Claude Code


📌 TL;DR

This PR updates the pricing and inspection logic to exclude sold-out and discontinued listings from market reference calculations, "cheaper elsewhere" comparisons, and fallback offer matching. This ensures that users are not shown unavailable products as valid price benchmarks or purchase options.

🎯 Type of Change

  • 🚀 New feature
  • 🐛 Bugfix
  • 🧹 Refactor
  • ⚡ Performance
  • 📚 Documentation
  • ⚙️ CI / Configuration

🔍 Changes Walkthrough

File Summary of Changes
apps/web/src/components/inspect/DeepInspectWorkspace.tsx Updated the fallback logic for matchedOffer to filter out unavailable offers using isOfferUnavailable before selecting the first plausible offer.
apps/web/src/lib/rate-api.ts Modified inspectProductOrShopUrl to filter out unavailable offers when determining the matchedOffer and the final fallback return value, ensuring sold-out items are not selected.
apps/web/src/server/rate/extension.ts 1. Updated evaluateExtensionPriceVerdict to filter safeOffers to exclude unavailable items, preventing them from influencing market min/max prices.
2. Updated lookupExtensionProduct to create an inStockOffers list used for both fallback matching and market reference calculations (marketOffers).
apps/web/src/server/rate/__tests__/core-rate-architecture.test.ts Added comprehensive test suite (126l) verifying that sold-out/discontinued listings are excluded from market verdicts, cheaper offer counts, and fallback matching logic.

📊 Architectural Flow

flowchart TD
    A[Incoming Offers List] --> B{Filter: isOfferUnavailable?}
    B -->|Yes| C[Exclude from Market/Fallback]
    B -->|No| D[In-Stock Offers]
    
    D --> E[Calculate Market Min/Max]
    D --> F[Identify Cheaper Elsewhere]
    D --> G[Fallback Match Selection]
    
    C --> H[Retained for URL Match Only]
    H --> I[If User is on Sold-out Page]
    I --> J[Judge against In-Stock Market]
    
    E --> K[Price Verdict]
    F --> K
    G --> L[Matched Offer Result]
    J --> K
Loading

JOY (JOY) and others added 2 commits October 28, 2026 11:24
- evaluateExtensionPriceVerdict drops out_of_stock and discontinued offers
  before the market reference, the cheaper-offer count and the
  implausibly-low check, for the extension lookup and the inspect API.
- lookupExtensionProduct's cheaper-elsewhere list and its fallback match use
  in-stock offers only; a URL-matched listing is still judged.
- inspectProductOrShopUrl's fallback match skips sold-out listings too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…old-out own page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
rate Ready Ready Preview Oct 28, 2026 4:26am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f942fc6c-23f9-440f-924f-b957ba8b9835
Commits

Reviewing files that changed from the base of the PR and between c135412 and 2de64ea.

Files selected for processing: 4
  • apps/web/src/components/inspect/DeepInspectWorkspace.tsx
  • apps/web/src/lib/rate-api.ts
  • apps/web/src/server/rate/__tests__/core-rate-architecture.test.ts
  • apps/web/src/server/rate/extension.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

dos[bot]
dos Bot approved these changes Oct 28, 2026

@dos dos Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱️ Code Review completed (4 eligible files · 13,154 chars · 2 model call(s) · 1 PR unit(s))

Whole diff with bounded context at base c135412 / head 2de64ea.

✅ CLEAN_PASS: Complete diff reviewed

Context investigation was bounded to the explicitly requested snapshot paths.

@JOY
JOY (JOY) merged commit f300bdd into dev Oct 28, 2026
17 of 19 checks passed
@JOY
JOY (JOY) deleted the claude/web-1177-extension-sold-out branch October 28, 2026 04:32
@JOY JOY (JOY) mentioned this pull request Oct 28, 2026
3 of 6 tasks

This branch was successfully deployed

1 active deployment
Preview — 2de64ea6 Deployed Oct 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Frontend / Next.js / UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(web): extension price verdict and cheaper-elsewhere skip sold-out offers

1 participant