|
@@ -103,6 +103,7 @@ class PhaseThreeRecoveryService:
|
|
|
artifacts: ScriptBusinessArtifactRepository | None = None,
|
|
artifacts: ScriptBusinessArtifactRepository | None = None,
|
|
|
legacy_projection: Any | None = None,
|
|
legacy_projection: Any | None = None,
|
|
|
mission_service: Any | None = None,
|
|
mission_service: Any | None = None,
|
|
|
|
|
+ contract_reader: Any | None = None,
|
|
|
) -> None:
|
|
) -> None:
|
|
|
self.coordinator = coordinator
|
|
self.coordinator = coordinator
|
|
|
self.bindings = bindings
|
|
self.bindings = bindings
|
|
@@ -114,6 +115,7 @@ class PhaseThreeRecoveryService:
|
|
|
self.artifacts = artifacts
|
|
self.artifacts = artifacts
|
|
|
self.legacy_projection = legacy_projection
|
|
self.legacy_projection = legacy_projection
|
|
|
self.mission_service = mission_service
|
|
self.mission_service = mission_service
|
|
|
|
|
+ self.contract_reader = contract_reader
|
|
|
|
|
|
|
|
async def resume(self, script_build_id: int, principal: Principal) -> ResumeResult:
|
|
async def resume(self, script_build_id: int, principal: Principal) -> ResumeResult:
|
|
|
await self.authorizer.require_access(principal, script_build_id)
|
|
await self.authorizer.require_access(principal, script_build_id)
|
|
@@ -179,6 +181,23 @@ class PhaseThreeRecoveryService:
|
|
|
)
|
|
)
|
|
|
ledger = await self.coordinator.task_store.load(binding.root_trace_id)
|
|
ledger = await self.coordinator.task_store.load(binding.root_trace_id)
|
|
|
root = ledger.tasks[ledger.root_task_id]
|
|
root = ledger.tasks[ledger.root_task_id]
|
|
|
|
|
+ if self.contract_reader is not None and status in {
|
|
|
|
|
+ BuildStatus.RUNNING,
|
|
|
|
|
+ BuildStatus.PARTIAL,
|
|
|
|
|
+ }:
|
|
|
|
|
+ try:
|
|
|
|
|
+ for task in ledger.tasks.values():
|
|
|
|
|
+ if task.task_id != ledger.root_task_id:
|
|
|
|
|
+ await self.contract_reader.contract_for_task(binding.root_trace_id, task)
|
|
|
|
|
+ except Exception as exc:
|
|
|
|
|
+ if getattr(exc, "code", "") == "TASK_CONTRACT_INVALID":
|
|
|
|
|
+ return ResumeResult(
|
|
|
|
|
+ script_build_id,
|
|
|
|
|
+ RecoveryClassification.MANUAL_RECONCILIATION,
|
|
|
|
|
+ status,
|
|
|
|
|
+ "unfinished build predates the Mission Workbench compiler manifest",
|
|
|
|
|
+ )
|
|
|
|
|
+ raise
|
|
|
if root.status is TaskStatus.COMPLETED:
|
|
if root.status is TaskStatus.COMPLETED:
|
|
|
if publication is not None and publication.state is PublicationState.PUBLISHING:
|
|
if publication is not None and publication.state is PublicationState.PUBLISHING:
|
|
|
raise PublicationStateInconsistent()
|
|
raise PublicationStateInconsistent()
|