From b8be5b30e8de20ac44f803a146b950e2b5592889 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 17 Nov 2026 02:40:13 +0800 Subject: [PATCH 1/3] chore(release): stage guarded v0.5.10 multi-platform publisher Constraint: Keep source proofs unfinalized until exact-source gates succeed Confidence: high Scope-risk: moderate --- .github/release-requests/v0.5.10-notes.md | 23 + .github/release-requests/v0.5.10.json | 21 + .github/workflows/release-publish-v0510.yml | 427 ++++++++++++++++++ scripts/release_github_actions_v0510.py | 62 +++ scripts/release_windows_acceptance.py | 5 +- .../test_release_github_actions_v0510.py | 194 ++++++++ 6 files changed, 731 insertions(+), 1 deletion(-) create mode 100644 .github/release-requests/v0.5.10-notes.md create mode 100644 .github/release-requests/v0.5.10.json create mode 100644 .github/workflows/release-publish-v0510.yml create mode 100644 scripts/release_github_actions_v0510.py create mode 100644 scripts/tests/test_release_github_actions_v0510.py diff --git a/.github/release-requests/v0.5.10-notes.md b/.github/release-requests/v0.5.10-notes.md new file mode 100644 index 000000000..b4e0648a9 --- /dev/null +++ b/.github/release-requests/v0.5.10-notes.md @@ -0,0 +1,23 @@ +# WebCodex v0.5.10 + +## English + +- Explain `edit_conflict` results with concrete conflict details and recovery guidance, preserving edit validation and execution-authority boundaries. +- Record Tunnel terminal-upload failures after retries are exhausted, without classifying healthy unsettled work as failed. +- Clarify safe Tunnel recovery guidance while preserving Tunnel identity and receipts. Uncertain delivery does not authorize replay. +- Update Cargo current-layout test fixtures and fix Windows test-lock handling, retaining validation and lock-contention checks. + +The historical MCP 408 root cause remains unproven. The observed connection recovered after reconnecting; this release does not claim a root-cause repair for that incident. + +Choose the installer matching your Linux, macOS or Windows architecture. Publication is GitHub-only to `9holy/webcodex`; no npm package is published. + +## 中文 + +- 为 `edit_conflict` 提供具体冲突信息和恢复提示,保留编辑校验与执行权限边界。 +- 在重试耗尽后记录 Tunnel 终态上传失败,不将健康但尚未结束的工作标为失败。 +- 澄清安全的 Tunnel 恢复提示,保留 Tunnel 身份及回执。交付结果不确定不代表获得重放授权。 +- 更新当前 Cargo 布局的测试夹具并修复 Windows 测试锁处理,保留校验与锁竞争检查。 + +历史 MCP 408 的根因仍未得到证明。已观察到的连接通过重新连接恢复;本版本不宣称修复了该事件的根因。 + +请选择与 Linux、macOS 或 Windows 架构匹配的安装包。本次仅向 `9holy/webcodex` 发布 GitHub 版本,不发布 npm 包。 diff --git a/.github/release-requests/v0.5.10.json b/.github/release-requests/v0.5.10.json new file mode 100644 index 000000000..1a499e488 --- /dev/null +++ b/.github/release-requests/v0.5.10.json @@ -0,0 +1,21 @@ +{ + "ci_run_attempt": 1, + "ci_run_id": 1, + "evidence_run_attempt": 1, + "evidence_run_id": 1, + "github_only": true, + "include_runtime_installers": false, + "include_unified_installers": true, + "notes_path": ".github/release-requests/v0.5.10-notes.md", + "notes_sha256": "54091636008de339633859d60b37dc027384be492a55ed2dafc38e7ef80a403a", + "owner": "9holy", + "owner_id": 45361924, + "repo": "9holy/webcodex", + "repo_id": 1404596174, + "schema_version": 1, + "source_ref": "release/v0.5.10", + "source_sha": "0000000000000000000000000000000000000000", + "source_tree": "0000000000000000000000000000000000000000", + "tag": "v0.5.10", + "version": "0.5.10" +} diff --git a/.github/workflows/release-publish-v0510.yml b/.github/workflows/release-publish-v0510.yml new file mode 100644 index 000000000..ab5d1b029 --- /dev/null +++ b/.github/workflows/release-publish-v0510.yml @@ -0,0 +1,427 @@ +name: Publish approved GitHub release v0.5.10 + +run-name: Publish WebCodex v0.5.10 + +on: + push: + branches: [main] + paths: + - .github/release-requests/v0.5.10.json + workflow_dispatch: + +# A reviewed request on main authorizes only this repository's fixed release. +# Candidate workflows retain their existing read-only permissions. Publication +# uses the repository-scoped Actions installation token; no personal token or npm. +permissions: + contents: read + +concurrency: + group: publish-approved-github-v0.5.10 + cancel-in-progress: false + +jobs: + publish: + if: >- + github.repository == '9holy/webcodex' && + github.repository_id == '1404596174' && + github.ref == 'refs/heads/main' && + github.actor == '9holy' && github.triggering_actor == '9holy' + runs-on: ubuntu-latest + timeout-minutes: 360 + permissions: + contents: write + actions: write + defaults: + run: + shell: bash + working-directory: control + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PYTHONDONTWRITEBYTECODE: '1' + CONTROL_REQUEST: ${{ github.workspace }}/control/.github/release-requests/v0.5.10.json + SOURCE_ROOT: ${{ github.workspace }}/release-source + steps: + - name: Checkout reviewed publication controller + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + ref: ${{ github.sha }} + path: control + fetch-depth: 1 + persist-credentials: false + - name: Initialize publication directories + run: | + printf 'STATE_DIR=%s/webcodex-release-control\n' "$RUNNER_TEMP" >> "$GITHUB_ENV" + printf 'BUNDLE_DIR=%s/webcodex-release-bundle\n' "$RUNNER_TEMP" >> "$GITHUB_ENV" + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + with: + python-version: '3.12' + - name: Read the reviewed fixed source identity + id: release-spec + run: | + python3 - <<'PYTHON' >> "$GITHUB_OUTPUT" + import os + from pathlib import Path + from scripts import release_github_actions as controller + from scripts.release_github_actions_v0510 import SPEC, require_finalized + + if (SPEC.pinned_request["tag"] != "v0.5.10" + or SPEC.request_path != ".github/release-requests/v0.5.10.json" + or SPEC.workflow_path != ".github/workflows/release-publish-v0510.yml"): + raise SystemExit("The reviewed publication specification does not match this fixed entry point.") + require_finalized(SPEC) + request = controller.validate_request( + controller._read_json(Path(os.environ["CONTROL_REQUEST"])), spec=SPEC) + print("source_sha=" + request["source_sha"]) + PYTHON + - name: Checkout immutable release source + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + ref: ${{ steps.release-spec.outputs.source_sha }} + path: release-source + fetch-depth: 0 + fetch-tags: true + persist-credentials: false + - name: Validate publication controller contracts + run: >- + python3 -m unittest scripts.tests.test_release_github_actions + scripts.tests.test_release_assembly_publication + scripts.tests.test_recover_release_assembly + scripts.tests.test_release_checksum_layout + scripts.tests.test_release_github_actions_v054 + scripts.tests.test_release_github_actions_v055 + scripts.tests.test_release_github_actions_v056 + scripts.tests.test_release_github_actions_v057 + scripts.tests.test_release_github_actions_v058 + scripts.tests.test_release_github_actions_v059 + scripts.tests.test_release_github_actions_v0510 + scripts.tests.test_release_windows_acceptance + scripts.tests.test_verify_public_release + - name: Restore this run's verified checkpoint on retry + run: >- + python3 scripts/release_github_actions_v0510.py restore-state --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Verify repository, machine identity and exact source proofs + run: >- + python3 scripts/release_github_actions_v0510.py preflight --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain preflight + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-01-preflight + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Prepare one correlated readiness request + run: >- + python3 scripts/release_github_actions_v0510.py prepare-readiness --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain readiness-intent + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-02-readiness-intent + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Dispatch the prepared readiness request once + run: >- + python3 scripts/release_github_actions_v0510.py dispatch-readiness --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain readiness-dispatched + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-03-readiness-dispatched + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Require successful exact-source readiness + run: | + set -euo pipefail + deadline=$((SECONDS + 1800)) + while true; do + code=0 + python3 scripts/release_github_actions_v0510.py status-readiness --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" --wait-secs 0 || code=$? + if [ "$code" -eq 0 ]; then break; fi + if [ "$code" -ne 2 ]; then exit "$code"; fi + if [ "$SECONDS" -ge "$deadline" ]; then + echo "The bound workflow is still pending; retain its identity and resume this run." >&2 + exit 2 + fi + sleep 45 + done + - name: Retain readiness-verified + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-04-readiness-verified + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Prepare the immutable annotated tag + run: >- + python3 scripts/release_github_actions_v0510.py prepare-tag --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain tag-intent + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-05-tag-intent + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Create or reconcile the exact annotated tag + run: >- + python3 scripts/release_github_actions_v0510.py create-tag --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain tag-created + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-06-tag-created + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Prepare one formal build request + run: >- + python3 scripts/release_github_actions_v0510.py prepare-build --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain build-intent + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-07-build-intent + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Dispatch the prepared tagged build once + run: >- + python3 scripts/release_github_actions_v0510.py dispatch-build --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain build-dispatched + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-08-build-dispatched + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Require the exact formal build to succeed + run: | + set -euo pipefail + deadline=$((SECONDS + 14400)) + while true; do + code=0 + python3 scripts/release_github_actions_v0510.py status-build --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" --wait-secs 0 || code=$? + if [ "$code" -eq 0 ]; then break; fi + if [ "$code" -ne 2 ]; then exit "$code"; fi + if [ "$SECONDS" -ge "$deadline" ]; then + echo "The bound workflow is still pending; retain its identity and resume this run." >&2 + exit 2 + fi + sleep 45 + done + - name: Retain build-verified + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-09-build-verified + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Collect and verify the same-run installer bundle + run: >- + python3 scripts/release_github_actions_v0510.py collect --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain bundle-verified + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-10-bundle-verified + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Prepare the bound draft Release + run: >- + python3 scripts/release_github_actions_v0510.py prepare-draft --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain draft-intent + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-11-draft-intent + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Create or reconcile the bound draft + run: >- + python3 scripts/release_github_actions_v0510.py create-draft --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain draft-created + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-12-draft-created + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Freeze the exact public asset list and hashes + run: >- + python3 scripts/release_github_actions_v0510.py prepare-upload --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain upload-intent + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-13-upload-intent + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Upload retained assets without replacing existing bytes + run: >- + python3 scripts/release_github_actions_v0510.py upload-assets --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain assets-uploaded + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-14-assets-uploaded + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Verify every draft asset digest and size + run: >- + python3 scripts/release_github_actions_v0510.py verify-draft --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain draft-verified + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-15-draft-verified + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Freeze preview publication intent + run: >- + python3 scripts/release_github_actions_v0510.py prepare-preview --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain preview-intent + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-16-preview-intent + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Publish immutable preview once + run: >- + python3 scripts/release_github_actions_v0510.py publish-preview --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain preview-published + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-17-preview-published + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Verify real public prerelease installer bytes + run: >- + python3 scripts/release_github_actions_v0510.py verify-preview --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain preview-verified + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-18-preview-verified + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Freeze exact native Windows acceptance request + run: >- + python3 scripts/release_github_actions_v0510.py prepare-acceptance --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain acceptance-intent + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-19-acceptance-intent + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Dispatch the bound read-only Windows workflow once + run: >- + python3 scripts/release_github_actions_v0510.py dispatch-acceptance --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain acceptance-dispatched + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-20-acceptance-dispatched + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Require both native Windows architectures and all five install scenarios + run: | + set -euo pipefail + deadline=$((SECONDS + 5400)) + while true; do + code=0 + python3 scripts/release_github_actions_v0510.py status-acceptance --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" --wait-secs 0 || code=$? + if [ "$code" -eq 0 ]; then break; fi + if [ "$code" -ne 2 ]; then exit "$code"; fi + if [ "$SECONDS" -ge "$deadline" ]; then + echo "The bound workflow is still pending; retain its identity and resume this run." >&2 + exit 2 + fi + sleep 45 + done + - name: Retain acceptance-verified + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-21-acceptance-verified + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Freeze stable promotion against successful Windows proof + run: >- + python3 scripts/release_github_actions_v0510.py prepare-promotion --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain promotion-intent + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-22-promotion-intent + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Promote the same Release to stable and latest once + run: >- + python3 scripts/release_github_actions_v0510.py promote --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain stable-promoted + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-23-stable-promoted + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Verify stable public installer bytes + run: >- + python3 scripts/release_github_actions_v0510.py verify-public --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain public-verified + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-24-public-verified + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Freeze image and Intel Desktop dispatches after promotion + run: >- + python3 scripts/release_github_actions_v0510.py prepare-post --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain post-intent + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-25-post-intent + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Dispatch the existing post-publication workflows + run: >- + python3 scripts/release_github_actions_v0510.py dispatch-post --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" + - name: Retain post-dispatched + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-26-post-dispatched + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Require image verification and completed Intel DMG publication + run: | + set -euo pipefail + deadline=$((SECONDS + 7200)) + while true; do + code=0 + python3 scripts/release_github_actions_v0510.py status-post --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" --wait-secs 0 || code=$? + if [ "$code" -eq 0 ]; then break; fi + if [ "$code" -ne 2 ]; then exit "$code"; fi + if [ "$SECONDS" -ge "$deadline" ]; then + echo "The bound workflow is still pending; retain its identity and resume this run." >&2 + exit 2 + fi + sleep 45 + done + - name: Retain post-verified + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-27-post-verified + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: error + retention-days: 90 + - name: Retain final-state + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-control-v0.5.10-${{ github.run_id }}-${{ github.run_attempt }}-99-final-state + path: ${{ runner.temp }}/webcodex-release-control/*.json + if-no-files-found: warn + retention-days: 90 diff --git a/scripts/release_github_actions_v0510.py b/scripts/release_github_actions_v0510.py new file mode 100644 index 000000000..ebb0717ab --- /dev/null +++ b/scripts/release_github_actions_v0510.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +"""Fixed v0.5.10 authority using the reviewed staged publication gates. + +Only this entry's source/proof pins may change during finalization. The request +cannot select another source, workflow, asset scope, or acceptance policy. +""" +from __future__ import annotations + +from pathlib import Path +import sys + +if __package__: + from . import release_github_actions as base + from . import release_github_actions_v054 as staged +else: + # Preserve one validation error class across the script and shared worker. + sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) + from scripts import release_github_actions as base + from scripts import release_github_actions_v054 as staged + + +# Final source and successful proof attempts must be fixed in reviewed control +# code. Unfinished or mismatched requests still forbid publication. +SPEC = base.ReleaseSpec( + {**base.PINNED_REQUEST, + "version": "0.5.10", "tag": "v0.5.10", "source_ref": "release/v0.5.10", + "source_sha": "0000000000000000000000000000000000000000", + "source_tree": "0000000000000000000000000000000000000000", + "ci_run_id": 1, "ci_run_attempt": 1, + "evidence_run_id": 1, "evidence_run_attempt": 1, + "notes_path": ".github/release-requests/v0.5.10-notes.md", + "notes_sha256": "54091636008de339633859d60b37dc027384be492a55ed2dafc38e7ef80a403a"}, + ".github/release-requests/v0.5.10.json", + ".github/workflows/release-publish-v0510.yml", +) + + +def require_finalized(spec: base.ReleaseSpec) -> None: + request = spec.pinned_request + base._require( + request["version"] == "0.5.10" and request["tag"] == "v0.5.10" + and request["source_ref"] == "release/v0.5.10" + and spec.request_path == ".github/release-requests/v0.5.10.json" + and spec.workflow_path == ".github/workflows/release-publish-v0510.yml" + and spec.platform_scope == "all" + and request["source_sha"] != "0" * 40 and request["source_tree"] != "0" * 40 + and request["ci_run_id"] > 1 and request["evidence_run_id"] > 1, + "v0.5.10 固定源码或成功验收 pins 尚未完成审核;不执行任何发布操作。", + ) + + +class StagedController(staged.StagedController): + def run(self, stage: str, wait_secs: int = 0) -> int: + require_finalized(self.spec) + # Replace only the v0.5.4 entry guard. The unchanged base dispatcher still + # authenticates, locks, restores, validates source, and calls the inherited + # staged method; no publication or acceptance gate is overridden. + return base.Controller.run(self, stage, wait_secs) + + +if __name__ == "__main__": + raise SystemExit(base.main(spec=SPEC, controller_type=StagedController)) diff --git a/scripts/release_windows_acceptance.py b/scripts/release_windows_acceptance.py index 8c1833179..4d4ec3729 100644 --- a/scripts/release_windows_acceptance.py +++ b/scripts/release_windows_acceptance.py @@ -53,7 +53,8 @@ def scenarios_for_request(request: dict) -> tuple[str, ...]: ("v0.5.6", ".github/workflows/release-publish-v056.yml"), ("v0.5.7", ".github/workflows/release-publish-v057.yml"), ("v0.5.8", ".github/workflows/release-publish-v058.yml"), - ("v0.5.9", ".github/workflows/release-publish-v059.yml")}: + ("v0.5.9", ".github/workflows/release-publish-v059.yml"), + ("v0.5.10", ".github/workflows/release-publish-v0510.yml")}: return V056_SCENARIOS return SCENARIOS @@ -125,6 +126,8 @@ def select_release_spec(request: dict) -> control.ReleaseSpec: from scripts.release_github_actions_v058 import SPEC, require_finalized elif identity == ("v0.5.9", ".github/workflows/release-publish-v059.yml"): from scripts.release_github_actions_v059 import SPEC, require_finalized + elif identity == ("v0.5.10", ".github/workflows/release-publish-v0510.yml"): + from scripts.release_github_actions_v0510 import SPEC, require_finalized else: raise control.ReleaseControlError("Windows 验收请求不属于已审核的固定发布入口。") require_finalized(SPEC) diff --git a/scripts/tests/test_release_github_actions_v0510.py b/scripts/tests/test_release_github_actions_v0510.py new file mode 100644 index 000000000..9e52a098f --- /dev/null +++ b/scripts/tests/test_release_github_actions_v0510.py @@ -0,0 +1,194 @@ +from __future__ import annotations + +import contextlib +import copy +import hashlib +import io +import json +from pathlib import Path +import runpy +import tempfile +import unittest +import zipfile +from unittest import mock + +from scripts import release_github_actions as base +from scripts import release_github_actions_v054 as previous +from scripts import release_github_actions_v0510 as staged +from scripts import release_windows_acceptance as worker +from scripts.tests import test_release_github_actions as old +from scripts.tests import test_release_github_actions_v054 as previous_tests +from scripts.tests import test_release_windows_acceptance as fixtures + + +class V0510StagedPublicationTests(previous_tests.StagedPublicationTests): + """Run the existing staged failure/recovery suite against the new authority.""" + + def setUp(self): + self.temp = tempfile.TemporaryDirectory() + self.addCleanup(self.temp.cleanup) + self.root = Path(self.temp.name).resolve() + control = self.root / "control" + control.mkdir() + notes = b"Unit-test-only v0.5.10 staged release.\n" + self.spec = base.ReleaseSpec({**dict(staged.SPEC.pinned_request), "source_sha": "c" * 40, + "source_tree": "d" * 40, "ci_run_id": 1001, "ci_run_attempt": 1, + "evidence_run_id": 1002, "evidence_run_attempt": 1, + "notes_sha256": hashlib.sha256(notes).hexdigest()}, staged.SPEC.request_path, staged.SPEC.workflow_path) + request_path = control / self.spec.request_path + request_path.parent.mkdir(parents=True) + request_path.write_bytes(base._json_bytes(dict(self.spec.pinned_request))) + (control / self.spec.pinned_request["notes_path"]).write_bytes(notes) + client = mock.Mock(spec=base.collector.GitHubClient) + client.api_url.side_effect = lambda suffix: f"https://api.github.com/repos/9holy/webcodex{suffix}" + self.c = staged.StagedController(request_path, self.root / "source", self.root / "state", self.root / "bundle", + control_root=control, client=client, env=old._environment(), spec=self.spec) + self.c.context = {**old._context(), "workflow_path": self.spec.workflow_path} + self.c.state = base.new_journal(self.c.request, self.c.request_digest, self.c.context) + self.c.state.update(release_id=234, tag_object_sha="a" * 40, + bundle={"workflow_run_id": 345}, assets=fixtures.assets("0.5.10")) + self.c.state["effects"]["draft"] = old._effect(self.c._draft_intent(), status="succeeded") + self.release = {**self.c._draft_intent(), "id": 234, "published_at": None, + "author": {"id": base.BOT_ID, "login": base.BOT_LOGIN}, + "assets": [{"id": index + 1, "name": name, "state": "uploaded", "size": item["size"], + "digest": "sha256:" + item["sha256"], + "browser_download_url": f"https://github.com/9holy/webcodex/releases/download/v0.5.10/{name}"} + for index, (name, item) in enumerate(self.c.state["assets"].items())]} + self.c._find_release = mock.Mock(side_effect=lambda: copy.deepcopy(self.release)) + self.c._verify_tag = mock.Mock() + self.c._expected_assets = mock.Mock(return_value=self.c.state["assets"]) + self.c._save() + self.output = contextlib.redirect_stdout(io.StringIO()) + self.output.__enter__() + self.addCleanup(self.output.__exit__, None, None, None) + + def test_unfinalized_source_pins_reject_before_network_or_mutation(self): + # Construct placeholders, so finalizing the checked-in six pins does not + # remove this rejection case or require changing the test's expectation. + for field, value in (("source_sha", "0" * 40), ("source_tree", "0" * 40), + ("ci_run_id", 1), ("evidence_run_id", 1)): + self.c.spec = base.ReleaseSpec({**dict(self.spec.pinned_request), field: value}, + self.spec.request_path, self.spec.workflow_path) + with self.subTest(field=field), mock.patch.object(base.Controller, "run") as dispatch, \ + mock.patch.object(self.c, "_authenticate") as authenticate, \ + self.assertRaises(base.ReleaseControlError): + self.c.run("preflight") + dispatch.assert_not_called() + authenticate.assert_not_called() + self.c.spec = self.spec + staged.require_finalized(self.spec) + self.assertNotIn("publish", staged.StagedController.stages) + self.assertNotIn("prepare-publish", staged.StagedController.stages) + self.assertIn("publish", base.Controller.stages) + + def test_finalized_entry_uses_the_original_authenticated_dispatcher(self): + with mock.patch.object(base.Controller, "run", return_value=17) as dispatch: + self.assertEqual(self.c.run("status-acceptance", 1), 17) + dispatch.assert_called_once_with(self.c, "status-acceptance", 1) + + def test_another_fixed_entry_cannot_pass_the_v0510_guard(self): + with self.assertRaises(base.ReleaseControlError): + staged.require_finalized(previous.SPEC) + wrong_workflow = base.ReleaseSpec(dict(self.spec.pinned_request), self.spec.request_path, + previous.SPEC.workflow_path) + with self.assertRaises(base.ReleaseControlError): + staged.require_finalized(wrong_workflow) + + def test_v054_report_cannot_satisfy_the_v0510_acceptance_request(self): + self.acceptance() + request = self.c._windows_request() + previous_report = fixtures.report(fixtures.request()) + with self.assertRaises(base.ReleaseControlError): + worker.validate_report(previous_report, request, "win32-x64", 456, 1) + previous_report["request_sha256"] = worker.request_digest(request) + with self.assertRaises(base.ReleaseControlError): + worker.validate_report(previous_report, request, "win32-x64", 456, 1) + + + def test_missing_or_invalid_v054_native_evidence_blocks_promotion(self): + self.acceptance() + request = self.c._windows_request() + for mutate in (lambda r: r["scenarios"].pop("v054_unconfigured"), + lambda r: r["scenario_exit_codes"].update(v054_configured=2), + lambda r: r["v054_configured"]["upstream_runtime"].update(git_commit="f" * 40), + lambda r: r["v054_configured"]["cleanup"].update(complete=False)): + value = fixtures.report(request, "win32-x64") + mutate(value) + buffer = io.BytesIO() + with zipfile.ZipFile(buffer, "w") as archive: + archive.writestr("report.json", base._json_bytes(value)) + data = buffer.getvalue() + self.archives[1] = data + self.artifacts[0].update(size_in_bytes=len(data), digest="sha256:" + hashlib.sha256(data).hexdigest()) + with mock.patch.object(self.c, "_mutate") as effect, self.assertRaises(base.ReleaseControlError): + self.c.prepare_promotion() + effect.assert_not_called() + self.assertNotIn("promote", self.c.state["effects"]) + + def test_all_platform_scope_and_fixed_five_scenario_authority(self): + self.assertEqual(self.spec.platform_scope, "all") + self.assertGreater(len(self.c.state["assets"]), 11) + self.acceptance() + request = self.c._windows_request() + self.assertEqual(worker.scenarios_for_request(request), worker.V056_SCENARIOS) + with mock.patch.object(staged, "SPEC", self.spec): + self.assertIs(worker.select_release_spec(request), self.spec) + wrong = base.ReleaseSpec({**dict(self.spec.pinned_request), "platform_scope": "windows"}, + self.spec.request_path, self.spec.workflow_path) + with self.assertRaises(base.ReleaseControlError): + staged.require_finalized(wrong) + + + def test_prior_windows_authority_and_reports_cannot_authorize_all_platform_release(self): + from scripts import release_github_actions_v058 as windows_entry + with self.assertRaises(base.ReleaseControlError): + staged.require_finalized(windows_entry.SPEC) + self.acceptance() + request = self.c._windows_request() + value = fixtures.report(fixtures.fixed_request(windows_entry.SPEC)) + for rebound in (False, True): + if rebound: + value["request_sha256"] = worker.request_digest(request) + with self.subTest(rebound=rebound), self.assertRaises(base.ReleaseControlError): + worker.validate_report(value, request, "win32-x64", 456, 1) + + +class V0510FixedWorkflowContractTests(unittest.TestCase): + def test_script_and_shared_worker_keep_the_same_validation_error_identity(self): + root = Path(__file__).resolve().parents[2] + entry = runpy.run_path(str(root / "scripts/release_github_actions_v0510.py"), run_name="v0510_entry_fixture") + self.assertIs(entry["base"].ReleaseControlError, worker.control.ReleaseControlError) + self.assertIs(entry["staged"].StagedController, previous.StagedController) + + def test_fixed_request_notes_and_code_owned_spec_agree(self): + root = Path(__file__).resolve().parents[2] + self.assertEqual(json.loads((root / staged.SPEC.request_path).read_bytes()), dict(staged.SPEC.pinned_request)) + notes = (root / staged.SPEC.pinned_request["notes_path"]).read_bytes() + self.assertEqual(hashlib.sha256(notes).hexdigest(), staged.SPEC.pinned_request["notes_sha256"]) + self.assertEqual(staged.SPEC.pinned_request["tag"], "v0.5.10") + self.assertEqual(staged.SPEC.pinned_request["source_ref"], "release/v0.5.10") + + def test_existing_staged_gates_are_inherited_without_policy_overrides(self): + self.assertIs(staged.StagedController.stages, previous.StagedController.stages) + for name in ("_authenticate", "_lock", "restore_state", "_source", "prepare_preview", "publish_preview", + "verify_preview", "prepare_acceptance", "dispatch_acceptance", "_acceptance_reports", + "status_acceptance", "prepare_promotion", "promote", "verify_public", "status_post"): + with self.subTest(method=name): + self.assertIs(getattr(staged.StagedController, name), getattr(previous.StagedController, name)) + + def test_publisher_preserves_all_reviewed_steps_permissions_and_checkpoints(self): + root = Path(__file__).resolve().parents[2] + original = (root / ".github/workflows/release-publish-v059.yml").read_text() + expected = original.replace("v0.5.9", "v0.5.10").replace("v059", "v0510") + expected = expected.replace(" scripts.tests.test_release_github_actions_v0510\n", + " scripts.tests.test_release_github_actions_v059\n" + " scripts.tests.test_release_github_actions_v0510\n") + actual = (root / staged.SPEC.workflow_path).read_text() + self.assertEqual(actual, expected) + self.assertEqual(actual.count("name: release-control-v0.5.10-"), 28) + self.assertIn("require_finalized(SPEC)", actual) + self.assertNotIn(".py publish ", actual) + + +if __name__ == "__main__": + unittest.main() From 7ab55179ebd5ab3d09172a6451ec87e4520fbf5c Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 17 Nov 2026 05:10:20 +0800 Subject: [PATCH 2/3] chore(release): prepare approved Windows-first v0.5.10 publisher Use the existing Windows authority, five scenarios per architecture and preserved full-platform latest. Leave source proof pins unfinalized until successful exact-source gates exist. Constraint: No published manifests or installer bytes are replaced Confidence: high Scope-risk: moderate --- .github/release-requests/v0.5.10-notes.md | 8 +- .github/release-requests/v0.5.10.json | 3 +- .github/workflows/release-publish-v0510.yml | 8 +- scripts/release_github_actions_v0510.py | 17 +-- .../test_release_github_actions_v0510.py | 132 ++++++++---------- 5 files changed, 80 insertions(+), 88 deletions(-) diff --git a/.github/release-requests/v0.5.10-notes.md b/.github/release-requests/v0.5.10-notes.md index b4e0648a9..1c2e5f7a0 100644 --- a/.github/release-requests/v0.5.10-notes.md +++ b/.github/release-requests/v0.5.10-notes.md @@ -2,6 +2,8 @@ ## English +This Windows-first release provides x64 and ARM64 packages. Linux and macOS will follow in a later full release (v0.5.11 or higher). The previous full-platform release remains latest. + - Explain `edit_conflict` results with concrete conflict details and recovery guidance, preserving edit validation and execution-authority boundaries. - Record Tunnel terminal-upload failures after retries are exhausted, without classifying healthy unsettled work as failed. - Clarify safe Tunnel recovery guidance while preserving Tunnel identity and receipts. Uncertain delivery does not authorize replay. @@ -9,10 +11,12 @@ The historical MCP 408 root cause remains unproven. The observed connection recovered after reconnecting; this release does not claim a root-cause repair for that incident. -Choose the installer matching your Linux, macOS or Windows architecture. Publication is GitHub-only to `9holy/webcodex`; no npm package is published. +Choose the Windows installer matching your x64 or ARM64 architecture. Publication is GitHub-only to `9holy/webcodex`; no npm package is published. ## 中文 +本次先发布 Windows x64 和 ARM64 安装包。Linux 和 macOS 将随后续完整版本(v0.5.11 或更高)发布;此前的全平台版本继续保持为 latest。 + - 为 `edit_conflict` 提供具体冲突信息和恢复提示,保留编辑校验与执行权限边界。 - 在重试耗尽后记录 Tunnel 终态上传失败,不将健康但尚未结束的工作标为失败。 - 澄清安全的 Tunnel 恢复提示,保留 Tunnel 身份及回执。交付结果不确定不代表获得重放授权。 @@ -20,4 +24,4 @@ Choose the installer matching your Linux, macOS or Windows architecture. Publica 历史 MCP 408 的根因仍未得到证明。已观察到的连接通过重新连接恢复;本版本不宣称修复了该事件的根因。 -请选择与 Linux、macOS 或 Windows 架构匹配的安装包。本次仅向 `9holy/webcodex` 发布 GitHub 版本,不发布 npm 包。 +请选择与 Windows x64 或 ARM64 架构匹配的安装包。本次仅向 `9holy/webcodex` 发布 GitHub 版本,不发布 npm 包。 diff --git a/.github/release-requests/v0.5.10.json b/.github/release-requests/v0.5.10.json index 1a499e488..741943ced 100644 --- a/.github/release-requests/v0.5.10.json +++ b/.github/release-requests/v0.5.10.json @@ -7,9 +7,10 @@ "include_runtime_installers": false, "include_unified_installers": true, "notes_path": ".github/release-requests/v0.5.10-notes.md", - "notes_sha256": "54091636008de339633859d60b37dc027384be492a55ed2dafc38e7ef80a403a", + "notes_sha256": "4ce754d303a32a0e7f7b301bb0051462b9d5bdcb5f2865e3cf3bf41de7d71c23", "owner": "9holy", "owner_id": 45361924, + "platform_scope": "windows", "repo": "9holy/webcodex", "repo_id": 1404596174, "schema_version": 1, diff --git a/.github/workflows/release-publish-v0510.yml b/.github/workflows/release-publish-v0510.yml index ab5d1b029..e4066eca2 100644 --- a/.github/workflows/release-publish-v0510.yml +++ b/.github/workflows/release-publish-v0510.yml @@ -355,7 +355,7 @@ jobs: path: ${{ runner.temp }}/webcodex-release-control/*.json if-no-files-found: error retention-days: 90 - - name: Promote the same Release to stable and latest once + - name: Promote the same Windows Release while preserving all-platform latest run: >- python3 scripts/release_github_actions_v0510.py promote --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" - name: Retain stable-promoted @@ -375,7 +375,7 @@ jobs: path: ${{ runner.temp }}/webcodex-release-control/*.json if-no-files-found: error retention-days: 90 - - name: Freeze image and Intel Desktop dispatches after promotion + - name: Freeze Windows completion with image and Intel marked not applicable run: >- python3 scripts/release_github_actions_v0510.py prepare-post --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" - name: Retain post-intent @@ -385,7 +385,7 @@ jobs: path: ${{ runner.temp }}/webcodex-release-control/*.json if-no-files-found: error retention-days: 90 - - name: Dispatch the existing post-publication workflows + - name: Confirm no cross-platform workflows are dispatched run: >- python3 scripts/release_github_actions_v0510.py dispatch-post --request "$CONTROL_REQUEST" --source-root "$SOURCE_ROOT" --state-dir "$STATE_DIR" --bundle-dir "$BUNDLE_DIR" - name: Retain post-dispatched @@ -395,7 +395,7 @@ jobs: path: ${{ runner.temp }}/webcodex-release-control/*.json if-no-files-found: error retention-days: 90 - - name: Require image verification and completed Intel DMG publication + - name: Require Windows public bytes and preserved all-platform latest run: | set -euo pipefail deadline=$((SECONDS + 7200)) diff --git a/scripts/release_github_actions_v0510.py b/scripts/release_github_actions_v0510.py index ebb0717ab..95aefc1d1 100644 --- a/scripts/release_github_actions_v0510.py +++ b/scripts/release_github_actions_v0510.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Fixed v0.5.10 authority using the reviewed staged publication gates. +"""Fixed Windows v0.5.10 authority using the reviewed staged publication gates. Only this entry's source/proof pins may change during finalization. The request cannot select another source, workflow, asset scope, or acceptance policy. @@ -11,12 +11,12 @@ if __package__: from . import release_github_actions as base - from . import release_github_actions_v054 as staged + from . import release_github_actions_v058 as staged else: # Preserve one validation error class across the script and shared worker. sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) from scripts import release_github_actions as base - from scripts import release_github_actions_v054 as staged + from scripts import release_github_actions_v058 as staged # Final source and successful proof attempts must be fixed in reviewed control @@ -24,12 +24,13 @@ SPEC = base.ReleaseSpec( {**base.PINNED_REQUEST, "version": "0.5.10", "tag": "v0.5.10", "source_ref": "release/v0.5.10", + "platform_scope": "windows", "source_sha": "0000000000000000000000000000000000000000", "source_tree": "0000000000000000000000000000000000000000", "ci_run_id": 1, "ci_run_attempt": 1, "evidence_run_id": 1, "evidence_run_attempt": 1, "notes_path": ".github/release-requests/v0.5.10-notes.md", - "notes_sha256": "54091636008de339633859d60b37dc027384be492a55ed2dafc38e7ef80a403a"}, + "notes_sha256": "4ce754d303a32a0e7f7b301bb0051462b9d5bdcb5f2865e3cf3bf41de7d71c23"}, ".github/release-requests/v0.5.10.json", ".github/workflows/release-publish-v0510.yml", ) @@ -42,7 +43,7 @@ def require_finalized(spec: base.ReleaseSpec) -> None: and request["source_ref"] == "release/v0.5.10" and spec.request_path == ".github/release-requests/v0.5.10.json" and spec.workflow_path == ".github/workflows/release-publish-v0510.yml" - and spec.platform_scope == "all" + and spec.platform_scope == "windows" and request["source_sha"] != "0" * 40 and request["source_tree"] != "0" * 40 and request["ci_run_id"] > 1 and request["evidence_run_id"] > 1, "v0.5.10 固定源码或成功验收 pins 尚未完成审核;不执行任何发布操作。", @@ -52,9 +53,9 @@ def require_finalized(spec: base.ReleaseSpec) -> None: class StagedController(staged.StagedController): def run(self, stage: str, wait_secs: int = 0) -> int: require_finalized(self.spec) - # Replace only the v0.5.4 entry guard. The unchanged base dispatcher still - # authenticates, locks, restores, validates source, and calls the inherited - # staged method; no publication or acceptance gate is overridden. + # Replace only the v0.5.8 entry guard. The original dispatcher still + # authenticates, locks, restores and validates source. All Windows scope, + # acceptance, promotion and latest-preservation methods remain inherited. return base.Controller.run(self, stage, wait_secs) diff --git a/scripts/tests/test_release_github_actions_v0510.py b/scripts/tests/test_release_github_actions_v0510.py index 9e52a098f..369002c40 100644 --- a/scripts/tests/test_release_github_actions_v0510.py +++ b/scripts/tests/test_release_github_actions_v0510.py @@ -9,20 +9,22 @@ import runpy import tempfile import unittest -import zipfile from unittest import mock from scripts import release_github_actions as base -from scripts import release_github_actions_v054 as previous +from scripts import release_github_actions_v054 as v054 +from scripts import release_github_actions_v055 as v055 +from scripts import release_github_actions_v056 as v056 +from scripts import release_github_actions_v058 as previous from scripts import release_github_actions_v0510 as staged from scripts import release_windows_acceptance as worker from scripts.tests import test_release_github_actions as old -from scripts.tests import test_release_github_actions_v054 as previous_tests +from scripts.tests import test_release_github_actions_v058 as previous_tests from scripts.tests import test_release_windows_acceptance as fixtures -class V0510StagedPublicationTests(previous_tests.StagedPublicationTests): - """Run the existing staged failure/recovery suite against the new authority.""" +class V0510StagedPublicationTests(previous_tests.V058StagedPublicationTests): + """Run the reviewed Windows failure/recovery suite with the new authority.""" def setUp(self): self.temp = tempfile.TemporaryDirectory() @@ -46,7 +48,8 @@ def setUp(self): self.c.context = {**old._context(), "workflow_path": self.spec.workflow_path} self.c.state = base.new_journal(self.c.request, self.c.request_digest, self.c.context) self.c.state.update(release_id=234, tag_object_sha="a" * 40, - bundle={"workflow_run_id": 345}, assets=fixtures.assets("0.5.10")) + bundle={"workflow_run_id": 345, "platform_scope": "windows"}, + assets=fixtures.assets("0.5.10", "windows")) self.c.state["effects"]["draft"] = old._effect(self.c._draft_intent(), status="succeeded") self.release = {**self.c._draft_intent(), "id": 234, "published_at": None, "author": {"id": base.BOT_ID, "login": base.BOT_LOGIN}, @@ -57,6 +60,8 @@ def setUp(self): self.c._find_release = mock.Mock(side_effect=lambda: copy.deepcopy(self.release)) self.c._verify_tag = mock.Mock() self.c._expected_assets = mock.Mock(return_value=self.c.state["assets"]) + self.latest = {"id": 123, "tag_name": "v0.5.3", "draft": False, "prerelease": False} + self.c.client.fetch_json.side_effect = lambda suffix: copy.deepcopy(self.latest) if suffix == "/releases/latest" else None self.c._save() self.output = contextlib.redirect_stdout(io.StringIO()) self.output.__enter__() @@ -81,80 +86,54 @@ def test_unfinalized_source_pins_reject_before_network_or_mutation(self): self.assertNotIn("prepare-publish", staged.StagedController.stages) self.assertIn("publish", base.Controller.stages) - def test_finalized_entry_uses_the_original_authenticated_dispatcher(self): - with mock.patch.object(base.Controller, "run", return_value=17) as dispatch: - self.assertEqual(self.c.run("status-acceptance", 1), 17) - dispatch.assert_called_once_with(self.c, "status-acceptance", 1) + def test_all_earlier_entries_and_crossed_workflows_fail_the_v0510_guard(self): + for module in (v054, v055, v056, previous): + with self.subTest(tag=module.SPEC.pinned_request["tag"]), self.assertRaises(base.ReleaseControlError): + staged.require_finalized(module.SPEC) + wrong = base.ReleaseSpec(dict(self.spec.pinned_request), self.spec.request_path, + module.SPEC.workflow_path) + with self.assertRaises(base.ReleaseControlError): + staged.require_finalized(wrong) - def test_another_fixed_entry_cannot_pass_the_v0510_guard(self): - with self.assertRaises(base.ReleaseControlError): - staged.require_finalized(previous.SPEC) - wrong_workflow = base.ReleaseSpec(dict(self.spec.pinned_request), self.spec.request_path, - previous.SPEC.workflow_path) - with self.assertRaises(base.ReleaseControlError): - staged.require_finalized(wrong_workflow) - - def test_v054_report_cannot_satisfy_the_v0510_acceptance_request(self): + def test_v058_report_and_rebound_digest_cannot_authorize_v0510(self): self.acceptance() request = self.c._windows_request() - previous_report = fixtures.report(fixtures.request()) - with self.assertRaises(base.ReleaseControlError): - worker.validate_report(previous_report, request, "win32-x64", 456, 1) - previous_report["request_sha256"] = worker.request_digest(request) - with self.assertRaises(base.ReleaseControlError): - worker.validate_report(previous_report, request, "win32-x64", 456, 1) - + value = fixtures.report(fixtures.fixed_request(previous.SPEC)) + for changed_digest in (False, True): + if changed_digest: + value["request_sha256"] = worker.request_digest(request) + with self.subTest(changed_digest=changed_digest), self.assertRaises(base.ReleaseControlError): + worker.validate_report(value, request, "win32-x64", 456, 1) - def test_missing_or_invalid_v054_native_evidence_blocks_promotion(self): - self.acceptance() - request = self.c._windows_request() - for mutate in (lambda r: r["scenarios"].pop("v054_unconfigured"), - lambda r: r["scenario_exit_codes"].update(v054_configured=2), - lambda r: r["v054_configured"]["upstream_runtime"].update(git_commit="f" * 40), - lambda r: r["v054_configured"]["cleanup"].update(complete=False)): - value = fixtures.report(request, "win32-x64") - mutate(value) - buffer = io.BytesIO() - with zipfile.ZipFile(buffer, "w") as archive: - archive.writestr("report.json", base._json_bytes(value)) - data = buffer.getvalue() - self.archives[1] = data - self.artifacts[0].update(size_in_bytes=len(data), digest="sha256:" + hashlib.sha256(data).hexdigest()) - with mock.patch.object(self.c, "_mutate") as effect, self.assertRaises(base.ReleaseControlError): - self.c.prepare_promotion() - effect.assert_not_called() - self.assertNotIn("promote", self.c.state["effects"]) - - def test_all_platform_scope_and_fixed_five_scenario_authority(self): - self.assertEqual(self.spec.platform_scope, "all") - self.assertGreater(len(self.c.state["assets"]), 11) + def test_windows_scope_requires_exact_eleven_assets_and_five_scenarios(self): + expected = {"SHA256SUMS", "manifest.json", "webcodex-release-manifest.json"} + for platform in worker.PLATFORMS: + expected.update((f"webcodex-v0.5.10-{platform}.tar.gz", + f"webcodex-desktop-v0.5.10-{platform}-setup.exe", + f"webcodex-unified-v0.5.10-{platform}.exe", + f"webcodex-source-v0.5.10-{platform}.json")) + self.assertEqual(set(self.c.state["assets"]), expected) + self.assertEqual(len(expected), 11) self.acceptance() request = self.c._windows_request() self.assertEqual(worker.scenarios_for_request(request), worker.V056_SCENARIOS) with mock.patch.object(staged, "SPEC", self.spec): self.assertIs(worker.select_release_spec(request), self.spec) - wrong = base.ReleaseSpec({**dict(self.spec.pinned_request), "platform_scope": "windows"}, - self.spec.request_path, self.spec.workflow_path) - with self.assertRaises(base.ReleaseControlError): - staged.require_finalized(wrong) - - def test_prior_windows_authority_and_reports_cannot_authorize_all_platform_release(self): - from scripts import release_github_actions_v058 as windows_entry - with self.assertRaises(base.ReleaseControlError): - staged.require_finalized(windows_entry.SPEC) - self.acceptance() - request = self.c._windows_request() - value = fixtures.report(fixtures.fixed_request(windows_entry.SPEC)) - for rebound in (False, True): - if rebound: - value["request_sha256"] = worker.request_digest(request) - with self.subTest(rebound=rebound), self.assertRaises(base.ReleaseControlError): - worker.validate_report(value, request, "win32-x64", 456, 1) + def test_all_platform_and_implicit_scope_reject_before_dispatch(self): + for explicit in (True, False): + request = {**dict(self.spec.pinned_request), "platform_scope": "all"} + if not explicit: + request.pop("platform_scope") + self.c.spec = base.ReleaseSpec(request, self.spec.request_path, self.spec.workflow_path) + with self.subTest(explicit=explicit), mock.patch.object(base.Controller, "run") as dispatch, \ + self.assertRaises(base.ReleaseControlError): + self.c.run("preflight") + dispatch.assert_not_called() class V0510FixedWorkflowContractTests(unittest.TestCase): - def test_script_and_shared_worker_keep_the_same_validation_error_identity(self): + def test_script_and_worker_preserve_one_error_class_and_windows_controller(self): root = Path(__file__).resolve().parents[2] entry = runpy.run_path(str(root / "scripts/release_github_actions_v0510.py"), run_name="v0510_entry_fixture") self.assertIs(entry["base"].ReleaseControlError, worker.control.ReleaseControlError) @@ -167,20 +146,27 @@ def test_fixed_request_notes_and_code_owned_spec_agree(self): self.assertEqual(hashlib.sha256(notes).hexdigest(), staged.SPEC.pinned_request["notes_sha256"]) self.assertEqual(staged.SPEC.pinned_request["tag"], "v0.5.10") self.assertEqual(staged.SPEC.pinned_request["source_ref"], "release/v0.5.10") + self.assertEqual(staged.SPEC.platform_scope, "windows") - def test_existing_staged_gates_are_inherited_without_policy_overrides(self): + def test_only_fixed_entry_guard_is_overridden(self): + self.assertEqual({name for name, value in vars(staged.StagedController).items() if callable(value)}, {"run"}) self.assertIs(staged.StagedController.stages, previous.StagedController.stages) - for name in ("_authenticate", "_lock", "restore_state", "_source", "prepare_preview", "publish_preview", - "verify_preview", "prepare_acceptance", "dispatch_acceptance", "_acceptance_reports", - "status_acceptance", "prepare_promotion", "promote", "verify_public", "status_post"): + for name in ("_authenticate", "_lock", "restore_state", "_source", "_proofs", "publish_preview", + "_windows_request", "prepare_acceptance", "dispatch_acceptance", "_acceptance_reports", + "status_acceptance", "_require_publication_intent", "_validate_release_identity", + "_latest_identity", "_preserved_latest", "_verify_preserved_latest", "_publication_intent", + "prepare_preview", "verify_preview", "prepare_promotion", "_verify_latest", "promote", + "verify_public", "_post_scope", "_require_windows_post_scope", "prepare_post", + "dispatch_post", "status_post"): with self.subTest(method=name): self.assertIs(getattr(staged.StagedController, name), getattr(previous.StagedController, name)) def test_publisher_preserves_all_reviewed_steps_permissions_and_checkpoints(self): root = Path(__file__).resolve().parents[2] - original = (root / ".github/workflows/release-publish-v059.yml").read_text() - expected = original.replace("v0.5.9", "v0.5.10").replace("v059", "v0510") + original = (root / previous.SPEC.workflow_path).read_text() + expected = original.replace("v0.5.8", "v0.5.10").replace("v058", "v0510") expected = expected.replace(" scripts.tests.test_release_github_actions_v0510\n", + " scripts.tests.test_release_github_actions_v058\n" " scripts.tests.test_release_github_actions_v059\n" " scripts.tests.test_release_github_actions_v0510\n") actual = (root / staged.SPEC.workflow_path).read_text() From 6669464dd549d5795bbcdf398e1b93f1fc517ae9 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 17 Nov 2026 05:39:41 +0800 Subject: [PATCH 3/3] chore(release): bind v0.5.10 to successful Windows source proofs Pin ce7d710 and its exact successful source CI and readiness evidence attempts. Constraint: Retain fixed Windows scope and immutable artifact gates Confidence: high Scope-risk: narrow --- .github/release-requests/v0.5.10.json | 8 ++++---- scripts/release_github_actions_v0510.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/release-requests/v0.5.10.json b/.github/release-requests/v0.5.10.json index 741943ced..4dd2ad40e 100644 --- a/.github/release-requests/v0.5.10.json +++ b/.github/release-requests/v0.5.10.json @@ -1,8 +1,8 @@ { "ci_run_attempt": 1, - "ci_run_id": 1, + "ci_run_id": 43957217663, "evidence_run_attempt": 1, - "evidence_run_id": 1, + "evidence_run_id": 43957217711, "github_only": true, "include_runtime_installers": false, "include_unified_installers": true, @@ -15,8 +15,8 @@ "repo_id": 1404596174, "schema_version": 1, "source_ref": "release/v0.5.10", - "source_sha": "0000000000000000000000000000000000000000", - "source_tree": "0000000000000000000000000000000000000000", + "source_sha": "ce7d71027f7773855983a50a92eaca58fb248c53", + "source_tree": "fa09d1ea4ddfef0dbd10169849106ff3ae8b6c24", "tag": "v0.5.10", "version": "0.5.10" } diff --git a/scripts/release_github_actions_v0510.py b/scripts/release_github_actions_v0510.py index 95aefc1d1..bfde293bf 100644 --- a/scripts/release_github_actions_v0510.py +++ b/scripts/release_github_actions_v0510.py @@ -25,10 +25,10 @@ {**base.PINNED_REQUEST, "version": "0.5.10", "tag": "v0.5.10", "source_ref": "release/v0.5.10", "platform_scope": "windows", - "source_sha": "0000000000000000000000000000000000000000", - "source_tree": "0000000000000000000000000000000000000000", - "ci_run_id": 1, "ci_run_attempt": 1, - "evidence_run_id": 1, "evidence_run_attempt": 1, + "source_sha": "ce7d71027f7773855983a50a92eaca58fb248c53", + "source_tree": "fa09d1ea4ddfef0dbd10169849106ff3ae8b6c24", + "ci_run_id": 43957217663, "ci_run_attempt": 1, + "evidence_run_id": 43957217711, "evidence_run_attempt": 1, "notes_path": ".github/release-requests/v0.5.10-notes.md", "notes_sha256": "4ce754d303a32a0e7f7b301bb0051462b9d5bdcb5f2865e3cf3bf41de7d71c23"}, ".github/release-requests/v0.5.10.json",