test(workspace): enforce cloud package ownership

This commit is contained in:
2026-07-12 14:12:51 +08:00
parent bfd56fd2da
commit 00bf5ee428
3 changed files with 10 additions and 12 deletions
@@ -10,7 +10,7 @@
## 2. Cloud Package Extraction ## 2. Cloud Package Extraction
- [x] 2.1 Move the existing `cloud` package under `packages/cloud-platform` while preserving every `cloud.*` import path. - [x] 2.1 Move the existing `cloud` package under `packages/cloud-platform` while preserving every `cloud.*` import path.
- [ ] 2.2 Remove `cloud*` from the root distribution's setuptools discovery and update path-sensitive composition tests or tooling. - [x] 2.2 Remove `cloud*` from the root distribution's setuptools discovery and update path-sensitive composition tests or tooling.
- [ ] 2.3 Add packaging tests that identify the owning distribution for Runtime and cloud modules and reject reverse cloud dependencies. - [ ] 2.3 Add packaging tests that identify the owning distribution for Runtime and cloud modules and reject reverse cloud dependencies.
## 3. Locking And Developer Commands ## 3. Locking And Developer Commands
-1
View File
@@ -30,7 +30,6 @@ members = ["packages/cloud-platform"]
include = [ include = [
"agents*", "agents*",
"api*", "api*",
"cloud*",
"core*", "core*",
"device*", "device*",
"driver*", "driver*",
+9 -10
View File
@@ -1,9 +1,8 @@
"""Composition safety checks (task 9.1). """Composition safety checks (task 9.1).
Verifies that ``cloud/`` is purely additive: every existing module that Verifies that the cloud workspace package is purely additive: every existing
``cloud/`` composes (``runtime.task``, ``workflow.runner``, ``driver.registry``, module it composes (``runtime.task``, ``workflow.runner``, ``driver.registry``,
``api.console``) is itself unchanged by this change, and remains unaware of the ``api.console``) remains unaware of the ``cloud`` package in its source.
``cloud`` package in its source.
""" """
from __future__ import annotations from __future__ import annotations
@@ -13,6 +12,7 @@ import os
from pathlib import Path from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parent.parent PROJECT_ROOT = Path(__file__).resolve().parent.parent
CLOUD_SOURCE_ROOT = PROJECT_ROOT / "packages" / "cloud-platform" / "cloud"
def _module_source(path: Path) -> str: def _module_source(path: Path) -> str:
@@ -82,10 +82,9 @@ def test_cloud_dispatch_imports_existing_runners_by_name() -> None:
assert "WorkflowRunner" in source or "workflow_runner_factory" in source assert "WorkflowRunner" in source or "workflow_runner_factory" in source
def test_cloud_source_files_exist_only_under_cloud_directory() -> None: def test_cloud_source_files_exist_only_under_cloud_workspace_member() -> None:
"""The cloud/ change adds files only under cloud/ (and tests/, pyproject.toml, openspec).""" """Cloud source files are owned by the cloud-platform workspace member."""
cloud_dir = PROJECT_ROOT / "cloud" assert CLOUD_SOURCE_ROOT.exists()
assert cloud_dir.exists()
expected_files = { expected_files = {
"__init__.py", "__init__.py",
"config.py", "config.py",
@@ -100,7 +99,7 @@ def test_cloud_source_files_exist_only_under_cloud_directory() -> None:
"sdk/models.py", "sdk/models.py",
} }
found: set[str] = set() found: set[str] = set()
for path in cloud_dir.rglob("*.py"): for path in CLOUD_SOURCE_ROOT.rglob("*.py"):
found.add(str(path.relative_to(cloud_dir)).replace(os.sep, "/")) found.add(str(path.relative_to(CLOUD_SOURCE_ROOT)).replace(os.sep, "/"))
missing = expected_files - found missing = expected_files - found
assert not missing, f"missing cloud source files: {sorted(missing)}" assert not missing, f"missing cloud source files: {sorted(missing)}"