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..1c2e5f7a0 --- /dev/null +++ b/.github/release-requests/v0.5.10-notes.md @@ -0,0 +1,27 @@ +# WebCodex v0.5.10 + +## 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. +- 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 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 身份及回执。交付结果不确定不代表获得重放授权。 +- 更新当前 Cargo 布局的测试夹具并修复 Windows 测试锁处理,保留校验与锁竞争检查。 + +历史 MCP 408 的根因仍未得到证明。已观察到的连接通过重新连接恢复;本版本不宣称修复了该事件的根因。 + +请选择与 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 new file mode 100644 index 000000000..4dd2ad40e --- /dev/null +++ b/.github/release-requests/v0.5.10.json @@ -0,0 +1,22 @@ +{ + "ci_run_attempt": 1, + "ci_run_id": 43957217663, + "evidence_run_attempt": 1, + "evidence_run_id": 43957217711, + "github_only": true, + "include_runtime_installers": false, + "include_unified_installers": true, + "notes_path": ".github/release-requests/v0.5.10-notes.md", + "notes_sha256": "4ce754d303a32a0e7f7b301bb0051462b9d5bdcb5f2865e3cf3bf41de7d71c23", + "owner": "9holy", + "owner_id": 45361924, + "platform_scope": "windows", + "repo": "9holy/webcodex", + "repo_id": 1404596174, + "schema_version": 1, + "source_ref": "release/v0.5.10", + "source_sha": "ce7d71027f7773855983a50a92eaca58fb248c53", + "source_tree": "fa09d1ea4ddfef0dbd10169849106ff3ae8b6c24", + "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..e4066eca2 --- /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 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 + 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 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 + 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: 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 + 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 Windows public bytes and preserved all-platform latest + 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..bfde293bf --- /dev/null +++ b/scripts/release_github_actions_v0510.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +"""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. +""" +from __future__ import annotations + +from pathlib import Path +import sys + +if __package__: + from . import release_github_actions as base + 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_v058 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", + "platform_scope": "windows", + "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", + ".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 == "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 尚未完成审核;不执行任何发布操作。", + ) + + +class StagedController(staged.StagedController): + def run(self, stage: str, wait_secs: int = 0) -> int: + require_finalized(self.spec) + # 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) + + +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..369002c40 --- /dev/null +++ b/scripts/tests/test_release_github_actions_v0510.py @@ -0,0 +1,180 @@ +from __future__ import annotations + +import contextlib +import copy +import hashlib +import io +import json +from pathlib import Path +import runpy +import tempfile +import unittest +from unittest import mock + +from scripts import release_github_actions as base +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_v058 as previous_tests +from scripts.tests import test_release_windows_acceptance as fixtures + + +class V0510StagedPublicationTests(previous_tests.V058StagedPublicationTests): + """Run the reviewed Windows failure/recovery suite with 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, "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}, + "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.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__() + 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_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_v058_report_and_rebound_digest_cannot_authorize_v0510(self): + self.acceptance() + request = self.c._windows_request() + 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_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) + + 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_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) + 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") + self.assertEqual(staged.SPEC.platform_scope, "windows") + + 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", "_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 / 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() + 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()