Skip to content

fix(extension): price list, badge, empty and error states, labels - #1319

Merged
JOY (JOY) merged 3 commits into
devfrom
audit/extension-findings
Oct 28, 2026
Merged

JOY (JOY) merged 3 commits into
devfrom
audit/extension-findings

Conversation

@JOY

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

Copy link
Copy Markdown
Contributor

Closes #1297
Closes #1298
Closes #1299
Closes #1300
Closes #1301
Closes #1302

Fixes from an audit of the browser extension (apps/extension). Nothing changes what the extension collects or sends (#1175): the opt-in crowd signal is sent in exactly the cases it was before.

What users see

Code

Tests

apps/extension/src/test-extension-pipeline.ts: offer order and marks, the cheapest tag, badge and pill per verdict, the not-found and accessory states and action links, error kinds and texts, empty reviews, labels and accessible names. Extension typecheck, lint, test and build pass, as do web typecheck, lint and test.

Review

  • Round 1, fresh-context subagent: no P0-P2. Its P3s fixed: the crowd signal skipped on HTTP errors (restored), an open panel kept the old product on failure, the panel verdict colour.
  • Round 1, Codex: its P2 fixed: a late failure for an earlier product cleared the current pill and badge.
  • Round 2, Codex: its P1 is fixed (the crowd signal was sent after a network error, where it never was before); no P0/P1 left.
  • Left (P3):
    • nested live regions may announce twice;
    • a new extension build used against an old server treats bait rows as buyable, so deploy the server first;
    • there is no unit test for the server flag.

🤖 Generated with Claude Code


📌 TL;DR

This PR refactors the Rate.vn Chrome extension to improve error handling, UI accuracy, and accessibility. It introduces a new panel-view module for testable HTML rendering, implements race-condition guards for product lookups, and refines the display of price verdicts, offer availability, and review data.

🎯 Type of Change

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

🔍 Changes Walkthrough

File Summary of Changes
apps/extension/CHROMEWEBSTORE.md Updated privacy documentation to clarify the opt-in crowd signal toggle label.
apps/extension/src/background/service-worker.ts Refactored lookup logic to return a LookupOutcome (distinguishing success, HTTP errors, and network failures). Added a request counter to prevent race conditions where stale lookups overwrite fresh UI state. Updated badge logic to use the new resolveActionBadge helper.
apps/extension/src/content/content-script.ts Removed local theme logic in favor of resolvePillTheme. Added a generation counter to ensure only the latest page inspection renders the trust pill, preventing stale UI on single-page applications. Improved accessibility labels.
apps/extension/src/sidepanel/panel-view.ts New File. Extracted pure HTML builder functions for the side panel (offers, reviews, errors, not-found states). Added logic to sort offers by buyability/price and classify lookup failures (rate limit, server, network).
apps/extension/src/sidepanel/sidepanel.html Added CSS classes for offer marks (sold out, bait price, best price). Updated labels to Vietnamese (e.g., "Chính hãng" instead of "[Mall]"). Added aria-live and aria-label attributes for accessibility.
apps/extension/src/sidepanel/sidepanel.ts Refactored to use the new panel-view builders. Implemented specific error handling for lookup failures (showing retry buttons and specific error messages). Fixed action link rendering to avoid duplicates. Updated "not found" and "accessory" states to show appropriate UI.
apps/extension/src/test-extension-pipeline.ts Added comprehensive tests for the new panel-view logic, including offer sorting, badge resolution, error classification, and HTML escaping.

📊 Architectural Flow

sequenceDiagram
    participant CS as Content Script
    participant SW as Service Worker
    participant API as Rate.vn API
    participant SP as Side Panel

    CS->>SW: RATE_PRODUCT_DETECTED (signal)
    SW->>SW: Increment detectRequestCounter
    SW->>API: GET /lookup
    API-->>SW: Response (Data or Error)
    
    alt Lookup Success
        SW->>SW: Check if request is still latest
        SW->>CS: Send Data
        CS->>CS: Render Trust Pill (if latest)
        SW->>SP: Update Session Storage
        SP->>SP: Render Product Card (panel-view)
    else Lookup Failure (429, 500, Network)
        SW->>SW: Check if request is still latest
        SW->>CS: Send Error Status
        CS->>CS: Remove Trust Pill (if latest)
        SW->>SP: Update Session Storage (Error)
        SP->>SP: Render Error Card (panel-view)
        SP->>User: Show Retry Button
    end
Loading

JOY (JOY) and others added 3 commits October 29, 2026 02:32
The side panel orders in-stock offers first and marks sold-out,
discontinued and bait rows (the lookup now flags bait offers), shows a
short state for not-found and accessory pages, an error card with retry
for failed lookups, and no 0.0 stars or 100% genuine without reviews.
The badge and pill warn on a bait price and never say OK for an unchosen
size or an accessory; labels are Vietnamese and the panel is labelled
for screen readers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of the previous commit: the opt-in crowd signal is sent whatever
the lookup answered, as before (#1175); only the tab's latest lookup may
set or clear its pill, badge and panel, so a late failure for an earlier
product no longer clears the current one; an open side panel reloads
when the page's lookup fails; a bait price shows the amber verdict style
in the panel too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A network error used to throw before the opt-in crowd signal; the lookup
now reports it as a status-less failure, so the signal is skipped there
to keep what the extension sends unchanged (#1175).

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 7:41pm 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 53 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: 1ff83c63-bf86-4b99-8b95-b810b50b00d8
Commits

Reviewing files that changed from the base of the PR and between 4eca23d and 792c250.

Files selected for processing: 10
  • apps/extension/CHROMEWEBSTORE.md
  • apps/extension/src/background/service-worker.ts
  • apps/extension/src/content/content-script.ts
  • apps/extension/src/sidepanel/panel-view.ts
  • apps/extension/src/sidepanel/sidepanel.html
  • apps/extension/src/sidepanel/sidepanel.ts
  • apps/extension/src/test-extension-pipeline.ts
  • apps/extension/src/types.ts
  • apps/extension/src/verdict-display.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.

@github-actions github-actions Bot added area:frontend Frontend / Next.js / UI area:extension labels Oct 28, 2026
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 (10 eligible files · 68,616 chars · 3 model call(s) · 3 PR unit(s))

Whole diff with bounded context at base 4eca23d / head 792c250.

✅ No verified defects

1 possible issue(s) could not be grounded in or verified against the snapshot source, so they are not published.

Context investigation was bounded to the explicitly requested snapshot paths.

@JOY
JOY (JOY) merged commit db049c4 into dev Oct 28, 2026
24 of 25 checks passed
@JOY
JOY (JOY) deleted the audit/extension-findings branch October 28, 2026 19:48

This branch was successfully deployed

1 active deployment
Preview — 792c250e 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