Repository navigation
fix(ci): Worker 不存在时按账本放行迁移守卫,并补回归用例 (ONE-512) - #156
Merged
Merged
Conversation
deployments status 失败时不再一律拒绝:_<prefix>_schema_migrations 存在即 视为本应用归属证明(Worker 被删、表与账本仍在的情形),打 warning 后继续幂等 迁移;带前缀表但无账本仍维持拒绝;deployments status 成功时的现役版本前缀比对 逻辑未改动。 test-d1-migrations.mjs 新增 D1_LOCATION=remote 场景,用既有 pnpm 替身做法 mock wrangler 控制面调用,覆盖「无表无历史放行 / 有账本放行 / 有表无账本拒绝」与 成功分支的前缀比对不回归。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动 B:迁移守卫对「Worker 不存在」分情形放行
子单:ONE-512(父单 ONE-510,规格 v1.1 §2 / §3 改动 C 第 1–3 项)
改了什么
.github/scripts/d1-prefixed-migrations.shwrangler deployments status失败分支由「只有无表无历史才放行」改为三分支:has_history == true(_<prefix>_schema_migrations存在)→ 打::warning::后放行,继续幂等迁移。账本表名本身即本应用的归属证明,覆盖「Worker 被删、表与账本还在」。own_tables为空且无历史 → 维持原有放行(首次部署)。own_tables非空且无历史 → 维持拒绝,归属 genuinely 不明,一个字没让。deployments status成功时的现役版本逐个比对前缀逻辑未改动。文件头部注释补了一句说明。.github/scripts/test-d1-migrations.mjsscript()增加可选第三参(额外 env),新增mockControlPlane():沿用test-deploy-checks.mjs既有的 pnpm 替身做法,只接管wrangler deployments status/versions view,其余调用原样交给真实 pnpm 并把--remote改写为--local,因此D1_LOCATION=remote分支可以在不碰任何 CF 凭据的前提下跑在本地 D1 上。自测(北京时间 2026-10-27 11:4x)
node --test .github/scripts/test-d1-migrations.mjs→ 18 tests / 18 pass / 0 failshellcheck .github/scripts/*.sh→ 通过biome check .github/scripts/test-d1-migrations.mjs→ 通过✖),恢复后通过 —— 新用例确实卡住了改动 B。范围
只动上述两个文件;未碰运行时代码、schema/迁移 SQL、其他仓库、任何 Secret 与线上 D1/KV 数据。