mirror of
https://github.com/trycua/lume.git
synced 2026-02-15 10:49:42 -06:00
* feat(lume): add unattended macOS VM setup with VNC automation Add experimental unattended setup feature for automating macOS Setup Assistant: - New `lume setup` command for running unattended setup on existing VMs - Add `--unattended` flag to `lume create` for automated VM provisioning - VNC-based automation with OCR text detection for UI interaction - Built-in preset support (tahoe) with YAML config bundled in binary - Health check functionality to verify setup success via SSH - SSH availability indicator in `lume ls` output - API server endpoint POST /lume/vms/:name/setup Also includes: - Restructured lume documentation into dedicated section - Documentation generators for CLI and API reference - Debug screenshot support with unique temp folders * fix(lume): update MockVNCService and tests for new VNC protocol methods - Add missing automation protocol methods to MockVNCService - Update VMDetailsPrinterTests to include new ssh column * fix(lume): remove ineffective Task.isCancelled check in UnattendedInstaller Task.isCancelled only returns true for explicitly cancelled tasks, not for tasks that threw errors. The check was ineffective for detecting VM startup failures. Startup errors are now properly caught when attempting to connect to the VNC input client. * fix(lume): update CommandDocExtractor for setup command Update setupDoc to match actual Setup.swift implementation: - Change option name from "config" to "unattended" - Add missing debug-dir option - Mark vnc-port as optional (has default value) - Update help text to match actual command - Add [Preview] prefix and discussion text Also update createDoc unattended option help text. * chore(ci): reorganize workflows and add path-filtered release notes - Rename workflow files with consistent prefixes: - ci-* for CI workflows (lint, tests, validation) - lume-* for lume workflows (ci, publish) - release-* for release workflows (bump-version, github-reusable) - Update all cross-references to renamed workflows - Add lume and npm packages to release-bump-version.yml - Standardize version management with .bumpversion.cfg files for: - libs/typescript/core (0.1.3) - libs/typescript/computer (0.1.5) - libs/typescript/cua-cli (0.1.8) - libs/lume (0.2.23) - Sync lume version in Main.swift to match deployed release (0.2.23) - Change ci-cua-models.yml to trigger on libs/python changes instead of schedule - Add path-filtered release notes to all publish workflows: - Filter commits by module path for accurate changelogs - Only include changes relevant to the specific package being released * docs: update documentation and improve code examples - Update README with clearer project description - Add Python version requirements to examples - Update blog posts and documentation - Improve lume installation documentation - Update various library READMEs and examples - Sync dependency versions and configurations * docs: improve automation API terminology Replace generic "automation-compatible" wording with clearer terms: - "automation-compatible server" → "built-in automation server" - "automation-compatible" → "with cross-platform automation" * fix(ci): remove hardcoded pnpm version to avoid conflict with packageManager * fix(ci): skip Docker push on PRs - only validate builds * fix(ci): format code with prettier and regenerate docs * refactor(ci): reorganize GitHub Actions with CI/CD naming convention - Rename workflow files with clear CI/CD prefixes: - `pypi-*` → `cd-py-*` and `ci-py-*` - `npm-*` → `cd-ts-*` and `ci-ts-*` - `lume-*` → `cd-swift-lume` and `ci-swift-lume` - `docker-publish-*` → `cd-container-*` - Split ci-lint.yml into: - ci-lint-python.yml (Python linting) - ci-lint-typescript.yml (TypeScript linting) - Add path filters to lint workflows: - ci-lint-python.yml triggers only on libs/python/** changes - ci-lint-typescript.yml triggers only on libs/typescript/** changes - Create new CI workflows for package validation: - ci-py-*.yml for Python packages - ci-ts-*.yml for TypeScript packages - ci-container-*.yml for Docker containers - Rename reusable workflows: - pypi-reusable-*.yml → py-reusable-*.yml - npm-reusable-*.yml → ts-reusable-*.yml - Update all cross-references in release-bump-version.yml * feat(ci): add separate CI/CD for cua-bench and cua-bench-ui - Fix ci-py-bench.yml to point to libs/cua-bench (was incorrectly pointing to libs/python/bench-ui) - Add ci-py-bench-ui.yml for cua-bench-ui package validation - Add cd-py-bench-ui.yml for cua-bench-ui package publishing - Add .bumpversion.cfg for cua-bench-ui (v0.7.0) - Update release-bump-version.yml with pypi/bench-ui option - Fix cd-py-bench.yml to use release-github-reusable.yml * docs(lume): update disk space requirement from 50GB to 30GB * fix(ci): skip arm64 builds for Android QEMU container The Android QEMU image is not buildable on arm64. Add skip_arm64 parameter to docker reusable workflows and enable it for Android. * fix(ci): align cd-ts-cli tag pattern with bumpversion config * feat(ci): add tag triggers for TypeScript CD and bump support for containers - Add tag triggers to cd-ts-cli.yml, cd-ts-computer.yml, cd-ts-core.yml - Update version extraction to handle tag-based triggers - Add .bumpversion.cfg and VERSION files for all container images: - kasm, xfce, lumier - qemu-android, qemu-linux, qemu-windows - Add docker/* options to release-bump-version.yml Container CD workflows are triggered automatically when tags are pushed. * refactor(ci): remove redundant dockerfile_path defaults from container workflows * style: fix prettier formatting in Android container workflows * fix(ci): container CD should only trigger on tag push, not main Container images should be released via bump version workflow (tag push), not on every main branch push. This aligns container releases with other packages (PyPI, npm, lume). * feat(ci): add dependency chain handling for bump workflow When bumping core packages, automatically bump dependent packages: - pypi/core → also bumps cua-computer and cua-agent - pypi/som → also bumps cua-agent - npm/core → also bumps @trycua/computer Publish jobs now run in correct dependency order to ensure packages are available before their dependents are published. * docs: update tagline and description in README - Tagline: "Any OS. Any agent. Self-hostable." - Description: improved grammar for sandbox isolation phrasing * docs: update Packages section links to point to docs site Replace local paths with cua.ai/docs URLs for better discoverability. * docs: improve cua-computer-server description * fix(lume): add VERSION file and update bumpversion config * style: fix prettier formatting in README tables
2.3 KiB
2.3 KiB
Testing Guide for Cua
Quick guide to running tests and understanding the test architecture.
🚀 Quick Start
# Install dependencies
pip install pytest pytest-asyncio pytest-mock pytest-cov
# Install package
cd libs/python/core
pip install -e .
# Run tests
export CUA_TELEMETRY_DISABLED=1 # or $env:CUA_TELEMETRY_DISABLED="1" on Windows
pytest tests/ -v
🧪 Running Tests
# All packages
pytest libs/python/*/tests/ -v
# Specific package
cd libs/python/core && pytest tests/ -v
# With coverage
pytest tests/ --cov --cov-report=html
# Specific test
pytest tests/test_telemetry.py::TestTelemetryEnabled::test_telemetry_enabled_by_default -v
🏗️ Test Architecture
Principles: SRP (Single Responsibility) + Vertical Slices + Testability
libs/python/
├── core/tests/ # Tests ONLY core
├── agent/tests/ # Tests ONLY agent
└── computer/tests/ # Tests ONLY computer
Each test file = ONE feature. Each test class = ONE concern.
➕ Adding New Tests
- Create
test_*.pyin the appropriate package'stests/directory - Follow the pattern:
"""Unit tests for my_feature."""
import pytest
from unittest.mock import patch
class TestMyFeature:
"""Test MyFeature class."""
def test_initialization(self):
"""Test that feature initializes."""
from my_package import MyFeature
feature = MyFeature()
assert feature is not None
- Mock external dependencies:
@pytest.fixture
def mock_api():
with patch("my_package.api_client") as mock:
yield mock
🔄 CI/CD
Tests run automatically on every PR via GitHub Actions (.github/workflows/ci-python-tests.yml):
- Matrix strategy: each package tested separately
- Python 3.12
- ~2 minute runtime
🐛 Troubleshooting
ModuleNotFoundError: Run pip install -e . in package directory
Tests fail in CI but pass locally: Set CUA_TELEMETRY_DISABLED=1
Async tests error: Install pytest-asyncio and use @pytest.mark.asyncio
Mock not working: Patch at usage location, not definition:
# ✅ Right
@patch("my_package.module.external_function")
# ❌ Wrong
@patch("external_library.function")
Questions? Check existing tests for examples or open an issue.