thread-master/docs/product/scout-topic-quality/tasks/T011-web-scout-memory-repo.md

1.4 KiB
Raw Blame History

T011 — 前端 in-memory Scout repository

Status: done Milestone: M1 Est. change: ~190 lines

Goal

完成後測試Phase B 可用 in-memory ScoutRepo 驗證每次掃描獨立 run、後端同形分頁與穩定 score 排序。

Depends on

  • T010

Inputs

  • 讀取 / 依賴:
    • 檔案:apps/web/src/data/repos.tsapps/web/src/test/scoutFixtures.ts
    • 既有能力 / APIScoutRepo、新 ID helper
    • Spec 段落§4 流程 A/D/E、§5.2

Outputs

程式變更(預期路徑)

路徑 動作 說明
apps/web/src/data/mock/scoutRepo.ts add 實作 run 建立、run/result paging、score 主排序、計數與 removeRun。
apps/web/src/data/mock/scoutRepo.test.ts add 驗證同 theme 多 run、未知時間置底與獨立分頁。

行為變更

  • 相同 theme 每次 run ID 不同;刪除 run 不刪 homework。

API / 契約(若有)

  • 方法與 live ScoutRepo 完全同形;錯誤以 reject 表示,不回成功空資料。

Out of scope

  • 不重新引入全站 runtime mock 切換,不實作外部搜尋。

Acceptance

  • 兩次相同 theme scan 能保留兩批結果,跨頁 unique count 等於 total。
  • 指令:
cd apps/web && npm test -- src/data/mock/scoutRepo.test.ts

驗收結果3 tests passed。

Notes

此 repository 是契約 doubleapp 仍維持既有 live data source。