Repository navigation
fix(importer): watch band size range or list before the band keys size-less - #1183
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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.
|
Warning Review limit reachedYou'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. View limit details
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. Comment |
Closes #1162
What
readAppleSize(Watch branch) no longer reads band sizes as the case size in two shapes:Sport Loop 42mm - 46mm).GPS 40mm, 44mm Dây Sport Band), joined by,,|, " - " or an en dash.Both key size-less. Kept as the case size:
Dây Vải 45mm - 46mm GPSstays-46mm, so that fixture is unchanged);GPS 46mm, Dây Cao Su 46mm S/M,GPS, 44mm Dây Sport Band);Vỏ nhôm 46mm, 42mm Dây,(Vỏ nhôm) 46mm, 42mm Dây,42mm Dây Sport Band mặt 46mm);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 - 46mmis size-less;42mm, 44mm M/L - 46mmkeeps-46mm).Fixtures
New
watchBandRangeKeys1162inopen-core-intelligence.test.ts(16 titles).appleSizeKeys1113,watchBandSizeKeys1124andwatchBandListKeys1137are unchanged and pass. The two issue titles fail ondev(mutation-checked).item-matcher.test.ts(#1151) passes;item_keyfollowsmodel_keyfor every changed title.Keys that change (before -> after), for the Rate Services PO
Corpus: 129 titles = every "Watch Series/SE" literal in Core
apps/packagesand Rate-Servicessrc/scripts(origin/main, read-only), plus the issue titles and probe titles. No title from either repo changes. Only these issue/probe titles change:Apple Watch Series 10 Sport Loop 42mm - 46mmwatch-series-10-46mmwatch-series-10Apple Watch Series 10 Sport Loop 42mm – 46mmwatch-series-10-46mmwatch-series-10Apple Watch SE 3 GPS 40mm, 44mm Dây Sport Bandwatch-se-3-40mmwatch-se-3Apple Watch Series 10 GPS 42mm, 46mm Dây Cao Suwatch-series-10-42mmwatch-series-10Apple Watch Series 10 GPS, 42mm, 46mm Dây Sport Loopwatch-series-10-42mmwatch-series-10Apple Watch Series 10 GPS 46mm - 42mm Dây Sport Bandwatch-series-10-46mmwatch-series-10Apple Watch Series 10 Sport Band 42mm S/M, 44mm - 46mmwatch-series-10-46mmwatch-series-10(
model_keyanditem_keychange the same way; storage part unchanged.)Review gate
dev, not regressions): English band phrases without "Dây" before a size list (GPS 42mm, 46mm Sport Loopkeys 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/importernpm test,tsc --noEmit,eslint --max-warnings 0green 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
🔍 Changes Walkthrough
apps/importer/src/shopee/__tests__/open-core-intelligence.test.tsDOS/Rate#1162covering edge cases where band size ranges (using en-dashes, pipes, or commas) and multiple listed sizes before a band word should resolve tounknowncase size, while specific case sizes remain correctly identified.apps/importer/src/shopee/product-normalizer.tsreadAppleSizelogic 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']