Skip to content

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

Merged
JOY (JOY) merged 6 commits into
mainfrom
dev
Oct 24, 2026
Merged

JOY (JOY) merged 6 commits into
mainfrom
dev

Conversation

@JOY

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

Copy link
Copy Markdown
Contributor

Promotes dev to main:

No supabase/ changes.

🤖 Generated with Claude Code


📌 TL;DR

This PR hardens the Shopee importer against malformed data (C1 control characters, non-standard ports, boolean type coercion) and introduces a robust image URL validation utility to prevent rendering junk data like [object Object] in the web frontend. It also fixes 404 page metadata to ensure correct localized titles for accessibility and SEO.

🎯 Type of Change

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

🔍 Changes Walkthrough

File Summary of Changes
apps/importer/src/shopee/entity-matcher.ts Refactored control character detection to use Unicode regex (\p{Cc}). Added port validation to sanitizeHttpUrl (rejects non-80/443). Added boolean type rejection to toBoundedPositiveInt/Number.
apps/importer/src/shopee/paging.ts Added resolveBackfillSupabaseTarget to validate Supabase URLs (scheme, credentials, control chars). Hardened fetchAllPages against boolean inputs and non-array data. Updated parseShopeeEnqueueUrl to reject C1 chars and non-standard ports.
apps/importer/src/shopee/logger.ts Enhanced sanitizeAiGeneratedText to handle NaN/invalid maxLen and strip C1 chars. Added cleanField helper to ImporterStructuredLogger to sanitize log metadata (component, run_id, etc.) against control characters and excessive length.
apps/importer/src/shopee/shopee-to-supabase.ts Updated platformReviewIdFor to sanitize review IDs (strip C1 chars, enforce 160 char limit). Added sanitization for review videos and reviewer.profileUrl. Updated hasPopulatedSpecificationGroups to ignore blank/whitespace array items.
apps/importer/src/shopee/jobs/*.ts Updated backfill jobs (backfill-review-risk, backfill-specs) to use the new resolveBackfillSupabaseTarget for safe URL handling.
apps/web/src/lib/rate-domain-core.ts Added isImageUrl, usableImageUrls, firstImageUrl, and productImageUrl utilities to filter out invalid image strings (e.g., [object Object]) and resolve valid thumbnails.
apps/web/src/app/[locale]/[...rest]/page.tsx Added generateMetadata to the catch-all 404 page to ensure it has a localized "Page Not Found" title (WCAG 2.4.2).
apps/web/src/app/[locale]/compare/[versus]/page.tsx Updated generateMetadata to return 404 titles for invalid compare slugs instead of a generic fallback.
apps/web/src/app/[locale]/**/*.tsx Replaced manual image fallback logic (item.images[0]) with the new productImageUrl and firstImageUrl utilities across Home, Product Detail, Category, and Compare pages.
apps/web/src/components/**/*.tsx Updated CompareWorkspace, HeroSearchInspector, DeepInspectWorkspace, and WatchlistWorkspace to use the new image resolution utilities.
apps/web/src/lib/hero-products.ts Updated toHeroProductSuggestions to use usableImageUrls to ensure the hero search box only receives valid image URLs.
apps/web/locales/*.json Removed unused versusMetaFallbackTitle keys as the 404 title logic now handles these cases.
apps/web/e2e/*.spec.ts Added E2E tests for 404 titles and image URL filtering (ensuring [object Object] is not requested as a URL).
apps/web/e2e/seed.sql Updated seed data to include [object Object] in image arrays to test the new filtering logic.
apps/web/package.json Added image-url.test.ts to the test script.
apps/importer/src/shopee/__tests__/*.ts Added comprehensive unit tests for the new sanitization logic, port validation, and boolean rejection.

📊 Architectural Flow

flowchart TD
    subgraph "Data Ingestion (Importer)"
        A[Raw Shopee Data] --> B{Sanitization Layer}
        B -->|URLs| C[sanitizeHttpUrl]
        C -->|Rejects| C1[C1 Chars, Non-80/443 Ports, Credentials]
        C -->|Accepts| C2[Clean HTTP/HTTPS URL]
        
        B -->|Numbers| D[toBoundedPositiveInt/Number]
        D -->|Rejects| D1[Boolean Inputs]
        D -->|Accepts| D2[Bounded Number]
        
        B -->|Supabase Config| E[resolveBackfillSupabaseTarget]
        E -->|Rejects| E1[Bad Scheme, Credentials, C1 Chars]
        E -->|Accepts| E2[Valid Supabase URL]
    end

    subgraph "Web Frontend"
        F[Product Data] --> G{Image Resolution}
        G --> H[isImageUrl]
        H -->|Rejects| H1["[object Object]", Empty, Invalid Paths]
        H -->|Accepts| H2[Valid Image URL]
        
        H2 --> I[productImageUrl / firstImageUrl]
        I --> J[Render <img> Tag]
        
        K[404 Route] --> L[generateMetadata]
        L --> M[Localized 404 Title]
    end
Loading

JOY (JOY) and others added 5 commits October 24, 2026 22:19
…code stripping (#873) (#875)

Co-authored-by: JOY <anh@metados.com>
…itization (#876) (#878)

Co-authored-by: JOY <anh@metados.com>
* fix(web): skip stored image entries that are not URLs (#810)

Fourteen TGDD listings store the literal "[object Object]" ahead of
their real CDN URLs, so merchant pages requested
/merchants/[object Object] and showed broken thumbnails. Add
isImageUrl/firstImageUrl to rate-domain-core and use them wherever a
stored images list was read by its first entry, and in
resolveProductImageUrl's fallback.

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

* fix(web): filter junk images in hero suggestions, JSON-LD and thumbnails (#810)

Review follow-ups: hero search suggestions cut images to the first
entry before it was checked, and the product JSON-LD listed every
stored entry, junk included. Add usableImageUrls and use it there.
resolveProductImageUrl also checks the stored thumbnail, and entries
with surrounding whitespace are trimmed instead of rejected.

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

* fix(web): check the thumbnail too and require a host in image URLs (#810)

CodeRabbit on #871: "thumbnail || firstImageUrl(images)" still picked a
junk thumbnail, and isImageUrl accepted "//". Add productImageUrl,
which tries the thumbnail and then the stored images, and require a
host after "//" or "http(s)://".

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

---------

Co-authored-by: JOY <anh@metados.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…881)

Unknown paths kept the site's default title and a missing comparison
was titled "Đối đầu 1v1", although both render the 404 page. Give the
catch-all route a localized "not found" title and use it for both
404 branches of /compare/[versus]; drop the unused fallback title.

Co-authored-by: JOY <anh@metados.com>
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 24, 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 24, 2026 3:55pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 24, 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: f38d9af5-0b3a-484c-b2f3-a261088d1988

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

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

@github-actions github-actions Bot added area:frontend Frontend / Next.js / UI area:crawlers labels Oct 24, 2026
dos[bot]
dos Bot approved these changes Oct 24, 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 (29 eligible files · 61,106 chars · 3 model call(s) · 3 PR unit(s))

Whole diff with bounded context at base afbe1f5 / head 2c7d651.

✅ CLEAN_PASS: Complete diff reviewed

Context investigation was bounded to the explicitly requested snapshot paths.

… bounds (#882) (#883)

Co-authored-by: JOY <anh@metados.com>
dos[bot]
dos Bot approved these changes Oct 24, 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 (33 eligible files · 76,333 chars · 2 model call(s) · 3 PR unit(s))

Whole diff with bounded context at base afbe1f5 / head 622529b.

✅ CLEAN_PASS: Complete diff reviewed

Context investigation was bounded to the explicitly requested snapshot paths.

@JOY
JOY (JOY) merged commit 007b4d1 into main Oct 24, 2026
20 checks passed

This branch was successfully deployed

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant