Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/ci-paths.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ tests = [
"scripts/run_atomic_memory_clean_migration.py", "scripts/scan_e2e_evidence.sh",
"scripts/check_atomic_memory_migration_shards.py",
"scripts/ci_role_smoke.py", "scripts/ci_installation_roles.py",
# Release tooling is covered by unit tests; the packaging and publication workflows are manual.
".github/workflows/desktop-candidate.yml", "scripts/desktop_candidate.py",
".github/workflows/desktop-release.yml", "scripts/desktop_publication_manifest.py",
"scripts/publish_desktop_release.py",
# These evaluator suites still live under the root tests/ directory.
"evaluation/memory/locomo/**", "evaluation/memory/locomo_plus/**", "evaluation/memory/write_gate/**",
"evaluation/performance/input_encoding/**",
Expand Down
211 changes: 211 additions & 0 deletions .github/workflows/desktop-candidate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
name: Desktop candidate assembly

on:
workflow_dispatch:
inputs:
version:
description: 'Desktop version (X.Y.Z); derives desktop-vX.Y.Z'
required: true
type: string
server_version:
description: 'Exact canonical Python Server package version to build'
required: true
type: string
source_sha:
description: 'Full Desktop commit SHA; must match the selected master revision'
required: true
type: string
server_source_sha:
description: 'Full Server source commit SHA; may be an earlier qualified revision'
required: true
type: string

permissions:
contents: read

run-name: Desktop candidate ${{ inputs.version || 'validation' }} · ${{ inputs.source_sha || github.sha }}

jobs:
contract:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
version: '0.13.5'
- run: uv sync --locked --no-dev --group resource-build --python 3.12
- name: Verify candidate handoff
run: |
uv run --no-sync ruff check scripts/desktop_candidate.py tests/test_desktop_candidate.py
uv run --no-sync ruff format --check scripts/desktop_candidate.py tests/test_desktop_candidate.py
uv run --no-sync ty check scripts/desktop_candidate.py tests/test_desktop_candidate.py
uv run --no-sync pytest -q tests/test_desktop_candidate.py

native:
if: github.event_name == 'workflow_dispatch' && github.repository == 'oceanbase/powercontext' && github.ref == 'refs/heads/master'
needs: contract
name: Build candidate for ${{ matrix.target }}
strategy:
fail-fast: false
max-parallel: 2
matrix:
include:
- target: windows-x86_64
runner: windows-2025
triple: x86_64-pc-windows-msvc
- target: macos-arm64
runner: macos-15
triple: aarch64-apple-darwin
- target: macos-x86_64
runner: macos-15-intel
triple: x86_64-apple-darwin
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
defaults:
run:
shell: bash
env:
DESKTOP_VERSION: ${{ inputs.version }}
SERVER_VERSION: ${{ inputs.server_version }}
SOURCE_SHA: ${{ inputs.source_sha }}
SERVER_SOURCE_SHA: ${{ inputs.server_source_sha }}
RESOURCE_TARGET: ${{ matrix.target }}
RUST_TARGET: ${{ matrix.triple }}
# Producer provenance hashes the checked-out scripts as bytes on Windows too.
GIT_CONFIG_COUNT: '1'
GIT_CONFIG_KEY_0: core.autocrlf
GIT_CONFIG_VALUE_0: 'false'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
persist-credentials: false
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
version: '0.13.5'
enable-cache: true
- name: Verify exact source and version before building
run: |
uv sync --locked --no-dev --group resource-build --python 3.12 --no-build-package cryptography --no-build-package jieba
uv run --no-sync python scripts/desktop_candidate.py identity \
--version "$DESKTOP_VERSION" --server-version "$SERVER_VERSION" --source-sha "$SOURCE_SHA" --server-source-sha "$SERVER_SOURCE_SHA"
- name: Select pinned compiler for Intel resource production
if: matrix.target == 'macos-x86_64'
run: echo 'DEVELOPER_DIR=/Applications/Xcode_16.4.app/Contents/Developer' >> "$GITHUB_ENV"
- name: Produce and smoke-test the pinned 09-C resources
run: |
uv run --no-sync python scripts/prepare_managed_resources.py \
--target "$RESOURCE_TARGET" --source-ref "$SERVER_SOURCE_SHA" --server-version "$SERVER_VERSION" \
--output build/resource-inputs --download-cache build/resource-downloads
inputs_sha="$(uv run --no-sync python -c 'import hashlib; from pathlib import Path; print(hashlib.sha256(Path("build/resource-inputs/inputs.json").read_bytes()).hexdigest())')"
uv run --no-sync python scripts/produce_managed_resources.py \
--inputs build/resource-inputs --inputs-sha256 "$inputs_sha" \
--server-url "https://candidate.invalid/$RESOURCE_TARGET/server.tar.gz" --output build/resources
# The Ops child writes a separate diagnostic line before the final smoke receipt.
set -o pipefail
uv run --no-sync python scripts/ci_managed_resource_smoke.py \
--candidate build/resources --serve --evidence-dir build/resource-evidence | tail -n 1 > build/resource-smoke.json
- name: Prepare exact catalog and provision pins for the Desktop build
run: |
uv run --no-sync python scripts/desktop_candidate.py prepare --resources build/resources \
--version "$DESKTOP_VERSION" --server-version "$SERVER_VERSION" --source-sha "$SOURCE_SHA" --server-source-sha "$SERVER_SOURCE_SHA"
- uses: jdx/mise-action@8418fedb1110381a0d3ba51a7a415d7c1b884550 # v5.2.2
with:
working_directory: desktop
- name: Install pinned Rust target
run: rustup toolchain install "1.95.0-$RUST_TARGET" --profile minimal
- name: Build the unsigned product configuration
working-directory: desktop
run: |
pnpm install --frozen-lockfile
# Fresh target directory, default product features and no signing secrets or updater artifacts.
test ! -e src-tauri/target
pnpm tauri build --target "$RUST_TARGET" --ci --no-sign \
--config src-tauri/tauri.ops.conf.json --config .artifacts/candidate.conf.json -- --locked
- name: Collect the normal package and exact producer outputs
run: |
uv run --no-sync python scripts/desktop_candidate.py stage \
--version "$DESKTOP_VERSION" --server-version "$SERVER_VERSION" --source-sha "$SOURCE_SHA" --server-source-sha "$SERVER_SOURCE_SHA" \
--target "$RESOURCE_TARGET" --bundles "desktop/src-tauri/target/$RUST_TARGET/release/bundle" \
--inputs build/resource-inputs --resources build/resources --smoke build/resource-smoke.json \
--output "build/legs/$RESOURCE_TARGET"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: desktop-candidate-leg-${{ matrix.target }}
path: build/legs/${{ matrix.target }}/
if-no-files-found: error
compression-level: 0
retention-days: 7
- name: Retain native smoke failure evidence
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: desktop-candidate-diagnostics-${{ matrix.target }}
path: build/resource-evidence/
if-no-files-found: ignore
retention-days: 7

assemble:
needs: native
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
DESKTOP_VERSION: ${{ inputs.version }}
SERVER_VERSION: ${{ inputs.server_version }}
SOURCE_SHA: ${{ inputs.source_sha }}
SERVER_SOURCE_SHA: ${{ inputs.server_source_sha }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
persist-credentials: false
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
version: '0.13.5'
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: desktop-candidate-leg-windows-x86_64
path: build/desktop-candidate/windows-x86_64
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: desktop-candidate-leg-macos-arm64
path: build/desktop-candidate/macos-arm64
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: desktop-candidate-leg-macos-x86_64
path: build/desktop-candidate/macos-x86_64
- name: Validate required targets and freeze manifest
run: |
set -o pipefail
uv sync --locked --no-dev --group resource-build --python 3.12
uv run --no-sync python scripts/desktop_candidate.py assemble \
--version "$DESKTOP_VERSION" --server-version "$SERVER_VERSION" --source-sha "$SOURCE_SHA" --server-source-sha "$SERVER_SOURCE_SHA" \
--root build/desktop-candidate | tee -a "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
id: upload-candidate
with:
name: desktop-candidate-${{ inputs.version }}-${{ inputs.source_sha }}
path: build/desktop-candidate/
if-no-files-found: error
compression-level: 0
retention-days: 14
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
id: upload-manifest
with:
name: desktop-candidate-manifest-${{ inputs.version }}-${{ inputs.source_sha }}
path: build/desktop-candidate/desktop-release-candidate.json
if-no-files-found: error
retention-days: 14
- name: Record exact Actions artifact identities
env:
CANDIDATE_ARTIFACT_ID: ${{ steps.upload-candidate.outputs.artifact-id }}
MANIFEST_ARTIFACT_ID: ${{ steps.upload-manifest.outputs.artifact-id }}
run: |
{
echo "candidate_run_id=$GITHUB_RUN_ID"
echo "candidate_full_artifact_id=$CANDIDATE_ARTIFACT_ID"
echo "candidate_manifest_artifact_id=$MANIFEST_ARTIFACT_ID"
} >> "$GITHUB_STEP_SUMMARY"
12 changes: 10 additions & 2 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ jobs:
name: tests (${{ matrix.python-version }}, ${{ matrix.suite }})
needs: [quality]
if: ${{ !cancelled() && needs.quality.result == 'success' && (fromJSON(needs.quality.outputs.suites || '{}').tests) }}
timeout-minutes: 40
# Allow the Python 3.14 end-to-end suite's subprocess tail to finish.
timeout-minutes: ${{ matrix.suite == 'e2e' && matrix.python-version == '3.14' && 55 || 40 }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
Expand Down Expand Up @@ -279,8 +280,15 @@ jobs:
PYTEST_ADDOPTS: --require-dsh-config-runtime --require-claude-code-python-floor
run: make unit-test

- name: Run end-to-end tests
- name: Run the ZCode service chain with native Hook deadlines
if: matrix.suite == 'e2e'
# Preserve the real Hook deadlines without competing with xdist workers.
run: uv run python -m pytest -n 0 tests/e2e/test_zcode_service_chain.py

- name: Run remaining end-to-end tests
if: matrix.suite == 'e2e'
env:
PYTEST_ADDOPTS: --ignore=tests/e2e/test_zcode_service_chain.py
run: make e2e-test

isolated-installations:
Expand Down
46 changes: 46 additions & 0 deletions docs/en/development/desktop-candidate-assembly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Desktop candidate assembly
description: Assemble exact, unqualified Desktop and managed resource candidates for Windows x64 and both macOS architectures.
---

# Desktop candidate assembly

[Issue #2112](https://github.com/oceanbase/powercontext/issues/2112) separates candidate assembly, managed resource production, and publication. The **Desktop candidate assembly** workflow builds normal product packages and reuses the [managed resource producer](managed-resource-production.md). Its outputs are unsigned Actions artifacts for validation and handoff. They cannot be released or treated as installed qualification.

## Build identity

A release owner explicitly selects the upstream `master` revision and dispatches `desktop-candidate.yml` with:

- `version`: exact Desktop `X.Y.Z`. The prospective tag is `desktop-vX.Y.Z`, independent of the Python release tag. The app package identity is `com.powercontext.desktop`.
- `server_version`: exact canonical Python Server package version (e.g. `1.5.1.dev25+g63e9665c6`), built from the pinned Server commit with the producer's locked runtime inputs. This version is independent of Desktop's version and is never inferred from a package index.
- `source_sha`: full Git commit, which must equal the workflow checkout. An existing Desktop tag may only refer to that same commit. Candidate assembly never creates a tag.
- `server_source_sha`: full Server commit. It can point to an earlier qualified Server revision. The wheel and its dependency lock come from that source; the Desktop build and the producer tools are still bound to `source_sha`.

Desktop version parts are integers from 0 to 65535, without leading zeros. The workflow uses a fresh release build without `ci-fixtures`, with the producer's exact catalog and Ops pins. It requires Windows x64 (NSIS), macOS arm64 (DMG), and macOS x64 (DMG). Linux is omitted. A later opt-in Linux release needs separately qualified assets from [#2111](https://github.com/oceanbase/powercontext/issues/2111); no Linux job can hold this required aggregate.

## Candidate handoff

Download the single successful run's `desktop-candidate-<version>-<source_sha>` artifact. The required target jobs produce same-run inputs; the aggregate never accepts uploads from preview builds, fixture manifests, or another run. Output names are `powercontext-desktop-<version>-<target>.exe` or `.dmg` under their respective target directory. Server and Ops archives, catalog, provision descriptor, input locks, producer manifests, the actual project wheel, and smoke evidence accompany each package. Target identifiers are `windows-x86_64`, `macos-arm64`, and `macos-x86_64`.

`desktop-release-candidate.json` has `schema_version: 1`, `kind: desktop-product-candidate`, `version`, `release_tag`, `source_sha`, `server_source_sha`, `server_version`, `status: unqualified_candidate`, and `publishable: false`. `contract` records the exact Desktop HTTP contract digest and operation set, and the bundled operation and compatibility files. `targets` maps each target to `build_kind: product`, `assets`, `provenance`, `qualification`, and `runtime`. The four release roles in `assets` are `desktop`, `server_archive`, `server_catalog`, and `ops_archive`. Each file entry has a root-relative `name`, byte `size`, and lowercase `sha256`. Ops provision and bundle manifest files are in `provenance` with unique basenames per target. `qualification.producer_ref` is always an unqualified producer reference. `matching_product_records` lists only bundled records matching the actual Server wheel, source, contract and operation set; an empty list leaves product protocol qualification outstanding. Even a matching record does not qualify an installer.

For publication handoff, select `desktop-candidate-manifest-<version>-<source_sha>`, which contains only the exact same `desktop-release-candidate.json`. The run summary records `candidate_run_id`, `candidate_full_artifact_id`, `candidate_manifest_artifact_id`, and `candidate_manifest_sha256`. Record the manifest artifact ID (as `candidate_artifact_id` in the publication handoff) so publication can retrieve the single file without downloading the large archives. Both Actions artifacts have a 14-day retention.

To check the complete candidate, take the manifest SHA-256 from the trusted run summary and verify the downloaded files:

```sh
uv run --locked --no-dev --group resource-build python scripts/desktop_candidate.py verify --root <download-directory> \
--version <desktop-version> --server-version <server-version> --source-sha <desktop-commit> \
--server-source-sha <server-commit> \
--manifest-sha256 <sha256-from-run-summary>
```

The checksum binds the exact manifest and asset bytes. Trust still comes from selecting a successful run of this workflow on the intended upstream source. Record its run and artifact identity; a rerun can produce different bytes under the same human-readable name and cannot silently replace an accepted set. Candidate artifacts expire after 14 days; they are not an availability channel for installed clients.

## Qualification before publication

CI consumes the real catalog and archive, launches a disposable SQLite Server with bundled Python, and inspects local state with the independent Ops entry. This does not exercise a real HTTP download or register a service. The candidate catalog deliberately uses `candidate.invalid`.

The final platform packagers own signed Windows x64 and signed/notarized macOS arm64/x64 builds and install the approved independent Ops helper at the [fixed current-user location](../docs/operate/local-server-ops.md#provisioning-the-bridge). Desktop removal must preserve the independent helper, service state, and user data. Windows must retain both `pythonw.exe` for the Server service and `python.exe` for console use. The candidate packages embed pins but do not install the independent helper. Provisioning the helper, clean-machine installation and repair, reboot/login and native service lifecycle are part of [#2108](https://github.com/oceanbase/powercontext/issues/2108) and [#2109](https://github.com/oceanbase/powercontext/issues/2109).

When building the platform release, use the approved immutable resource URL and regenerate any affected inventory, archive, catalog, and provision digest after signing changes nested code. Embed the final pins before signing the outer Desktop package. Preserve the candidate manifest digest and record the separately qualified final package and resource digests; candidate bytes and signed bytes need not be identical. Final acceptance requires the same Desktop/Server combination to demonstrate identity, Scope and Memory, statistics, Runtime observation, and local setup through to the default Scope. Do not substitute a rebuilt wheel or a fixture for [#2101](https://github.com/oceanbase/powercontext/issues/2101) qualification. Publication and re-download verification consume the exact final signed and tested bytes.
Loading
Loading