Skip to content

fix(importer): watch band size range or list before the band keys size-less - #1183

Merged
JOY (JOY) merged 3 commits into
devfrom
core-1162-watch-band-range
Oct 28, 2026
Merged

JOY (JOY) merged 3 commits into
devfrom
core-1162-watch-band-range

Conversation

@JOY

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

Copy link
Copy Markdown
Contributor

Closes #1162

What

readAppleSize (Watch branch) no longer reads band sizes as the case size in two shapes:

  • A band size range: a band phrase that ends in a size, then " - " or an en dash, then a bare size (Sport Loop 42mm - 46mm).
  • Two or more sizes listed right before a band word (GPS 40mm, 44mm Dây Sport Band), joined by ,, |, " - " or an en dash.

Both key size-less. Kept as the case size:

  • a dashed size with more text after it (normalizer: a Watch band's size can key a watch title (follow-up to #1113) #1124 Dây Vải 45mm - 46mm GPS stays -46mm, so that fixture is unchanged);
  • a single size before the band (GPS 46mm, Dây Cao Su 46mm S/M, GPS, 44mm Dây Sport Band);
  • a size whose part names the case (Vỏ nhôm 46mm, 42mm Dây, (Vỏ nhôm) 46mm, 42mm Dây, 42mm Dây Sport Band mặt 46mm);
  • a size followed by a band of its own (GPS 46mm Dây Sport Band, 42mm Dây Cao Su).

A range continues from a listed size only when that size is bare (42mm S/M, 44mm - 46mm is size-less; 42mm, 44mm M/L - 46mm keeps -46mm).

Fixtures

New watchBandRangeKeys1162 in open-core-intelligence.test.ts (16 titles). appleSizeKeys1113, watchBandSizeKeys1124 and watchBandListKeys1137 are unchanged and pass. The two issue titles fail on dev (mutation-checked). item-matcher.test.ts (#1151) passes; item_key follows model_key for every changed title.

Keys that change (before -> after), for the Rate Services PO

Corpus: 129 titles = every "Watch Series/SE" literal in Core apps/packages and Rate-Services src/scripts (origin/main, read-only), plus the issue titles and probe titles. No title from either repo changes. Only these issue/probe titles change:

Title Before After
Apple Watch Series 10 Sport Loop 42mm - 46mm watch-series-10-46mm watch-series-10
Apple Watch Series 10 Sport Loop 42mm – 46mm watch-series-10-46mm watch-series-10
Apple Watch SE 3 GPS 40mm, 44mm Dây Sport Band watch-se-3-40mm watch-se-3
Apple Watch Series 10 GPS 42mm, 46mm Dây Cao Su watch-series-10-42mm watch-series-10
Apple Watch Series 10 GPS, 42mm, 46mm Dây Sport Loop watch-series-10-42mm watch-series-10
Apple Watch Series 10 GPS 46mm - 42mm Dây Sport Band watch-series-10-46mm watch-series-10
Apple Watch Series 10 Sport Band 42mm S/M, 44mm - 46mm watch-series-10-46mm watch-series-10

(model_key and item_key change the same way; storage part unchanged.)

Review gate

  • Fresh-context subagent: no P0/P1; two P2 (a size with its own band phrase cleared as a list head; a case word before ")" ignored by the walk-back). Fixed in 004007b with fixtures.
  • Codex: two P1 (range state not updated over a skipped list item; walk-back ran when the band part names the case). Fixed in 99800ec with fixtures.
  • Residuals (P3, same as dev, not regressions): English band phrases without "Dây" before a size list (GPS 42mm, 46mm Sport Loop keys 42mm, since "Sport" sits between the size and "Loop"); other list separators (40mm/44mm Dây, 40mm & 44mm Dây, 42mm; 46mm Dây); Sport Loop 42 - 46mm (no "mm" on the first size).

Checks: apps/importer npm test, tsc --noEmit, eslint --max-warnings 0 green locally.

🤖 Generated with Claude Code


📌 TL;DR

This PR refines the Apple Watch product normalizer to correctly distinguish between case sizes and band size ranges (e.g., "42mm - 46mm" or "40mm, 44mm") in product titles, preventing false positives where band dimensions are misidentified as the watch case size.

🎯 Type of Change

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

🔍 Changes Walkthrough

File Summary of Changes
apps/importer/src/shopee/__tests__/open-core-intelligence.test.ts Added comprehensive test cases for DOS/Rate#1162 covering edge cases where band size ranges (using en-dashes, pipes, or commas) and multiple listed sizes before a band word should resolve to unknown case size, while specific case sizes remain correctly identified.
apps/importer/src/shopee/product-normalizer.ts Updated the readAppleSize logic to detect band size ranges and lists. Introduced new regexes (LONE_WATCH_SIZE, LAST_WATCH_SIZE, WATCH_RANGE_SEP) and modified the parsing loop to "walk back" over listed sizes preceding a band word, effectively masking them as band attributes rather than case attributes.

📊 Architectural Flow

flowchart TD
    A[Product Title] --> B[Split by Separators<br/>, | ; - –]
    B --> C{Iterate Parts}
    C --> D{Is Part a Band Word?}
    D -- No --> E[Check if Part is Listed Size]
    E --> F[Accumulate in 'outside' array]
    F --> C
    D -- Yes --> G{Walk Back Logic}
    G --> H{Are preceding parts<br/>Lone Sizes with List Separators?}
    H -- Yes --> I[Mask preceding sizes as Band Attributes]
    I --> J[Set 'outside' entries to empty string]
    H -- No --> K[Keep preceding sizes as Case Candidates]
    J --> L[Append current part's pre-band text]
    K --> L
    L --> M[Update bandList/bandEnd flags]
    M --> C
    C --> N[Join 'outside' array]
    N --> O[Extract Case Size via WATCH_SIZE]
    O --> P[Return Normalized Size or 'unknown']
Loading

JOY (JOY) and others added 3 commits October 28, 2026 14:11
…e-less

A band size range written with " - " or an en dash between two bare sizes
("Sport Loop 42mm - 46mm"), and two or more sizes listed right before a band
word ("GPS 40mm, 44mm Dây Sport Band"), name the band's sizes, not the case.
Both now key size-less. A dashed size with more text after it, a single size
before the band and a part that names the case keep their key.

Closes #1162

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he watch case size

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g the case keeps it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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:21am UTC

Request Review

@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.

@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 55 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: d0016b0d-8684-42df-b2ad-4d3f48d408d5
Commits

Reviewing files that changed from the base of the PR and between 7d106f2 and 99800ec.

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 · 7,353 chars · 3 model call(s) · 1 PR unit(s))

Whole diff with bounded context at base 7d106f2 / head 99800ec.

✅ CLEAN_PASS: Complete diff reviewed

Context investigation was bounded to the explicitly requested snapshot paths.

@JOY
JOY (JOY) merged commit df1ef75 into dev Oct 28, 2026
19 checks passed
@JOY
JOY (JOY) deleted the core-1162-watch-band-range branch October 28, 2026 07:27

This branch was successfully deployed

1 active deployment
Preview — 99800ec6 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.

Watch key: a band size range with " - " or a size list before the band word reads as the case size (follow-up to #1137)

1 participant