Skip to content

Commit 6f02b76

Browse files
committed
ci: stop pinning the attest action's SHA inside the test that guards it
供应链测试把 action 的 **SHA 按字面钉死**: self.assertIn("actions/attest-build-provenance@0f67c3f... # v4.1.1", ...) Dependabot 升级这个 action 时改的正是被断言的那一行,于是断言必然失败、`build` 红、 PR `mergeStateStatus=BLOCKED`。这是**结构性死锁**:该 action 的任何一次升级都会打挂 钉死它的测试,PR 永远合不进来。**全集群 7 个仓库钉的是同一个 SHA,6 个 PR 同时卡在这里** (agentic #13、aifbs #8、ai_security #17、blockchain #176、ceg #16、docker_practice #578)。 反证很干净:另外 4 个断言写成 `assertIn("actions/attest-build-provenance@")` 的仓库 (claude_guide / peg / fde / llm_internals)**同一个升级早就合进去了**。 断言真正要守的是「release job 必须用 SHA 钉住这个 action」——**这个意图不需要记住是哪个 SHA**。改为 `assertRegex(..., r"actions/attest-build-provenance@[0-9a-f]{40} # v\d")`: 仍然强制 40 位 SHA + `# vN` 溯源注释,**比那 4 个仓库现用的宽松写法更严**,但升级不再撞墙。 同批把 aifbs / ai_security 里 `dependabot/fetch-metadata@25dd0e3... # v3.1.0` 的同款钉死 一并改掉(未升级该 action,只解除钉死)。 同时在主干上直接升掉 Dependabot 提的两个版本,**SHA 逐个用 GitHub API 解引用核过** (`browser-actions/setup-chrome` 的 tag 是 annotated tag,要走 `git/tags` 再取 `.object.sha`,直接读 `git/ref/tags` 会拿到 tag 对象的 SHA 而误判): - `actions/attest-build-provenance` 0f67c3f… v4.1.1 → 4d10147… v4.2.2 - `browser-actions/setup-chrome` 2e1d749… v2.1.2 → 48ad923… v2.2.0(blockchain_guide 已在 2.2.0) **负向验证**(AGENTS.md 核心约定 4,逐条证明新断言没被改成永真):把 pin 换成浮动 tag `@v4` → FAIL;保留 SHA 但删掉 `# vN` 注释 → FAIL;还原 → OK。七个仓库各跑一遍, 结果一致。而「换一个合法 SHA 应当通过」这一条由本提交自身证明——pin 从 v4.1.1 换到 v4.2.2,测试全绿。 各仓库 `check_project_rules`、`unittest discover -s tests -p 'test_*.py'`、 `git diff --check` 均通过;docker_practice 另跑 `npm test` 通过。
1 parent 670c813 commit 6f02b76

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

.github/workflows/auto-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ jobs:
151151
run: (cd dist && sha256sum -c SHA256SUMS)
152152

153153
- name: Attest tagged release artifacts
154-
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
154+
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
155155
with:
156156
subject-path: |
157157
dist/blockchain_guide-*.pdf

tests/test_workflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def test_every_publication_workflow_builds_pdf_html_and_checksums(self):
207207
self.assertIn(marker, text, f"{name}: {marker}")
208208
self.assertIn("if-no-files-found: error", text, name)
209209
auto = self.text("auto-release.yml")
210-
self.assertIn("actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1", auto)
210+
self.assertRegex(auto, r"actions/attest-build-provenance@[0-9a-f]{40} # v\d")
211211
self.assertRegex(auto, r"(?s)subject-path:.*?\.pdf.*?\.html.*?SHA256SUMS")
212212
self.assertRegex(auto, r"(?s)files:.*?\.pdf.*?\.html.*?SHA256SUMS")
213213

0 commit comments

Comments
 (0)