feat(update): add installation-aware updates for Web and CLI
Description
Add installation-aware stable updates across the CLI and Web UI.
- Detect PyPI, full editable source, CLI-only editable source, Docker, and unsupported installations without guessing.
- Add
deeptutor update --check, managed PyPI upgrades, and safe source fast-forwards to stable release tags. - Surface update status and release notes in the Web version badge.
- Allow administrators to update and restart managed PyPI or clean editable Web installs while preserving launcher arguments.
- Keep Docker host-managed: containers only receive image update and recreation guidance.
- Persist a single update job so progress and failures survive the launcher restart boundary.
Safety constraints include backend-generated command arguments with no shell, refusal while conversations are active, and source-update rejection for dirty worktrees, detached HEADs, diverged branches, or non-fast-forward release tags. Source updates never stash, reset, rebase, or merge user work. The Web request revalidates the installation mode immediately before job creation; conflicting observations fail closed with HTTP 409.
Related Issues
- None.
Module(s) Affected
- [ ]
agents - [x]
api - [ ]
config - [ ]
core - [ ]
knowledge - [ ]
logging - [x]
services - [ ]
tools - [ ]
utils - [x]
web(Frontend) - [x]
docs(Documentation) - [ ]
scripts - [x]
tests - [x] Other:
cli,runtime,update
Checklist
- [x] I have read and followed the contribution guidelines.
- [x] My code follows the project's coding standards.
- [x] I have run the repository checks and fixed issues in all files changed by this PR.
- [x] I have added relevant unit, integration, and end-to-end tests.
- [x] I have updated the documentation.
- [x] My changes do not introduce any new security vulnerabilities.
Validation
uv run pytest -q: 3618 passed, 7 skipped.bun test: 375 passed.bun run test:node: 375 passed.bun x tsc --noEmit: passed.bun run lint: 0 errors (56 existing warnings).bun run i18n:parity: passed.- Managed Playwright functional E2E: 9 passed.
pre-commiton all 43 PR files: all hooks passed, including Ruff, Prettier, detect-secrets, Bandit, and MyPy.
Additional Notes
pre-commit run --all-files passes every hook except that the repository's Prettier hook rewrites 33 unchanged files already present on upstream/dev. Those unrelated formatting changes are intentionally excluded; the same Prettier hook passes for every file in this PR.
Source-update failures attempt to restore the application process, but do not promise a full Git or dependency rollback. Docker self-update remains out of scope because the container root filesystem may be read-only and image replacement belongs to the host.
UI Preview
The available-update state uses a compact blue download icon so it remains visually distinct from the Docs and GitHub links.
Update available
Update confirmation
Addressed the three points from the latest Copilot review:
- Bounded update-status checks to three retries (four total attempts), with functional E2E coverage proving requests stop.
- Reused the shared response parser so
fetchUpdateStatuspreserves FastAPI JSONdetail, with a focused API test. - Removed every managed Playwright home on normal exit, SIGINT, and SIGTERM; the integration test now runs correctly under both Bun and the repository Node test runner.
Validation: Python 3617 passed / 7 skipped; Bun source tests 374 passed; Node-runner tests 374 passed; managed E2E 9 passed; typecheck, lint, i18n parity, and all PR pre-commit hooks passed.
Additional test-isolation hardening is now included in d86625de:
bun run test:nodecompiles into a unique directory undernode_modules/.cache, outside Bun test discovery.- The alias loader receives that exact directory instead of assuming
web/dist/node-tests. - Normal completion, child failure, SIGINT, and SIGTERM all clean the generated directory.
- Verified the real sequence:
bun run test:nodepasses 375 tests and leaves no compiled test directory; a following unfilteredbun testalso passes exactly 375 tests with no duplicate execution.
Addressed the latest Copilot installation-consistency concern in fc1d0bbe.
- A Web request whose coordinator reports
PYPInow verifies that the request-scoped installation is alsoPYPI. - A mismatch fails closed with HTTP 409 before
UpdateJobStore.create(); the regression test asserts that no job state is written. - Focused router tests: 13 passed.
- Full Python suite: 3618 passed, 7 skipped.
- Two-axis review: no findings.
- PR-wide pre-commit checks: all passed.