diff --git a/.github/release-requests/v0.5.11-notes.md b/.github/release-requests/v0.5.11-notes.md new file mode 100644 index 000000000..13fb879a1 --- /dev/null +++ b/.github/release-requests/v0.5.11-notes.md @@ -0,0 +1,15 @@ +# WebCodex v0.5.11 + +- Space the connection cards and the first-read guide consistently in Desktop. +- Accept the cached ChatGPT `runtime_status` and `tool_manifest` names. Route cached `finish_coding_task` and `show_changes` calls through current MCP admission, including support for the old recording session field on the affected calls. +- Restore the complete stable update catalog for Windows, macOS and Linux. + +Windows users on v0.5.10 should run the v0.5.11 Full installer for their architecture for the first upgrade. The installer can upgrade the existing installation and retain its configuration and data. If the Desktop manages a local Runtime with a manually patched component, quit Desktop and run the v0.5.11 Desktop setup over the existing installation. Later complete stable releases are discoverable in Desktop. + +## 中文 + +- 调整桌面连接卡片与 ChatGPT 试读提示之间的间距。 +- 兼容旧 ChatGPT 连接缓存的 `runtime_status`、`tool_manifest`、`finish_coding_task` 和 `show_changes` 调用。在受影响的请求上按现有规则校验旧的会话记录字段。 +- 恢复 Windows、macOS 和 Linux 的完整稳定版更新清单。 + +Windows 上使用 v0.5.10 的用户,首次升级请运行对应架构的 v0.5.11 完整安装包。安装器支持原位升级并保留配置和数据。如果本机运行时由桌面端管理,且其中有手动打过补丁的组件,请先从托盘退出应用,再用 v0.5.11 桌面安装包装到原目录。之后有新的完整稳定版时,可在桌面端检查更新。 diff --git a/.github/release-requests/v0.5.11.json b/.github/release-requests/v0.5.11.json new file mode 100644 index 000000000..81af346e7 --- /dev/null +++ b/.github/release-requests/v0.5.11.json @@ -0,0 +1,21 @@ +{ + "ci_run_attempt": 1, + "ci_run_id": 44360542135, + "evidence_run_attempt": 1, + "evidence_run_id": 44360542548, + "github_only": true, + "include_runtime_installers": false, + "include_unified_installers": true, + "notes_path": ".github/release-requests/v0.5.11-notes.md", + "notes_sha256": "5210425a7dd1722a46e7cb5428ce44cc81cce505e54a349c70bb43faa23572f4", + "owner": "9holy", + "owner_id": 45361924, + "repo": "9holy/webcodex", + "repo_id": 1404596174, + "schema_version": 1, + "source_ref": "release/v0.5.11", + "source_sha": "0793e6774fa52e9d85e3f1d428c979cb7fa44abc", + "source_tree": "95529b5bbc03d9a487a43294afcc9325ad2eb00e", + "tag": "v0.5.11", + "version": "0.5.11" +} diff --git a/.github/workflows/release-publish-v0511.yml b/.github/workflows/release-publish-v0511.yml new file mode 100644 index 000000000..69d76df2e --- /dev/null +++ b/.github/workflows/release-publish-v0511.yml @@ -0,0 +1,428 @@ +name: Publish approved GitHub release v0.5.11 + +run-name: Publish WebCodex v0.5.11 + +on: + push: + branches: [main] + paths: + - .github/release-requests/v0.5.11.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.11 + 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.11.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_v0511 import SPEC, require_finalized + + if (SPEC.pinned_request["tag"] != "v0.5.11" + or SPEC.request_path != ".github/release-requests/v0.5.11.json" + or SPEC.workflow_path != ".github/workflows/release-publish-v0511.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_github_actions_v0511 + 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_v0511.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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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_v0511.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.11-${{ 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.11-${{ 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_v0511.py b/scripts/release_github_actions_v0511.py new file mode 100644 index 000000000..b78ecc4a9 --- /dev/null +++ b/scripts/release_github_actions_v0511.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +"""Fixed v0.5.11 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, successful proof attempts, and notes must be fixed in reviewed control code. +SPEC = base.ReleaseSpec( + {**base.PINNED_REQUEST, + "version": "0.5.11", "tag": "v0.5.11", "source_ref": "release/v0.5.11", + "source_sha": "0793e6774fa52e9d85e3f1d428c979cb7fa44abc", + "source_tree": "95529b5bbc03d9a487a43294afcc9325ad2eb00e", + "ci_run_id": 44360542135, "ci_run_attempt": 1, + "evidence_run_id": 44360542548, "evidence_run_attempt": 1, + "notes_path": ".github/release-requests/v0.5.11-notes.md", + "notes_sha256": "5210425a7dd1722a46e7cb5428ce44cc81cce505e54a349c70bb43faa23572f4"}, + ".github/release-requests/v0.5.11.json", + ".github/workflows/release-publish-v0511.yml", +) + + +def require_finalized(spec: base.ReleaseSpec) -> None: + request = spec.pinned_request + base._require( + request["version"] == "0.5.11" and request["tag"] == "v0.5.11" + and request["source_ref"] == "release/v0.5.11" + and spec.request_path == ".github/release-requests/v0.5.11.json" + and spec.workflow_path == ".github/workflows/release-publish-v0511.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 + and request["notes_sha256"] != "0" * 64, + "v0.5.11 固定源码或成功验收 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 4d4ec3729..9b167a312 100644 --- a/scripts/release_windows_acceptance.py +++ b/scripts/release_windows_acceptance.py @@ -54,7 +54,8 @@ def scenarios_for_request(request: dict) -> tuple[str, ...]: ("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.10", ".github/workflows/release-publish-v0510.yml")}: + ("v0.5.10", ".github/workflows/release-publish-v0510.yml"), + ("v0.5.11", ".github/workflows/release-publish-v0511.yml")}: return V056_SCENARIOS return SCENARIOS @@ -128,6 +129,8 @@ def select_release_spec(request: dict) -> control.ReleaseSpec: 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 + elif identity == ("v0.5.11", ".github/workflows/release-publish-v0511.yml"): + from scripts.release_github_actions_v0511 import SPEC, require_finalized else: raise control.ReleaseControlError("Windows 验收请求不属于已审核的固定发布入口。") require_finalized(SPEC) diff --git a/scripts/tests/test_release_github_actions_v0511.py b/scripts/tests/test_release_github_actions_v0511.py new file mode 100644 index 000000000..f885c005c --- /dev/null +++ b/scripts/tests/test_release_github_actions_v0511.py @@ -0,0 +1,87 @@ +from __future__ import annotations + +from dataclasses import replace +from pathlib import Path +import runpy +import unittest +from unittest import mock + +from scripts import release_github_actions as base +from scripts import release_github_actions_v059 as previous +from scripts import release_github_actions_v0510 as windows_only +from scripts import release_github_actions_v0511 as staged +from scripts import release_windows_acceptance as worker +from scripts.tests import test_release_windows_acceptance as fixtures + + +class V0511PublicationTests(unittest.TestCase): + def setUp(self): + self.spec = self.spec_with(source_sha="c" * 40, source_tree="d" * 40, + ci_run_id=1001, evidence_run_id=1002, notes_sha256="e" * 64) + + def spec_with(self, **pins): + return replace(staged.SPEC, pinned_request={**staged.SPEC.pinned_request, **pins}) + + def test_unfinalized_spec_never_reaches_authenticated_dispatcher(self): + controller = mock.Mock(spec=staged.StagedController) + for key, placeholder in (("source_sha", "0" * 40), ("source_tree", "0" * 40), + ("ci_run_id", 1), ("evidence_run_id", 1), ("notes_sha256", "0" * 64)): + controller.spec = replace(self.spec, pinned_request={**self.spec.pinned_request, key: placeholder}) + with self.subTest(pin=key), mock.patch.object(base.Controller, "run") as dispatch: + with self.assertRaises(base.ReleaseControlError): + staged.StagedController.run(controller, "preflight") + dispatch.assert_not_called() + + controller.spec = self.spec + with mock.patch.object(base.Controller, "run", return_value=17) as dispatch: + self.assertEqual(staged.StagedController.run(controller, "status-acceptance", 1), 17) + dispatch.assert_called_once_with(controller, "status-acceptance", 1) + + def test_fixed_policy_reuses_all_platform_stages_without_overrides(self): + staged.require_finalized(self.spec) + for spec in (previous.SPEC, windows_only.SPEC, self.spec_with(platform_scope="windows"), + replace(self.spec, workflow_path=windows_only.SPEC.workflow_path)): + with self.subTest(tag=spec.pinned_request["tag"], workflow=spec.workflow_path): + with self.assertRaises(base.ReleaseControlError): + staged.require_finalized(spec) + + self.assertEqual(self.spec.pinned_request["tag"], "v0.5.11") + self.assertEqual(self.spec.pinned_request["source_ref"], "release/v0.5.11") + self.assertEqual(self.spec.platform_scope, "all") + self.assertEqual(set(self.spec.post_workflows), {"image", "intel"}) + self.assertIs(staged.StagedController.stages, previous.StagedController.stages) + for method in ("prepare_preview", "publish_preview", "verify_preview", "prepare_acceptance", + "dispatch_acceptance", "_acceptance_reports", "status_acceptance", "prepare_promotion", + "promote", "verify_public", "prepare_post", "dispatch_post", "status_post"): + with self.subTest(method=method): + self.assertIs(getattr(staged.StagedController, method), getattr(previous.StagedController, method)) + + def test_windows_worker_requires_exact_authority_and_all_five_scenarios(self): + request = fixtures.fixed_request(self.spec) + unreviewed = dict(request, controller_workflow=previous.SPEC.workflow_path) + with mock.patch.object(staged, "SPEC", self.spec): + self.assertIs(worker.select_release_spec(request), self.spec) + with self.assertRaises(base.ReleaseControlError): + worker.select_release_spec(unreviewed) + + self.assertEqual(worker.scenarios_for_request(request), worker.V056_SCENARIOS) + for platform in worker.PLATFORMS: + with self.subTest(platform=platform): + report = fixtures.report(request, platform) + worker.validate_report(report, request, platform, 456, 1) + del report["scenarios"]["v054_configured"] + with self.assertRaises(base.ReleaseControlError): + worker.validate_report(report, request, platform, 456, 1) + + def test_workflow_preserves_reviewed_steps_permissions_and_checkpoints(self): + root = Path(__file__).resolve().parents[2] + entry = runpy.run_path(str(root / "scripts/release_github_actions_v0511.py"), run_name="v0511_fixture") + self.assertIs(entry["base"].ReleaseControlError, worker.control.ReleaseControlError) + + expected = (root / previous.SPEC.workflow_path).read_text(encoding="utf-8") + expected = expected.replace("v0.5.9", "v0.5.11").replace("v059", "v0511") + expected = expected.replace(" scripts.tests.test_release_github_actions_v0511\n", + " scripts.tests.test_release_github_actions_v059\n" + " scripts.tests.test_release_github_actions_v0510\n" + " scripts.tests.test_release_github_actions_v0511\n") + self.assertEqual((root / staged.SPEC.workflow_path).read_text(encoding="utf-8"), expected)