mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-22 01:15:14 +08:00
feat: track official versions and import resources
Persist official version-state, extend CAS/ResourceRepository import classification, and add offline catalog and failure regression fixtures. Fixes #13 Fixes #12 Fixes #8
This commit is contained in:
@@ -238,6 +238,9 @@ Linux 生产路径:
|
||||
- `OfficialUpdateService` 能持久化 v2 snapshot,并在远端 marker 内容变化时触发下载决策
|
||||
- `bat` 默认向 stderr 输出 `BlueArchiveToolkit` ASCII banner 和 progress log,stdout 默认输出人类可读摘要;progress log 覆盖总体下载进度、单文件开始/完成状态、下载中断失败分类和校验结果摘要;支持 `--json` 输出稳定 JSON,支持 `--no-progress` 关闭进度日志,支持 `--no-banner` 只关闭横幅,支持 `--watch --interval 1h --error-retry 60s` 常驻运行,支持 `--daemon` Unix socket JSON-RPC 控制、`status`、`stop`、`restart`、`reload`、`logs`、`refresh --force`、`verify`、`repair`、`doctor`、`clean-stable`,非 dry-run 使用 `.official-sync.lock` 防止并发写资源目录,控制命令使用 `bat-control.lock` 防止并发状态修改,资源发布使用 `.staging`、`versions` 和 `current` 原子切换,daemon 写 `bat-events.jsonl` 结构化日志并在 `status` 中暴露下载进度、失败类型、HTTP 状态和调度状态
|
||||
- curl 失败分类和重试策略已覆盖 404 不重试、5xx 重试耗尽后 quarantine、launcher primary CDN 失败后切换 official backup CDN
|
||||
- `official-version-state.json` 已覆盖当前完成版本、正在拉取版本、上一个可用版本和失败版本,`bat status` 会暴露版本状态摘要
|
||||
- 资源导入链路已覆盖 CAS 写入、`ResourceRepository` 索引、AssetBundle UnityFS 摘要,以及 TextAsset/Table/Media 分类
|
||||
- 离线回归样本已覆盖当前 catalog、上一个版本 catalog、catalog 结构变化、403、404 和 seed hash mismatch
|
||||
- `OfficialUpdateService` 能读写 `official-bootstrap-cache.json`,并支持默认开启的 `audit_local` / `repair` CLI 行为
|
||||
- 下载层能在本地文件 size/BLAKE3/path、ZIP 结构或 manifest 不匹配时重新下载
|
||||
- 官方 seed `.hash` mismatch 会导致下载失败,而不是降级为本地 BLAKE3 猜测
|
||||
|
||||
@@ -161,6 +161,7 @@ cargo run -p bat-infrastructure --example official_pull_plan -- \
|
||||
- 旧 launcher 包或 `resources.assets` 下载路径使用官方 launcher CDN 配置,primary CDN 失败后会切换官方 backup CDN;资源 patch host 当前只使用 server-info 返回的官方 client-patch host,不猜测非官方镜像。
|
||||
- 远端和本地都一致:单次模式输出 `update_status=up_to_date`,watch 模式默认静默并等待下次检查。
|
||||
- 有远端变化或本地 repair:生成 pull plan,下载完整官方资源到 staging,成功后更新 snapshot 并原子发布到 `current`。
|
||||
- 非 dry-run 会维护 `<output>/official-version-state.json`:开始下载后写入 `in_progress_version`,发布成功后写入 `current_completed_version` 和 `previous_available_version`,失败或中断后写入 `failed_versions`。
|
||||
- `--dry-run`:只报告本次是否会下载,不写 snapshot;如果 cache miss,也不会写入新的 bootstrap cache。
|
||||
- `--dry-run --plan`:除更新判断外,还会解析 seed catalog 并打印完整下载 URL。
|
||||
- 真实更新会输出 `downloaded_count`、`resumed_count`、`skipped_count`、`transferred_bytes`、`official_seed_hash_verified_count`。
|
||||
@@ -171,6 +172,7 @@ cargo run -p bat-infrastructure --example official_pull_plan -- \
|
||||
|
||||
- `<output>/current/official-sync-snapshot.json`:上一次成功同步的 v2 snapshot,包含 app version、connection group、bundle version、addressables root、endpoint URL、官方 seed `.hash` 内容、Addressables `catalog_*.hash` marker、launcher metadata 摘要和 `GameMainConfig` 摘要。
|
||||
- `<output>/official-bootstrap-cache.json`:`--auto-discover` 的 `GameMainConfig` 解析缓存。launcher metadata 未变时复用缓存;metadata 变化时才通过官方 HTTP 按 manifest 下载必要 `resources.assets` 或旧版 game zip 到临时目录解析。
|
||||
- `<output>/official-version-state.json`:资源发布根目录的持久版本状态,包含当前已完成版本、正在拉取版本、上一个可用版本和失败版本。
|
||||
- `<output>/current/official-download-manifest.json`:本地下载强校验清单,记录 URL、相对路径、size 和 BLAKE3。
|
||||
- `<output>/current/official-download-quarantine.json` 或当前 staging 下同名文件:下载最终失败的 URL 诊断记录,包含失败类型、HTTP 状态、是否可重试、尝试次数和最后错误。
|
||||
|
||||
|
||||
@@ -228,7 +228,8 @@
|
||||
影响:
|
||||
|
||||
- `SqliteResourceRepository` 已存在,可按领域 repository 接口保存资源元数据。
|
||||
- 官方同步下载结果尚未作为用户级流程自动写入 CAS + ResourceRepository。
|
||||
- `ResourceImportService` 已能把 manifest 中有数据的资源写入 CAS + `ResourceRepository`,AssetBundle 会记录 UnityFS 摘要,TextAsset/Table/Media 会分类索引。
|
||||
- 官方同步下载结果尚未作为用户级流程自动触发导入 CAS + ResourceRepository。
|
||||
- 迁移、版本化 schema 和 CLI 查询入口仍需补齐。
|
||||
|
||||
验收:
|
||||
@@ -237,6 +238,75 @@
|
||||
- 可按版本、类型、hash、路径查询资源。
|
||||
- 官方同步后的资源可通过 CLI 查询并能追溯到 CAS 对象。
|
||||
|
||||
### G-011A:资源导入链路基础能力不足
|
||||
|
||||
状态:**已关闭**
|
||||
|
||||
历史现象:
|
||||
|
||||
- 资源导入链路只导入 AssetBundle。
|
||||
- 非 AssetBundle manifest 条目只会被跳过。
|
||||
- 导入报告只包含 UnityFS 基础摘要,不包含稳定分类统计。
|
||||
|
||||
处理结果:
|
||||
|
||||
- `ResourceImportService` 会把有数据的 manifest 条目导入 CAS 并写入 `ResourceRepository`。
|
||||
- AssetBundle 仍执行 UnityFS header/block/directory 摘要解析。
|
||||
- TextAsset、TableBundle、Media 会按资源类型分类,缺少数据时记录为 skipped,便于渐进导入。
|
||||
- `ResourceImportReport` 增加 `category_counts`,`ImportedResource` 增加 `resource_type`、`category` 和可选 UnityFS 摘要。
|
||||
|
||||
验收:
|
||||
|
||||
- `cargo test -p bat-infrastructure import::tests::`
|
||||
- `cargo test -p bat-infrastructure --test synthetic_phase2_import`
|
||||
|
||||
### G-011B:官方版本状态管理不明确
|
||||
|
||||
状态:**已关闭**
|
||||
|
||||
历史现象:
|
||||
|
||||
- 当前可用版本主要靠 `current` symlink 和 release 内 snapshot 推断。
|
||||
- 未显式保存“正在拉取版本”和“失败版本”。
|
||||
- 上一个可用版本需要从目录状态间接判断。
|
||||
|
||||
处理结果:
|
||||
|
||||
- 新增 `<output>/official-version-state.json`。
|
||||
- 开始下载后写入 `in_progress_version`。
|
||||
- 发布成功后写入 `current_completed_version` 和 `previous_available_version`。
|
||||
- 失败或中断后写入 `failed_versions` 并清空 in-progress。
|
||||
- `bat status` 会读取并展示版本状态摘要。
|
||||
|
||||
验收:
|
||||
|
||||
- `cargo test -p bat-infrastructure version_state`
|
||||
- `cargo test -p bat-infrastructure --test official_game_main_config_bootstrap`
|
||||
|
||||
### G-011C:真实 fixture 与回归样本不足
|
||||
|
||||
状态:**已关闭当前阶段**
|
||||
|
||||
历史现象:
|
||||
|
||||
- 已有 Addressables real-shape fixture/golden,但缺少按问题类型命名的当前/上一版本/结构变化样本。
|
||||
- 403/404 和 hash mismatch 主要依赖单测内联构造,不便于后续回归扩展。
|
||||
|
||||
处理结果:
|
||||
|
||||
- 新增 `adapters/tests/fixtures/addressables_regression/current_catalog.json`。
|
||||
- 新增 `adapters/tests/fixtures/addressables_regression/previous_catalog.json`。
|
||||
- 新增 `adapters/tests/fixtures/addressables_regression/structure_changed_catalog.json`。
|
||||
- 新增 `infrastructure/tests/fixtures/official_regression/http_403.json`。
|
||||
- 新增 `infrastructure/tests/fixtures/official_regression/http_404.json`。
|
||||
- 新增 `infrastructure/tests/fixtures/official_regression/hash_mismatch_catalog.json`。
|
||||
- 对应测试会解析这些 fixture,防止样本只存在但不参与验证。
|
||||
|
||||
验收:
|
||||
|
||||
- `cargo test -p bat-adapters --test addressables_regression`
|
||||
- `cargo test -p bat-infrastructure regression_fixture`
|
||||
|
||||
### G-012:Translation Memory 未实现
|
||||
|
||||
影响:
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
仍未完成:
|
||||
|
||||
- Go CLI 最小可用入口。
|
||||
- 官方同步下载结果自动导入 CAS + ResourceRepository 的用户级流程。
|
||||
- 完整 AssetBundle 解析。
|
||||
- 官方同步下载结果自动触发 CAS + ResourceRepository 导入的用户级流程。
|
||||
- AssetBundle 对象表、TypeTree 和 TextAsset 提取。
|
||||
- Patch、翻译系统、API Server、Web。
|
||||
|
||||
## 3. 当前核查结果
|
||||
@@ -64,11 +64,11 @@ git status --short
|
||||
|
||||
## 4. 当前结论
|
||||
|
||||
当前 Rust 官方资源同步链路已经具备可运行闭环,并已固化真实网络 smoke 的可重复命令,但仓库还不是完整产品。下一步不应继续只扩展 example,而应补齐 Go CLI 最小入口、CAS/ResourceRepository 编排和 AssetBundle 解析。
|
||||
当前 Rust 官方资源同步链路已经具备可运行闭环,并已固化真实网络 smoke 的可重复命令;版本状态、资源导入基础链路和离线回归 fixture 已补齐。但仓库还不是完整产品。下一步不应继续只扩展 example,而应补齐 Go CLI 最小入口、官方同步后自动导入编排和 AssetBundle 对象级解析。
|
||||
|
||||
## 5. 下一步
|
||||
|
||||
1. 实现 Go CLI:`bat doctor`、`bat sync --help`、`bat official sync --help`。
|
||||
2. 按 `docs/guides/official-full-pull-smoke.md` 在具备网络和磁盘窗口的环境中执行真实官方网络 smoke,输出目录必须隔离。
|
||||
3. 将官方同步下载结果接入 CAS + `SqliteResourceRepository`。
|
||||
4. 开始 AssetBundle UnityFS header/block/directory 解析。
|
||||
3. 将官方同步下载结果自动接入 CAS + `SqliteResourceRepository` 的用户级命令。
|
||||
4. 开始 AssetBundle 对象表、TypeTree 和 TextAsset 提取。
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 当前进度交接
|
||||
|
||||
- **更新时间**:2026-07-14
|
||||
- **更新时间**:2026-07-15
|
||||
- **状态分支**:`experiment`
|
||||
- **最新功能提交**:以当前 `git log --oneline -1` 为准
|
||||
- **用途**:给下一次对话快速恢复上下文,优先以当前工作区和已验证结果为准。
|
||||
@@ -23,6 +23,9 @@
|
||||
- `--watch` 是 Rust 内部常驻检查模式,正常检查默认 1 小时,失败重试默认 60 秒;外部 systemd/container 只负责守护进程。
|
||||
- `bat` progress log 会输出总体下载进度、单文件进度和校验结果摘要。
|
||||
- 真实官方网络 smoke 已固化为 `scripts/official-full-pull-smoke.sh`、`make official-smoke` 和 `docs/guides/official-full-pull-smoke.md`,默认写入 `/tmp` 隔离目录。
|
||||
- `official-version-state.json` 已持久化当前完成、正在拉取、上一个可用和失败版本,`bat status` 会显示版本状态摘要。
|
||||
- 资源导入链路已支持 CAS + `ResourceRepository` 写入,AssetBundle UnityFS 摘要,以及 TextAsset/Table/Media 分类索引。
|
||||
- 当前 catalog、上一个版本 catalog、结构变化 catalog、403、404、hash mismatch 已有离线回归 fixture。
|
||||
|
||||
## 2. 现在不要误解的点
|
||||
|
||||
@@ -39,9 +42,9 @@
|
||||
|
||||
1. Go CLI 最小入口:`bat doctor`、`bat sync --help`、`bat official sync --help`。
|
||||
2. 按 smoke runbook 在具备网络和磁盘窗口的环境中执行真实官方网络 smoke,并保留隔离目录报告。
|
||||
3. 官方同步下载结果进入 CAS + `SqliteResourceRepository` 的用户级流程。
|
||||
4. Addressables parser 覆盖更多真实 catalog 结构。
|
||||
5. AssetBundle UnityFS header/block/directory 解析。
|
||||
3. 官方同步下载结果自动触发 CAS + `SqliteResourceRepository` 的用户级导入流程。
|
||||
4. Addressables parser 覆盖二进制/压缩字段组合和更细失败诊断。
|
||||
5. AssetBundle 对象表、TypeTree 和 TextAsset 提取链路继续推进。
|
||||
6. Patch、翻译库、API Server、Web。
|
||||
|
||||
## 4. 下一次对话最合适的起点
|
||||
|
||||
Reference in New Issue
Block a user