Skip to content

fix(normalizer): keep the size before năm <year>; dates and units are not sizes (#1317) - #1321

Merged
JOY (JOY) merged 2 commits into
devfrom
fix/1317-size-year-regression
Oct 29, 2026
Merged

JOY (JOY) merged 2 commits into
devfrom
fix/1317-size-year-regression

Conversation

@JOY

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

Copy link
Copy Markdown
Contributor

Closes #1317

Regression from #1291 (PR #1292). Not on main yet.

What (product-normalizer.ts)

  1. P1: "năm" counts as a duration only when no year follows it: "iPad Pro 11 năm 2022 M2" and "MacBook Pro 14 năm 2023 M3" keep their size; "13 năm" (no year) is still no size.
  2. P2: a bare size is never read from a date ("Sale 11/11": not after <digit>/), before "RAM" when no RAM size follows ("16 RAM 512 SSD"; "13 RAM 8GB" keeps the 13), after a macOS name (Sonoma, Sequoia, Ventura, Monterey, Tahoe), before an English duration (months, years, days, weeks, hours) or an amount (nghìn, ngàn, triệu, vnd). The same guards apply to the checks that keep a gift's size from standing in, so those titles get the gift-fitted size again.
  3. P3: a bare number right after a gift word and before a separator, another gift word or the end ("tặng ốp 11 | 13 WiFi", "tặng ốp 11 tặng bút") is the gift's: the product's own size after it wins; when the product names none, the fix(normalizer): kèm vỏ material and gift-only sizes drop the product size #1277 gift-only rule applies.

Before/after keys

Over every string literal mentioning Watch/iPad/MacBook in apps/importer/src, packages, apps/web/e2e and supabase (552 strings, the new fixtures included), origin/dev vs this branch: 12 changed, all fixtures of this issue:

  • size back: "iPad Pro 11 năm 2022 M2" (-11), "MacBook Pro 14 năm 2023 M3" (-14), "MacBook Air 13 năm 2022" (-13), "MacBook Air 15 năm 2023" (-15), "iPad Air 11 năm 2024" (-11), "iPad Pro 12.9 năm 2022" (-129)
  • gift size stands in again: "macOS Sonoma 14 tặng túi 13 inch" (-13), "BH 12 months tặng ốp 11 inch" (-11), "giảm 44 nghìn tặng ốp 46mm" (-46mm)
  • right size instead of a wrong one: "Sale 11/11 tặng ốp 13 inch" (-11 -> -13), "16 RAM 512 SSD tặng túi 14 inch" (-16 -> -14), "tặng ốp 11 | 13 WiFi" (-11 -> -13)

#1263 / #1277 / #1291 fixtures unchanged.

Review gate

Fresh subagent and one Codex round (regression fix): both found that a size before "RAM 8GB" / "SSD" / "ROM" was lost, and the subagent that "Tr", "k", "đ" were too short as units. Fixed: RAM only guards when no RAM size follows, SSD/HDD/ROM and the short units dropped; fixtures added (they key as on dev). Remaining P3 notes (unlikely forms such as "MacBook Pro M3 Sonoma 14", "14 Triệu", "13 năm sản xuất 2024") are accepted.

Checks

pnpm --filter @repo/crawlers test, typecheck, lint, prettier: green locally.

🤖 Generated with Claude Code

…s names and amounts are no size

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:49pm 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 46 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: 43a8a672-cc5a-4234-8d1b-7f6cb6a664c3
Commits

Reviewing files that changed from the base of the PR and between b1fd90d and ce96352.

Files selected for processing: 2
  • apps/importer/src/shopee/__tests__/open-core-intelligence.test.ts
  • apps/importer/src/shopee/product-normalizer.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 (2 eligible files · 6,148 chars · 1 model call(s) · 1 PR unit(s))

Whole diff with bounded context at base 4eca23d / head 2e01b9d.

✅ CLEAN_PASS: Complete diff reviewed

…'s; no short price units

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 (2 eligible files · 7,019 chars · 4 model call(s) · 1 PR unit(s))

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

✅ 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) changed the title fix(normalizer): a size before "năm <year>" is kept; dates, ram, macos names and amounts are no size fix(normalizer): keep the size before năm <year>; dates and units are not sizes (#1317) Oct 29, 2026
@JOY
JOY (JOY) merged commit 5b4ee2c into dev Oct 29, 2026
23 checks passed
@JOY
JOY (JOY) deleted the fix/1317-size-year-regression branch October 29, 2026 00:57

This branch was successfully deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(normalizer): size followed by năm <year> loses the size (regression from #1291)

1 participant