fix(sync): 固化 release flow 状态码

This commit is contained in:
2026-07-31 15:57:07 +08:00
parent 99e6b3a23a
commit 4cc143f66d
12 changed files with 619 additions and 36 deletions
+15 -1
View File
@@ -118,6 +118,15 @@ SQLite `ResourceRepository`,索引不存在时返回 `ok=true` 且
`text_unit_error_count` 等字段。旧索引库会通过 `metadata_json` 迁移列得到
默认空 metadata。
`resource.state``catalog.status``parse.status``localized.status`
都会返回当前观察面的短状态 `status` 与稳定状态码 `status_code``status_code`
使用命名空间格式,例如 `official.up_to_date``official.published`
`parse.completed``translation.queued_offline``localized.published`
`distribution.ready`。这些状态码描述资源/解析/翻译 handoff/汉化/分发生命周期;
失败原因仍使用 `BAT-ERR-*` 错误码,二者不混用。响应还会包含
`status_phase``status_terminal``status_retryable`,供 `bat-api` 等读侧
决定展示、重试或 readiness。
官方资源完整新版本发布后,Rust 侧会先比较上一完整 release 与当前 release
的 download manifest,并在当前 release 根目录写出:
@@ -151,7 +160,9 @@ SQLite `ResourceRepository`,索引不存在时返回 `ok=true` 且
`textunit_index_available=true``textunit_index_path`
`textunit_index_summary`;存在 `official-textunit-tasks.json` 时,响应会包含
`textunit_queue_available=true``textunit_task_queue_path`
`textunit_task_summary`
`textunit_task_summary`当 TextUnit 队列存在且有离线任务时,
`translation_status_code=translation.queued_offline`;真实 Crowdin worker
尚未接入时不会返回翻译完成状态。
`parse.text_units` / `parse.errors` 是只读查询;没有当前 release 或没有
`official-textunit-index.json` 时返回 `ok=true``data.available=false`
@@ -202,6 +213,9 @@ offset 和 error。TypeTree-covered managed reference 字段会进入结构化
| `catalog.refresh` | 已实现 | `{ "force": false }` | `{ "task_id": "...", "kind": "catalog.refresh" }`。 |
只读查询在没有可用版本时返回 `ok=true``data.available=false`
`catalog.status` 可用时会返回 `status_code=official.published`,并用
`distribution_status_code=distribution.ready` 表示该官方 release 可被读侧分发;
不可用时对应 `official.unavailable` / `distribution.blocked`
### task