feat(mobile): drift upload task store with state machine

- upload_tasks 表(accountId 隔离 + 三个复合索引)、状态列枚举转换器、
  datetime 文本落库(UTC 归一,亚秒精度)
- 纯状态机(task_state.dart):合法迁移表 + canTransition/assertTransition,
  completed/cancelled 终态
- TaskStore 仓储:create(clientTaskId 同账号同相册应用侧唯一)、
  updateState(迁移守护+旁路字段)、账号隔离读路径(硬守护)、
  countsByState 徽章、cleanupCandidates/markCleanable(仅终态可清理——
  评审缺口 1 硬守护,未完成源文件永不清理)
- 测试 26 例(状态机表驱动全边 + 守护/隔离/筛选/保留策略);
  sqlite3 3.x build hooks 在 flutter test 宿主与 Android APK 构建均验证
  (libsqlite3.so 已打包全 ABI,运行时验证留 Task 11)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-19 02:12:39 +08:00
parent bbea1dd364
commit d96e56f653
7 changed files with 2800 additions and 2 deletions
+2 -2
View File
@@ -44,8 +44,8 @@
## Task 5: 上传域模型与本地任务库(drift)
- [ ] drift schema:upload_tasks(id uuid、accountId 隔离键、albumId、categoryId、clientTaskId、源文件路径(受管目录 copy)、filename/bytes/contentType、state 状态机 preparing/preparation_failed/queued/uploading/uploaded-confirming/completed/waiting_network/retryable_failed/cancelled、attempt/nextRetryAt、serverSessionId/photoId、createdAt/updatedAt、账号切换过滤=accountId 索引)
- [ ] 状态机单测(合法迁移表驱动;账号隔离查询;任务保留策略=completed 仅可清理标记)
- [x] drift schema:upload_tasks(id uuid、accountId 隔离键、albumId、categoryId、clientTaskId、源文件路径(受管目录 copy)、filename/bytes/contentType、state 状态机 preparing/preparation_failed/queued/uploading/uploaded-confirming/completed/waiting_network/retryable_failed/cancelled、attempt/nextRetryAt、serverSessionId/photoId、createdAt/updatedAt、账号切换过滤=accountId 索引)
- [x] 状态机单测(合法迁移表驱动;账号隔离查询;任务保留策略=completed 仅可清理标记)
- [ ] Commit `feat(mobile): drift upload task store with state machine`
## Task 6: 上传引擎(Dart 侧)