Skip to content

refactor(shared-data): one source for the bait-price rule and listing price floor #1089

Closed

Description

@JOY

Problem

Price rules are implemented more than once, and the copies drift (architecture review, P2):

  • Bait price (below 40% of the lower median of the other listings, at least 3 priced listings): apps/web/src/lib/offer-plausibility.ts, plus SQL in DOS-Me 20261024060000_rate_master_min_price_plausible.sql. Rate-Services job-seeder.ts uses its own rule: 50% of the true median, 2 others.
  • Device / earbuds price floor: web apps/web/src/server/rate/extension.ts uses 1.2M / 400k VND. Rate-Services search-discovery.ts uses 800k / 400k with a narrower earbuds regex.
  • 1B VND ceiling: MAX_VALID_VND_PRICE in shared-data, MAX_PLAUSIBLE_VND_PRICE in web, and another copy in Rate-Services.

None of the rules lives in @repo/shared-data, the package Rate-Services already consumes through vendor/rate.

Task (this issue: no behaviour change)

  • Move the bait-price rule and the listing price floor into a browser-safe subpath, @repo/shared-data/rules, with one 1B VND ceiling.
  • Make web use it.
  • Aligning Rate-Services' own thresholds (800k vs 1.2M, 0.5 vs 0.4) changes crawler behaviour and is left for a follow-up.

Metadata

Metadata

Assignees

Labels

agent:guardClaimed by Agent: Guardstatus:doneTask completed and verified

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions