thread-master/docs/product/opportunity-inbox/tasks/T872-race-retry-duplicate-c...

1.7 KiB
Raw Permalink Blame History

T872 — race retry and duplicate charge regression

Status: done2026-08-11 Milestone: M7 Est. change: ~190 lines

Goal

完成後多 worker、provider retry、HTTP retry、跨 watchquery、產品改名改痛點都證明不重建、不重判、不重扣。

Depends on

  • T852、T853、T861、T871

Inputs

  • apps/backend/internal/module/radar/repository/**product**_test.go
  • apps/backend/internal/module/radar/usecase/**_test.go
  • Spec §5.3、驗收 #16#22

Outputs

程式變更(預期路徑)

路徑 動作 說明
apps/backend/internal/module/radar/usecase/opportunity_inbox_race_test.go add workerjobprovider race matrix
apps/backend/internal/module/radar/repository/opportunity_inbox_race_test.go add tombstonejudgment uniqueness
apps/backend/internal/module/usage/**_test.go edit usage idempotency assertion

行為變更

  • duplicate_judgment_or_charge_count 必須為 0產品只改名稱不改 input version實質改痛點才開新版本。

API / 契約(若有)

  • Redis lock value、guarded job status、usage source 與唯一鍵符合 spec。

Out of scope

  • 不提高並行數、不做壓力測試平台建置。

Acceptance

  • race test 綠;重跑只處理未完成候選。
  • 同候選 acceptedrejected 不多扣invalid AI 不留有效 cache。
  • 指令:
cd apps/backend && go test ./internal/module/radar/... ./internal/module/usage/... -race -run 'Inbox|Duplicate|Meter|Sweep' -count=1

Notes

若與 brand-product-radar T774 重疊,保留一份測試並在另一 INDEX 交叉引用。