feat(update): integrate managed installs and recoverable in-app updates (#6168)
Add owner-aware Stable and Preview updates with explicit consent, verified release plans, protected process handoff and bounded service recovery. Keep configuration and conversations separate from program rollback. Include the compact About controls, Windows long-path support, native package recovery checks and optional macOS Dock lifecycle integration. Preserve documented guidance for installations owned by other managers. This code integration does not publish packages, enable signing or advance the public update channel. Co-authored-by: chengyongru <61816729+chengyongru@users.noreply.github.com>
This commit is contained in:
1 parent
76da55994b
commit
fbb61a373f
216 files changed
+27948
-1084
No files matched your search
+121
-20
@@ -141,7 +141,9 @@ jobs:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.python_required == 'true'
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 20
|
||||
# Windows runs real isolated update jobs before the complete compatibility
|
||||
# suite; that suite was still progressing at the former 20-minute job cap.
|
||||
timeout-minutes: ${{ matrix.os == 'windows-latest' && 30 || 20 }}
|
||||
env:
|
||||
PYTEST_ADDOPTS: "-o tmp_path_retention_policy=failed -p scripts.pytest_timing"
|
||||
strategy:
|
||||
@@ -152,22 +154,22 @@ jobs:
|
||||
os: ubuntu-latest
|
||||
python-version: "3.11"
|
||||
coverage: false
|
||||
# CLI command tests assert exact Rich terminal output; run them
|
||||
# serially below so xdist cannot change terminal-width rendering.
|
||||
pytest_args: "-n auto --dist loadfile --ignore=tests/cli/test_commands.py"
|
||||
# Keep exact Rich output and real prompt_toolkit pipes in a fresh
|
||||
# CLI process: long-lived workers can exceed select()'s fd limit.
|
||||
pytest_args: "-n auto --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py"
|
||||
- name: latest, 3.14 + coverage
|
||||
os: ubuntu-latest
|
||||
python-version: "3.14"
|
||||
coverage: true
|
||||
pytest_args: "-n auto --dist loadfile --ignore=tests/cli/test_commands.py"
|
||||
pytest_args: "-n auto --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py"
|
||||
- name: Windows, 3.14
|
||||
os: windows-latest
|
||||
python-version: "3.14"
|
||||
coverage: false
|
||||
# Real PowerShell, browser-handoff, and process-tree tests run
|
||||
# serially so xdist workers do not compete for native processes.
|
||||
# Keep threaded storage work bounded without adding another runner.
|
||||
pytest_args: "-n 3 --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/tools/test_exec_platform.py --ignore=tests/cli/test_wsl_browser.py"
|
||||
# Process identities run serially; isolated update jobs use case-level
|
||||
# scheduling below so one file cannot serialize all real venv work.
|
||||
# Retain main's three-worker budget and the separate native-process job.
|
||||
pytest_args: "-n 3 --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py --ignore=tests/tools/test_exec_platform.py --ignore=tests/cli/test_wsl_browser.py --ignore=tests/test_install_scripts.py --ignore=tests/test_update_jobs.py --ignore=tests/test_update_profiles.py"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -200,6 +202,13 @@ jobs:
|
||||
- name: Verify dependency consistency
|
||||
run: uv pip check
|
||||
|
||||
- name: Install pipx for offline installer checks
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
uv tool install pipx==1.17.12
|
||||
uv tool dir --bin >> "$GITHUB_PATH"
|
||||
|
||||
# Channel requirements live in manifests rather than uv.lock. Avoid a
|
||||
# later uv run sync pruning the packages installed by the previous step.
|
||||
- name: Lint with ruff
|
||||
@@ -210,6 +219,27 @@ jobs:
|
||||
if: matrix.coverage
|
||||
run: uv run --no-sync basedpyright
|
||||
|
||||
- name: Check Windows update coordination before the full suite
|
||||
if: runner.os == 'Windows'
|
||||
run: >-
|
||||
uv run --no-sync python -m pytest
|
||||
tests/test_installation_lock.py
|
||||
tests/test_update_profiles.py
|
||||
tests/utils/test_helpers.py::test_atomic_record_reader_does_not_block_concurrent_replacement
|
||||
tests/gateway/test_runtime.py::test_runtime_state_publish_keeps_existing_snapshot_readable
|
||||
tests/gateway/test_runtime.py::test_runtime_state_reader_does_not_block_publish_while_decoding
|
||||
-q --junitxml=test-results/coordination.xml --timing-report=test-results/coordination.json
|
||||
|
||||
# Each update job owns its venv, HOME, profile and lock directory. Preserve
|
||||
# the real installation/restore checks, but avoid a loadfile straggler and
|
||||
# disk contention with timing-sensitive runtime-registration checks.
|
||||
- name: Run Windows isolated update jobs
|
||||
if: runner.os == 'Windows'
|
||||
run: >-
|
||||
uv run --no-sync python -m pytest tests/test_update_jobs.py
|
||||
-n 3 --dist load -vv --durations=25 --durations-min=1.0
|
||||
--junitxml=test-results/update-jobs.xml --timing-report=test-results/update-jobs.json
|
||||
|
||||
- name: Run tests with coverage
|
||||
if: matrix.coverage
|
||||
run: >-
|
||||
@@ -220,11 +250,12 @@ jobs:
|
||||
--junitxml=test-results/main.xml --timing-report=test-results/main.json
|
||||
--durations=25 --durations-min=1.0
|
||||
|
||||
- name: Run serial CLI command tests with coverage
|
||||
- name: Run serial CLI input and command tests with coverage
|
||||
if: matrix.coverage
|
||||
run: >-
|
||||
uv run --no-sync python -m pytest
|
||||
tests/cli/test_commands.py
|
||||
tests/cli/test_cli_input.py tests/cli/test_desktop_target.py
|
||||
tests/cli/test_desktop_target_entrypoints.py tests/cli/test_commands.py
|
||||
--cov=nanobot --cov-append --cov-report=term-missing:skip-covered
|
||||
--junitxml=test-results/cli.xml --timing-report=test-results/cli.json
|
||||
--durations=25 --durations-min=1.0
|
||||
@@ -237,11 +268,12 @@ jobs:
|
||||
--junitxml=test-results/main.xml --timing-report=test-results/main.json
|
||||
--durations=25 --durations-min=1.0
|
||||
|
||||
- name: Run serial CLI command compatibility tests
|
||||
- name: Run serial CLI input and command compatibility tests
|
||||
if: ${{ !matrix.coverage }}
|
||||
run: >-
|
||||
uv run --no-sync python -m pytest
|
||||
tests/cli/test_commands.py
|
||||
tests/cli/test_cli_input.py tests/cli/test_desktop_target.py
|
||||
tests/cli/test_desktop_target_entrypoints.py tests/cli/test_commands.py
|
||||
--junitxml=test-results/cli.xml --timing-report=test-results/cli.json
|
||||
--durations=25 --durations-min=1.0
|
||||
|
||||
@@ -293,6 +325,22 @@ jobs:
|
||||
--junitxml=test-results/process.xml --timing-report=test-results/process.json
|
||||
--durations=25 --durations-min=1.0
|
||||
|
||||
- name: Install pipx for offline installer checks
|
||||
shell: bash
|
||||
run: |
|
||||
uv tool install pipx==1.17.12
|
||||
uv tool dir --bin >> "$GITHUB_PATH"
|
||||
|
||||
# Installer subprocesses run here, parallel to the broad Windows suite.
|
||||
# Each case owns an isolated manager/config root, so individual cases can
|
||||
# run concurrently without sharing a console or package installation.
|
||||
# Keep four workers: three exceed this job's budget on native Windows.
|
||||
- name: Run Windows installer checks
|
||||
run: >-
|
||||
uv run --no-sync python -m pytest tests/test_install_scripts.py
|
||||
-n 4 --dist load -x -vv --durations=10
|
||||
--junitxml=test-results/installers.xml --timing-report=test-results/installers.json
|
||||
|
||||
- name: Upload Windows process test timings
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -314,7 +362,7 @@ jobs:
|
||||
- name: Set up Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: 1.3.6
|
||||
bun-version: 1.3.13
|
||||
|
||||
- name: Verify npm lockfile
|
||||
working-directory: webui
|
||||
@@ -361,7 +409,7 @@ jobs:
|
||||
- name: Set up Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: 1.3.6
|
||||
bun-version: 1.3.13
|
||||
|
||||
- name: Install WebUI dependencies
|
||||
working-directory: webui
|
||||
@@ -391,10 +439,12 @@ jobs:
|
||||
|
||||
tui:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.tui_required == 'true'
|
||||
if: needs.changes.outputs.tui_required == 'true' || needs.changes.outputs.python_required == 'true' || needs.changes.outputs.webui_required == 'true'
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 10
|
||||
# Native build + clean install + recovery/next-update journeys on Windows.
|
||||
# Each subprocess is separately bounded by the acceptance harness.
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -439,11 +489,10 @@ jobs:
|
||||
working-directory: tui
|
||||
run: python3 scripts/pty_smoke.py
|
||||
|
||||
- name: Set up Python for ConPTY smoke test
|
||||
if: runner.os == 'Windows'
|
||||
- name: Set up Python for native package acceptance
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.13'
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Test TUI in a real ConPTY terminal
|
||||
if: runner.os == 'Windows'
|
||||
@@ -472,6 +521,58 @@ jobs:
|
||||
bun scripts/release-notices.ts win32-x64
|
||||
python scripts/package-release.py win32-x64
|
||||
|
||||
- name: Build and install the native application package
|
||||
shell: bash
|
||||
env:
|
||||
NATIVE_TARGET: ${{ runner.os == 'Windows' && 'win32-x64' || 'linux-x64' }}
|
||||
run: |
|
||||
python -m pip install --disable-pip-version-check build
|
||||
python -m build --outdir "$RUNNER_TEMP/python-dist"
|
||||
# Archive verification shares the installed launcher's dependencies.
|
||||
# Install the intermediate in this build environment, not the separate
|
||||
# clean-home environment used by the public-installer acceptance probe.
|
||||
python -m pip install --disable-pip-version-check "$(find "$RUNNER_TEMP/python-dist" -name '*.whl' -print -quit)"
|
||||
python -m scripts.build_tui_wheels \
|
||||
--wheel "$(find "$RUNNER_TEMP/python-dist" -name '*.whl' -print -quit)" \
|
||||
--tui-dir tui/dist --target "$NATIVE_TARGET" --out-dir "$RUNNER_TEMP/native-wheel"
|
||||
version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
|
||||
python -I scripts/verify_installed_release.py \
|
||||
--install-wheel "$(find "$RUNNER_TEMP/native-wheel" -name '*.whl' -print -quit)" \
|
||||
--version "$version" --commit "$(git rev-parse HEAD)" --gateway \
|
||||
--report "$RUNNER_TEMP/native-install-report.json"
|
||||
|
||||
- name: Exercise updates with the default Windows path policy
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Only this disposable runner changes. Do not require users to enable
|
||||
# machine-wide long paths for an ordinary update's atomic temp files.
|
||||
$key = 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem'
|
||||
Set-ItemProperty -Path $key -Name LongPathsEnabled -Value 0
|
||||
if ((Get-ItemPropertyValue -Path $key -Name LongPathsEnabled) -ne 0) {
|
||||
throw 'Native update acceptance requires LongPathsEnabled=0'
|
||||
}
|
||||
Write-Output 'Packaged update/recovery acceptance: LongPathsEnabled=0'
|
||||
|
||||
- name: Verify packaged upgrades and automatic service recovery
|
||||
shell: bash
|
||||
run: |
|
||||
python -I scripts/verify_packaged_update.py \
|
||||
--wheel "$(find "$RUNNER_TEMP/native-wheel" -name '*.whl' -print -quit)" \
|
||||
--commit "$(git rev-parse HEAD)" --output "$RUNNER_TEMP/packaged-update"
|
||||
|
||||
- name: Retain the native package acceptance report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: native-install-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
path: |
|
||||
${{ runner.temp }}/native-install-report.json
|
||||
${{ runner.temp }}/packaged-update/packaged-update-report.json
|
||||
${{ runner.temp }}/packaged-update/*/result.json
|
||||
if-no-files-found: error
|
||||
retention-days: 3
|
||||
|
||||
docker:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.docker_required == 'true'
|
||||
|
||||
Reference in new issue
Block a user