Skip to content

chore(release): promote dev to main - #1595

Merged
JOY (JOY) merged 2 commits into
mainfrom
dev
Nov 3, 2026
Merged

JOY (JOY) merged 2 commits into
mainfrom
dev

Conversation

@JOY

@JOY JOY (JOY) commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Promote dev to main.

Merge with a merge commit, never squash (Docs/Resources/RELEASE.md).


📌 TL;DR

This PR optimizes the rate.search_master_products database function by adding a trigram index for full-text search and implementing a numeric guard to prevent crashes from malformed spec data. It also aligns the rating filter and sort logic with the exact rating score displayed on the frontend, ensuring consistency between search results and product pages.

🎯 Type of Change

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

🔍 Changes Walkthrough

File Summary of Changes
apps/web/src/server/rate/openapi.ts Updated OpenAPI documentation for minRating and sort query parameters to accurately reflect the new rating logic (using rating_score_5 and one-decimal precision) and the specific behavior of the rating_desc sort order.
supabase/migrations/20261104120000_rate_search_master_products_trgm_index_and_numeric_guard.sql Performance & Stability:
1. Creates a new GIN trigram index (idx_master_products_search_full_trgm) covering all 7 searchable text fields to enable index-based text search.
2. Rewrites rate.search_master_products in plpgsql with force_custom_plan to allow the planner to simplify OR conditions and utilize the new index.
3. Adds a numeric guard for refresh rate, fast charging, and screen size filters to prevent SQL errors when casting malformed spec strings (e.g., "120.5.6") to NUMERIC.
supabase/migrations/20261104140000_rate_search_master_products_rating_score.sql Consistency & Logic:
1. Updates rate.search_master_products to use a unified "shown rating" calculation (rating_score > 0, else weighted user rating, else average rating) for both filtering and sorting.
2. Ensures the minRating filter compares against the rating rounded to one decimal place (matching the UI display).
3. Ensures rating_desc sorting uses the unrounded "shown rating" value, placing unrated products last.

📊 Architectural Flow

flowchart TD
    subgraph Client
        A[API Request] -->|Query Params: search, minRating, sort| B[OpenAPI Spec]
    end

    subgraph Database
        B --> C{rate.search_master_products}
        
        subgraph Search Logic
            C --> D[Text Search]
            D -->|Uses| E[(idx_master_products_search_full_trgm)]
            D -->|Guard| F[ILIKE Match]
        end
        
        subgraph Rating Logic
            C --> G[Calculate Shown Rating]
            G -->|Priority 1| H[rating_score]
            G -->|Priority 2| I[user_rating_weighted]
            G -->|Priority 3| J[average_rating]
            
            G --> K[Filter: minRating]
            K -->|Compares| L[Round to 1 decimal]
            
            G --> M[Sort: rating_desc]
            M -->|Uses| N[Unrounded Value]
        end
        
        subgraph Spec Parsing
            C --> O[Parse Specs]
            O -->|Guard| P[Valid Numeric Cast]
            O -->|Invalid| Q[Treat as Unknown/0]
        end
        
        C --> R[Return Results]
    end
    
    R --> S[Frontend Display]
    S -->|Matches| T[Product Page Rating]
Loading

JOY (JOY) and others added 2 commits November 3, 2026 10:15
…1591)

* docs(web): openapi min rating and rating sort read the shown rating

The products API's minRating (alias rating) and the rating_desc sort
follow rate.search_master_products, which reads rating_score_5, the
rating every page shows, once DOS.Me 20261104140000 is applied: the
minimum at one decimal, the sort unrounded, unrated products last.

Refs #1545

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(db): mirror the search trigram and rating score migrations

Copies two DOS.Me migrations byte for byte from DOS.Me main 13579714
(DOS/DOS.Me#1537, applied to Production):
- 20261104120000_rate_search_master_products_trgm_index_and_numeric_guard
  (DOS/DOS.Me#1497): the seven-field trigram index and the spec number
  guard in rate.search_master_products;
- 20261104140000_rate_search_master_products_rating_score (#1574, via
  DOS/DOS.Me#1533): the rating order and minimum rating read the rating
  every page shows.

Same signature and return type, so database.types.ts is unchanged
(gen-db-types --check passes).

Refs #1545

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 Nov 3, 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 Nov 3, 2026 3:24am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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: d4804639-dd95-4cea-be49-f1feca6066e7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

dos[bot]
dos Bot approved these changes Nov 3, 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 (3 eligible files · 19,462 chars · 3 model call(s) · 1 PR unit(s))

Whole diff with bounded context at base b1dfdab / head 7201101.

✅ CLEAN_PASS: Complete diff reviewed

Context investigation was bounded to the explicitly requested snapshot paths.

@JOY
JOY (JOY) merged commit 049fdc2 into main Nov 3, 2026
24 checks passed

This branch was successfully deployed

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

Labels

area:database area:frontend Frontend / Next.js / UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant