mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 18:26:17 +00:00
feat(cloud): default distributed plans to v2 (#3311)
* feat(cloud): default distributed plans to v2 * fix(cloud): address plan v2 review feedback * fix(examples): document explicit v2 samples
This commit is contained in:
@@ -151,6 +151,18 @@ describe("HyperframesRenderStack — snapshot", () => {
|
||||
expect(actualStates.sort()).toEqual([...EXPECTED_STATE_NAMES].sort());
|
||||
});
|
||||
|
||||
it("defaults omitted plan protocol to v2 and preserves the explicit v1 branch", () => {
|
||||
for (const definition of [SYNTHED.definition, readSamDefinition()]) {
|
||||
const selection = requireRecord(
|
||||
definition.States.SelectPlanProtocol,
|
||||
"SelectPlanProtocol state",
|
||||
);
|
||||
expect(selection.Default).toBe("PlanV2");
|
||||
expect(JSON.stringify(selection)).toContain('"StringEquals":"v1"');
|
||||
expect(JSON.stringify(definition.States.Plan)).toContain('"PlanProtocol":"v1"');
|
||||
}
|
||||
});
|
||||
|
||||
it("preserves every typed non-retryable error name across the three Lambda tasks", () => {
|
||||
const { definition } = SYNTHED;
|
||||
const collected = new Set<string>();
|
||||
|
||||
@@ -247,6 +247,7 @@ export class HyperframesRenderStack extends Construct {
|
||||
lambdaFunction: this.renderFunction,
|
||||
payload: sfn.TaskInput.fromObject({
|
||||
Action: "plan",
|
||||
PlanProtocol: "v1",
|
||||
"ProjectS3Uri.$": "$.ProjectS3Uri",
|
||||
"PlanOutputS3Prefix.$": "$.PlanOutputS3Prefix",
|
||||
"Config.$": "$.Config",
|
||||
@@ -319,6 +320,7 @@ export class HyperframesRenderStack extends Construct {
|
||||
lambdaFunction: this.renderFunction,
|
||||
payload: sfn.TaskInput.fromObject({
|
||||
Action: "renderChunk",
|
||||
PlanProtocol: "v1",
|
||||
"ChunkIndex.$": "$.ChunkIndex",
|
||||
"PlanS3Uri.$": "$.PlanS3Uri",
|
||||
"PlanHash.$": "$.PlanHash",
|
||||
@@ -361,6 +363,7 @@ export class HyperframesRenderStack extends Construct {
|
||||
lambdaFunction: this.renderFunction,
|
||||
payload: sfn.TaskInput.fromObject({
|
||||
Action: "assemble",
|
||||
PlanProtocol: "v1",
|
||||
"PlanS3Uri.$": "$.Plan.PlanS3Uri",
|
||||
"ChunkS3Uris.$": "$.Chunks[*].ChunkS3Uri",
|
||||
"AudioS3Uri.$": "$.Plan.AudioS3Uri",
|
||||
@@ -473,13 +476,13 @@ export class HyperframesRenderStack extends Construct {
|
||||
|
||||
const unsupportedPlanProtocol = new sfn.Fail(this, "UnsupportedPlanProtocol", {
|
||||
error: "PLAN_PROTOCOL_UNSUPPORTED",
|
||||
cause: 'PlanProtocol must be "v1", "v2", or absent (defaults to v1).',
|
||||
cause: 'PlanProtocol must be "v1", "v2", or absent (defaults to v2).',
|
||||
});
|
||||
return new sfn.Choice(this, "SelectPlanProtocol")
|
||||
.when(sfn.Condition.stringEquals("$.PlanProtocol", "v2"), planV2)
|
||||
.when(sfn.Condition.stringEquals("$.PlanProtocol", "v1"), plan)
|
||||
.when(sfn.Condition.isPresent("$.PlanProtocol"), unsupportedPlanProtocol)
|
||||
.otherwise(plan);
|
||||
.otherwise(planV2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user