Skip to content

fix(shared-data): EARBUDS_TITLE_REGEX misses glued tiers and wrongly matches over-ear WH- headphones #1116

Closed

Description

@JOY

Follow-up of #1092 (the regex that #1092 introduced). Raised from DOS/Rate-Services#646 after Rate-Services#644 bumped vendor/rate to 8d0f960f. Both defects are in packages/shared-data/src/rules/listing-price-floor.ts (EARBUDS_TITLE_REGEX), reproduced against that exact commit. No production effect seen so far.

1. Glued tiers miss the regex (earbuds get the 1.2M device floor)

minimumListingPriceVnd([title]) returns 1_200_000 instead of 400_000 for:

Title Why it misses
Samsung Galaxy BudsPro3 a number follows the tier (buds + pro + 3), so the trailing \b fails
Huawei FreeBudsPro4 same, after freebuds
SamsungGalaxyBuds3 Buds is glued to Galaxy, so the leading \b fails

Effect: a real earbuds listing of 400k-1.2M VND is rejected as an accessory when the caller has no earbuds target key (Rate-Services discovery passes target keys, which do match, so masters keep their hits today).

2. wh- makes over-ear headphones take the earbuds floor

Sony WH-1000XM5 and Sony WH-CH720N are over-ear headphones, not earbuds, yet both match wh- and get 400_000. A 450k listing of a 6M headphone is then not rejected by price. Rate-Services only has the median guard (DISCOVERY_MIN_MARKET_PRICE_RATIO) as a backstop, and that needs a master median.

(tws, earpods, soundpeats, in-ear are also new in the wider regex and are legitimately earbuds, so keep them.)

Proposed change

Drop wh-, allow digits after a tier, accept galaxybuds glued to a brand word, allow pro/se after freebuds:

export const EARBUDS_TITLE_REGEX =
  /(?:\b(?:airpods(?:\d+|pro|max)?|earpods|buds\d*(?:pro|fe|live|core|plus)?\d*|freebuds\d*(?:pro|se)?\d*i?|soundpeats|wf-|wf1000xm\d+|tws|tai[\s_-]*nghe|earbuds|in[\s_-]*ear)|galaxybuds\d*(?:pro|fe|live|core|plus)?\d*)\b/i;

Test cases (expected floor)

Earbuds (400_000): Samsung Galaxy BudsPro3, Samsung Galaxy Buds Pro 3, Huawei FreeBudsPro4, Huawei FreeBuds5i, Huawei FreeBuds 5i, SamsungGalaxyBuds3, Galaxy Buds3 Pro, Galaxy Buds2Pro, Sony WF-1000XM5, Apple AirPods Pro 2, AirPodsPro.

Device (1_200_000): Sony WH-1000XM5, Sony WH-CH720N, Samsung Galaxy S24, Galaxy Watch7, Samsung Galaxy Z Flip, Buddha statue.

All 17 pass with the proposed regex (checked with a standalone node script); the current regex fails the first three earbuds rows of item 1 plus the two WH- rows.

Acceptance

  • Add the cases above to the listing-price-floor unit test.
  • Bump vendor/rate in Rate-Services afterwards (no Rate-Services code change needed, it imports the shared regex).

Activity

  1. added
    bugSomething isn't working
    area:sharedShared packages / contracts / configs
    status:readyTask ready to be picked up by an Agent
    status:in-progressTask currently claimed and being worked on by an Agent
    and removed
    status:readyTask ready to be picked up by an Agent
    on Oct 27, 2026
  2. self-assigned this
    on Oct 27, 2026
  3. JOY commented on Oct 27, 2026

    @JOY
    ContributorAuthor

    [Agent: Core] Claiming this. I will verify the proposed regex against the 17 cases and the existing tests, then open a PR into dev that lists the Rate-Services pins it could affect.

  4. added
    status:in-reviewTask completed and waiting for review / PR merge
    and removed
    status:in-progressTask currently claimed and being worked on by an Agent
    on Oct 27, 2026
  5. added
    status:doneTask completed and verified
    and removed
    status:in-reviewTask completed and waiting for review / PR merge
    on Oct 27, 2026
  6. JOY commented on Oct 27, 2026

    @JOY
    ContributorAuthor

    [Agent: PO] Released to production in #1128 (main c23ab85). verify-live: https://rate.vn serves main c23ab85, database ok, 5 routes 200.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent:corearea:sharedShared packages / contracts / configsbugSomething isn't workingstatus:doneTask completed and verified

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions