feat(observatory): install local M49 worker path

This commit is contained in:
DCCONSTRUCTIONS
2026-08-31 16:51:10 +03:00
parent 2f6e45bc96
commit 9c69d81296
19 changed files with 2252 additions and 212 deletions
+66
View File
@@ -65,6 +65,72 @@ def test_launch_agent_plan_disables_sync_and_enables_watchdog(tmp_path: Path) ->
assert "MISSIONCORE_DATA_DIR" not in desired["EnvironmentVariables"]
assert plan.to_dict()["changes"]["repository_migration"] is False
assert plan.to_dict()["changes"]["data_directory_preserved"] is False
assert plan.to_dict()["changes"]["local_observatory_worker_enabled"] is False
def test_launch_agent_plan_explicitly_enables_local_observatory_worker(
tmp_path: Path,
) -> None:
repository = tmp_path / "repo"
repository.mkdir()
data_directory = repository / ".runtime" / "mission-core"
data_directory.mkdir(parents=True, mode=0o700)
for name in (
"observatory-artifact-store",
"observatory-worker-source-cas",
"observatory-worker-result-staging",
):
(data_directory / name).mkdir(mode=0o700)
uv_entrypoint = tmp_path / "uv"
uv_entrypoint.write_text("#!/bin/sh\n")
uv_entrypoint.chmod(0o700)
agent = tmp_path / "agent.plist"
_write_agent(path=agent, repository=repository, uv_entrypoint=uv_entrypoint)
plan = plan_mission_core_launch_agent(
repository_root=repository,
agent_path=agent,
enable_local_observatory_worker=True,
)
desired = plistlib.loads(plan.desired_payload)
environment = desired["EnvironmentVariables"]
assert environment["MISSIONCORE_DATA_DIR"] == str(data_directory)
assert environment["MISSIONCORE_OBSERVATORY_WORKER_LOCAL_ENABLED"] == "1"
assert environment["MISSIONCORE_ARTIFACT_STORE_ROOT"] == str(
data_directory / "observatory-artifact-store"
)
assert environment["MISSIONCORE_OBSERVATORY_WORKER_SOURCE_CAS_ROOT"] == str(
data_directory / "observatory-worker-source-cas"
)
assert environment["MISSIONCORE_OBSERVATORY_WORKER_RESULT_STAGING_ROOT"] == str(
data_directory / "observatory-worker-result-staging"
)
assert plan.local_observatory_worker_enabled is True
assert plan.to_dict()["changes"]["local_observatory_worker_enabled"] is True
def test_launch_agent_plan_rejects_missing_local_observatory_roots(
tmp_path: Path,
) -> None:
repository = tmp_path / "repo"
repository.mkdir()
(repository / ".runtime" / "mission-core").mkdir(parents=True, mode=0o700)
uv_entrypoint = tmp_path / "uv"
uv_entrypoint.write_text("#!/bin/sh\n")
uv_entrypoint.chmod(0o700)
agent = tmp_path / "agent.plist"
_write_agent(path=agent, repository=repository, uv_entrypoint=uv_entrypoint)
with pytest.raises(
MissionCoreLaunchAgentError,
match="local Observatory artifact store is unavailable",
):
plan_mission_core_launch_agent(
repository_root=repository,
agent_path=agent,
enable_local_observatory_worker=True,
)
def test_launch_agent_plan_rejects_cross_repository_migration_by_default(