test(workspace): enforce cloud package ownership
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
"""Composition safety checks (task 9.1).
|
||||
|
||||
Verifies that ``cloud/`` is purely additive: every existing module that
|
||||
``cloud/`` composes (``runtime.task``, ``workflow.runner``, ``driver.registry``,
|
||||
``api.console``) is itself unchanged by this change, and remains unaware of the
|
||||
``cloud`` package in its source.
|
||||
Verifies that the cloud workspace package is purely additive: every existing
|
||||
module it composes (``runtime.task``, ``workflow.runner``, ``driver.registry``,
|
||||
``api.console``) remains unaware of the ``cloud`` package in its source.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -13,6 +12,7 @@ import os
|
||||
from pathlib import Path
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
||||
CLOUD_SOURCE_ROOT = PROJECT_ROOT / "packages" / "cloud-platform" / "cloud"
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
def test_cloud_source_files_exist_only_under_cloud_directory() -> None:
|
||||
"""The cloud/ change adds files only under cloud/ (and tests/, pyproject.toml, openspec)."""
|
||||
cloud_dir = PROJECT_ROOT / "cloud"
|
||||
assert cloud_dir.exists()
|
||||
def test_cloud_source_files_exist_only_under_cloud_workspace_member() -> None:
|
||||
"""Cloud source files are owned by the cloud-platform workspace member."""
|
||||
assert CLOUD_SOURCE_ROOT.exists()
|
||||
expected_files = {
|
||||
"__init__.py",
|
||||
"config.py",
|
||||
@@ -100,7 +99,7 @@ def test_cloud_source_files_exist_only_under_cloud_directory() -> None:
|
||||
"sdk/models.py",
|
||||
}
|
||||
found: set[str] = set()
|
||||
for path in cloud_dir.rglob("*.py"):
|
||||
found.add(str(path.relative_to(cloud_dir)).replace(os.sep, "/"))
|
||||
for path in CLOUD_SOURCE_ROOT.rglob("*.py"):
|
||||
found.add(str(path.relative_to(CLOUD_SOURCE_ROOT)).replace(os.sep, "/"))
|
||||
missing = expected_files - found
|
||||
assert not missing, f"missing cloud source files: {sorted(missing)}"
|
||||
|
||||
Reference in New Issue
Block a user