chore(storage): bound build retention, caches and test resources
Track build ownership, qualified pins and bounded cache/log lifecycles. Move Vite fixtures to a job-owned server helper and preserve private outputs outside Git.
This commit is contained in:
@@ -10,19 +10,13 @@ from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Final, cast
|
||||
|
||||
from k1link.launchd_logs import launchd_log_path
|
||||
from k1link.launchd_logs import bounded_launchd_output, launchd_log_path, service_log_path
|
||||
|
||||
MISSION_CORE_LAUNCH_AGENT_LABEL: Final = "com.nodedc.mission-core.local"
|
||||
MISSION_CORE_LAUNCH_AGENT_SCHEMA: Final = "missioncore.local-launch-agent-plan/v1"
|
||||
OBSERVATORY_LOCAL_WORKER_ENABLED_ENV: Final = (
|
||||
"MISSIONCORE_OBSERVATORY_WORKER_LOCAL_ENABLED"
|
||||
)
|
||||
OBSERVATORY_SOURCE_CAS_ROOT_ENV: Final = (
|
||||
"MISSIONCORE_OBSERVATORY_WORKER_SOURCE_CAS_ROOT"
|
||||
)
|
||||
OBSERVATORY_RESULT_STAGING_ROOT_ENV: Final = (
|
||||
"MISSIONCORE_OBSERVATORY_WORKER_RESULT_STAGING_ROOT"
|
||||
)
|
||||
OBSERVATORY_LOCAL_WORKER_ENABLED_ENV: Final = "MISSIONCORE_OBSERVATORY_WORKER_LOCAL_ENABLED"
|
||||
OBSERVATORY_SOURCE_CAS_ROOT_ENV: Final = "MISSIONCORE_OBSERVATORY_WORKER_SOURCE_CAS_ROOT"
|
||||
OBSERVATORY_RESULT_STAGING_ROOT_ENV: Final = "MISSIONCORE_OBSERVATORY_WORKER_RESULT_STAGING_ROOT"
|
||||
ARTIFACT_STORE_ROOT_ENV: Final = "MISSIONCORE_ARTIFACT_STORE_ROOT"
|
||||
|
||||
|
||||
@@ -62,7 +56,7 @@ class MissionCoreLaunchAgentPlan:
|
||||
"desired_program_arguments": list(self.desired_program_arguments),
|
||||
"current_process_type": self.current_process_type,
|
||||
"desired_process_type": "Interactive",
|
||||
"desired_log_path": plistlib.loads(self.desired_payload)["StandardOutPath"],
|
||||
"desired_log_path": str(service_log_path(plistlib.loads(self.desired_payload))),
|
||||
"changes": {
|
||||
"repository_migration": self.current_working_directory
|
||||
!= self.desired_working_directory,
|
||||
@@ -72,16 +66,13 @@ class MissionCoreLaunchAgentPlan:
|
||||
if self.preserved_data_directory is not None
|
||||
else None
|
||||
),
|
||||
"dependency_sync_disabled": "--no-sync"
|
||||
in self.desired_program_arguments,
|
||||
"dependency_sync_disabled": "--no-sync" in self.desired_program_arguments,
|
||||
"self_health_watchdog": True,
|
||||
"bounded_launchd_exit_timeout_seconds": 20,
|
||||
"keep_alive": True,
|
||||
"process_group_owned": True,
|
||||
"operator_interactive_resources": True,
|
||||
"local_observatory_worker_enabled": (
|
||||
self.local_observatory_worker_enabled
|
||||
),
|
||||
"local_observatory_worker_enabled": (self.local_observatory_worker_enabled),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -113,9 +104,8 @@ def plan_mission_core_launch_agent(
|
||||
raise MissionCoreLaunchAgentError("current launch agent working directory is invalid")
|
||||
if expected_current_repository is None and current_working_directory != str(repository):
|
||||
raise MissionCoreLaunchAgentError("current launch agent targets another repository")
|
||||
if (
|
||||
expected_current_repository is not None
|
||||
and current_working_directory != str(expected_current_repository)
|
||||
if expected_current_repository is not None and current_working_directory != str(
|
||||
expected_current_repository
|
||||
):
|
||||
raise MissionCoreLaunchAgentError(
|
||||
"current launch agent does not target the expected current repository"
|
||||
@@ -133,11 +123,7 @@ def plan_mission_core_launch_agent(
|
||||
# accepted local execution boundary. ``--no-sync`` keeps launch startup
|
||||
# deterministic and prevents dependency mutation during recovery.
|
||||
uv_entrypoint = Path(current_arguments[0])
|
||||
if (
|
||||
not uv_entrypoint.is_absolute()
|
||||
or uv_entrypoint.name != "uv"
|
||||
or not uv_entrypoint.exists()
|
||||
):
|
||||
if not uv_entrypoint.is_absolute() or uv_entrypoint.name != "uv" or not uv_entrypoint.exists():
|
||||
raise MissionCoreLaunchAgentError("Mission Core uv entrypoint is unavailable")
|
||||
current_repository = Path(current_working_directory)
|
||||
repository_migration = current_repository != repository
|
||||
@@ -201,6 +187,8 @@ def plan_mission_core_launch_agent(
|
||||
"StandardOutPath": str(log_path),
|
||||
"StandardErrorPath": str(log_path),
|
||||
}
|
||||
desired = bounded_launchd_output(desired, repository, uv_path=uv_entrypoint)
|
||||
desired_program_arguments = tuple(desired["ProgramArguments"])
|
||||
desired_payload = plistlib.dumps(desired, fmt=plistlib.FMT_XML, sort_keys=True)
|
||||
return MissionCoreLaunchAgentPlan(
|
||||
agent_path=path,
|
||||
@@ -244,9 +232,7 @@ def _private_local_worker_directory(path: Path, label: str) -> Path:
|
||||
or stat.S_IMODE(metadata.st_mode) != 0o700
|
||||
or metadata.st_uid != os.getuid()
|
||||
):
|
||||
raise MissionCoreLaunchAgentError(
|
||||
f"{label} is not a private canonical directory"
|
||||
)
|
||||
raise MissionCoreLaunchAgentError(f"{label} is not a private canonical directory")
|
||||
return resolved
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user