Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1701,6 +1701,14 @@ export function validateDeploymentContractSet(
);
}
});
if (
attempt.state === "succeeded"
&& attempt.actionSteps.length < planActionIds.size
) {
issues.push(
`deploymentAttempts.${attempt.id}.actionSteps: succeeded attempt is missing linked deployment plan actions`,
);
}
}
if (
attempt.state === "succeeded"
Expand Down
29 changes: 29 additions & 0 deletions tests/deployment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,35 @@ describe("deployment contract records", () => {
});
});

test("a succeeded attempt must contain every linked deployment plan action", () => {
const fixtures = createDeploymentFixtureSet();
const contractSet = deploymentFixtureSetToContractSet(fixtures);
const planDraft = clone(fixtures.deploymentPlan);
const secondAction = clone(planDraft.actions[0]!);
secondAction.id = "verify-workload";
secondAction.dependsOn = ["apply-workload"];
planDraft.actions.push(secondAction);
const deploymentPlan = DeploymentPlanSchema.parse(redigest(planDraft));
const downstream = recomputePlanDownstream(fixtures, deploymentPlan);

contractSet.deploymentPlans = [deploymentPlan];
contractSet.deploymentApprovalDecisions = [
downstream.deploymentApprovalDecision,
];
contractSet.deploymentAttempts = [downstream.deploymentAttempt];
contractSet.providerReceipts = [downstream.providerReceipt];
contractSet.deploymentReceipts = [downstream.deploymentReceipt];
contractSet.launchEvidence = [downstream.launchEvidence];

const result = validateDeploymentContractSet(runtimeSchemas, contractSet);
expect(result).toEqual({
success: false,
issues: [
`deploymentAttempts.${downstream.deploymentAttempt.id}.actionSteps: succeeded attempt is missing linked deployment plan actions`,
],
});
});

test("a succeeded attempt cannot contain a failed action step", () => {
const fixtures = createDeploymentFixtureSet();
const contractSet = deploymentFixtureSetToContractSet(fixtures);
Expand Down
Loading