Skip to content

Commit 950b74f

Browse files
committed
fix(release): bind package plan approval in publish
1 parent 022b2d6 commit 950b74f

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ jobs:
4040
run: npm ci
4141

4242
- name: Run package release checks
43-
run: npm run test:package-release
43+
shell: bash
44+
run: |
45+
set -euo pipefail
46+
PLAN_DIGEST="$(
47+
node scripts/run-validation.js --route package-release --plan --json |
48+
node -e 'const fs = require("fs"); const envelope = JSON.parse(fs.readFileSync(0, "utf8")); const plan = envelope?.data?.plan; const digest = plan?.budgetCard?.digest; if (envelope?.ok !== true || plan?.routeResolved !== "package-release" || plan?.candidateStable !== true || !/^[a-f0-9]{64}$/.test(String(digest || ""))) process.exit(1); process.stdout.write(digest)'
49+
)"
50+
node scripts/run-validation.js --route package-release --approve-plan "${PLAN_DIGEST}"
4451
4552
- name: Preview package contents
4653
run: npm pack --dry-run

changelogs/releases/v1.17.11.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ v1.17.11 修复“日常小改动也被推入完整发布验证”的控制面
1515
- `ValidationPlanV2` 通过类型化 runtime、qualification、release consumer 边构建影响图,保留 V1 兼容投影;未知输入失败关闭,不再静默升级成 full。
1616
- `fast` 改为动态影响选择;`profile-deploy``package-release` 固定为各自 V2 边界,不能吸收旧 full 清单或其他 dirty boundary。
1717
- `BudgetCardV1` 在执行前给出节点数、重节点和预计耗时;非发布重节点需要绑定精确计划摘要,发布 V3 则需要显式 release authority。
18+
- tag 触发的非交互 Publish 会先物化 `package-release` 计划,再把同一 `BudgetCardV1.digest` 绑定回执行;既避免自动发布卡在确认门禁,也不绕过候选 V3 或精确计划约束。
1819
- `ValidationEvidenceV2` 绑定 manifest、候选 dirty identity、节点合同/策略和上游 `nodeReceiptDigest`;只复用身份等价的节点证据,V3 永不复用缓存。
1920
- CLI 以 `--intent` 为正式参数,保留 `--purpose` 兼容别名;新增 `test:delivery``test:boundary`
2021

scripts/test-release-metadata.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const plugin = JSON.parse(fs.readFileSync(path.join(ROOT, 'plugin.json'), 'utf8'
1111
const lock = JSON.parse(fs.readFileSync(path.join(ROOT, 'package-lock.json'), 'utf8'))
1212
const readme = fs.readFileSync(path.join(ROOT, 'README.md'), 'utf8')
1313
const publicCi = fs.readFileSync(path.join(ROOT, '.github', 'workflows', 'ci.yml'), 'utf8')
14+
const publishWorkflow = fs.readFileSync(path.join(ROOT, '.github', 'workflows', 'publish.yml'), 'utf8')
1415

1516
const errors = []
1617
const publicReadmeContract = evaluatePublicReadmeContractV2(readme, { root: ROOT })
@@ -59,6 +60,17 @@ expect(publicCi.includes('route: test:windows-control-plane'), '公共 CI 必须
5960
expect(publicCi.includes('name: Full quality (Node 24.17)'), '公共 CI 全量质量门必须使用发布 Node 24.17')
6061
expect(publicCi.includes('name: Package boundary (Node 24.17)'), '公共 CI package job 必须只声明实际执行的 package boundary')
6162
expect(!publicCi.includes('Website and package'), '公共 CI 不得把条件缺席的网站构建表述为绿色证据')
63+
expect(publishWorkflow.includes('set -euo pipefail'), 'Publish workflow 必须让 package plan 管道失败关闭')
64+
expect(
65+
publishWorkflow.includes('node scripts/run-validation.js --route package-release --plan --json'),
66+
'Publish workflow 必须先物化 package-release 精确计划'
67+
)
68+
expect(publishWorkflow.includes('plan?.budgetCard?.digest'), 'Publish workflow 必须读取 BudgetCard 精确摘要')
69+
expect(
70+
publishWorkflow.includes('--route package-release --approve-plan "${PLAN_DIGEST}"'),
71+
'Publish workflow 必须把同一 BudgetCard 摘要绑定回 package-release 执行'
72+
)
73+
expect(!publishWorkflow.includes('run: npm run test:package-release'), 'Publish workflow 不得使用缺少非交互计划批准的旧入口')
6274
expect(nonEmptyString(pkg.publishConfig && pkg.publishConfig.registry), 'package.json publishConfig.registry 不能为空')
6375
expect(nonEmptyString(pkg.publishConfig && pkg.publishConfig.access), 'package.json publishConfig.access 不能为空')
6476
expect(files.length > 0, 'package.json files 不能为空')

0 commit comments

Comments
 (0)