Skip to content

feat(web): add 30-day EU Omnibus price-floor audit and buy-vs-wait signal #1863

Description

@JOY

Goal

Implement Package 8A Feature F1 (approved by JOY on 2026-11-22 from Docs/Proposals/2026-11-22-de-xuat-tinh-nang-moi-phase-8.html): expose a transparent 30-day pre-discount floor audit inspired by Hlidac shopu / EU Omnibus Directive Article 6a alongside a 90-day percentile Buy-Now vs Wait-for-Sale indicator across rate.vn product price history, /inspect, and /deals with zero database migrations.

Requirements

  1. Pure Omnibus 30-Day Floor & 90-Day Percentile Engine (apps/web/src/lib/omnibus-price-audit.ts):
    • Given an item or listings price_history points, current selling price, and merchant-claimed strikethrough original_price:
      • Compute prior30dMinPrice and real discount/markup delta vs the 30-day prior floor.
      • Strict window honesty: Label as 30-day Omnibus floor ONLY when valid observed history spans at least 30 full days prior (observedSpanDays >= 30) without disqualifying gaps; when observedSpanDays < 30, report the exact observed window (N-day observed floor) and never claim 30-day Omnibus certification or violation.
      • Compute the 90-day price-cycle percentile indicator when sufficient valid points exist: <= P15 (buy_now_floor - near 90d low), P15..P70 (fair_market - stable range), > P70 (above_recent_floor - elevated vs recent low, show VND gap above floor).
      • Exclude unavailable and bait-price points consistently with offer-plausibility / deal-radar.
  2. UI Surfaces (PriceHistorySection.tsx, InspectWorkspace.tsx, DealFinderWorkspace.tsx):
    • Render the 3-column Omnibus Price Truth card (Current vs Claimed List Price, 30-Day Prior Real Floor, 90-Day Cycle Signal) in PriceHistorySection.tsx and /inspect.
    • Add quick seasonal sale filter chips on /deals (DealFinderWorkspace.tsx) to filter genuine floor deals vs pre-sale inflated strikethrough listings across all 22 retail platforms.
  3. Localization (vi, en, cs):
    • Localize all copy in apps/web/locales/{vi,en,cs}.json strictly under namespaces "deals", "inspect", and "priceVerdict" with 100% key parity across vi, en, and cs.

Approach

Build a pure, deterministic TypeScript module in apps/web/src/lib/omnibus-price-audit.ts (zero LLM calls, zero DB DDL, reusing cached price_history and offer payloads), wire it into PriceHistorySection.tsx, InspectWorkspace.tsx, and DealFinderWorkspace.tsx, and add comprehensive unit tests in apps/web/src/lib/__tests__/discount-verdict-copy.test.ts and sale-state.test.ts.

Acceptance

  • 30-day Omnibus floor is certified only when observed history covers >= 30 days; shorter histories display exact observed days honestly.
  • Fake pre-sale strikethrough markups (where claimed original_price exceeds prior30dMinPrice while current price is equal or higher than prior30dMinPrice) are clearly exposed with exact VND / percentage deltas.
  • 90-day Buy-Now / Fair-Market / Wait signal renders cleanly in vi, en, and cs with WCAG 2.1 AA contrast (>= 4.5:1).
  • Zero DB DDL changes; full monorepo typecheck, lint, test, build, and Playwright E2E pass.

Files

  • apps/web/src/lib/omnibus-price-audit.ts
  • apps/web/src/components/reviews/PriceHistorySection.tsx
  • apps/web/src/components/deals/DealFinderWorkspace.tsx
  • apps/web/src/components/inspect/InspectWorkspace.tsx
  • apps/web/locales/{vi,en,cs}.json ("deals", "inspect", "priceVerdict" namespaces only)
  • apps/web/src/lib/__tests__/discount-verdict-copy.test.ts
  • apps/web/src/lib/__tests__/sale-state.test.ts

Activity

  1. added
    featureNew feature or enhancement
    status:readyTask ready to be picked up by an Agent
    po:antigravityDispatched by the Antigravity Product Owner
    on Nov 22, 2026
  2. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    🔒 [Agent: Core] Claim lock refs/claims/1863 taken by claimant antigravity:0bf51a92-7798-4214-9d8f-7dc9804217b4 (Status: in-progress).

  3. added
    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 Nov 22, 2026
  4. self-assigned this
    on Nov 22, 2026
  5. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    [Agent: Core] Claimed #1863 (, Status: Ready -> In Progress) on branch feat/1863-omnibus-price-audit.

  6. 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 Nov 22, 2026
  7. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    [Agent: Core] Implementation complete, 2 independent fresh-context reviews completed with all Round-1 findings fixed, and local test / typecheck / lint / build passing. Moving status to In Review (PR: #1869, Commit: a2aa78ef).

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

Metadata

Metadata

Assignees

Labels

agent:corearea:webfeatureNew feature or enhancementpo:antigravityDispatched by the Antigravity Product Ownerstatus:in-reviewTask completed and waiting for review / PR merge

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions