fix(release): 修复发布一致性与并发边界
bat-rust / Build and test Rust (push) Canceled after 0s
bat-rust / Build and test Go API (push) Canceled after 0s

This commit is contained in:
2026-09-12 16:35:55 +08:00
parent 8d57a63697
commit 30d1cd77e8
20 changed files with 1100 additions and 102 deletions
+15 -3
View File
@@ -77,8 +77,11 @@
current -> versions/<id> # 已汉化后才切换;未汉化状态不发布
versions/<id>/ # 与官方相对路径一致的汉化资源
localized-patch-manifest.json # localized wrapper + generic PatchManifest 审计输入/结果
localized-distribution-manifest.json # 实际 localized bytes/hash 的轻量分发索引
.staging/<id>/ # generic/translation patch 未发布写侧
localized-version-state.json # localized current、官方 source release 和 workflow 状态
.localized-release.lock # 跨进程单写者锁
.localized-transaction.json # publish/rollback 崩溃恢复日志
```
官方资源发布和汉化发布是两个独立状态:
@@ -98,8 +101,16 @@ version state、current symlink、release manifest、文件系统和必要的 CA
`release.distribution` 的默认 channel 是 `official`。只有当前或显式历史、路径归属安全、
source relation 正确且 manifest/artifact integrity 通过的 release 才能被选择;staging、
损坏、缺失、symlink/path escape 或未验证历史项不会回退到另一 channel。返回的
`resource_root` 和 manifest entry 由 Rust 决定,Go 只做 typed forwarding。
损坏、缺失、symlink/path escape 或未验证历史项不会回退到另一 channel。Rust 使用已发布
manifest 做轻量选择,HTTP 热路径不重新执行完整 release auditlocalized 必须额外满足
`localized-distribution-manifest.json` 与 source official manifest 的 destination/URL
集合一致,并返回实际 localized bytes/hash。返回的 `resource_root` 和 manifest entry
由 Rust 决定,Go 只做 typed forwarding;传入 `destination` 时 Rust 会重新校验该文件的
实际 bytes/BLAKE3。
localized publish/rollback 先取得 `.localized-release.lock`,并在 output root 下记录
`.localized-transaction.json`。current、version-state 和 version 目录的切换按日志阶段
推进;下一次写操作会先恢复或完成未决事务,避免跨进程并发写入和中断后留下半发布状态。
`release.cleanup` 先生成 dry-run 计划和 `plan_id`,执行时重新计算并比对计划。current、
rollback previous、active/in-progress、localized source official、state/manifest/CAS
@@ -163,7 +174,8 @@ GET {public-base-url}/prod-clientpatch.bluearchiveyostar.com/<root_token>/...
默认仅服务 **official download manifest 索引内且 Present + size 匹配** 的文件。需要
localized 或历史 release 时,调用 `release.distribution` 选择 Rust 已验证的
`resource_root`,再由 `/v1/distribution` 或带 `channel`/`release_id` 的 CDN path
转发;Go 不在本地判断健康度,也不回退到 official。
转发;localized CDN 使用 Rust 返回的实际 bytes/hash 生成 ETag,并在显式请求时校验
实际文件长度;Go 不在本地判断健康度,也不回退到 official。
### 3.3 launcher 资源引导兼容