mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-12 07:09:59 +00:00
refactor(producer): share plan execution builder (#2906)
## What Refactor distributed planning around one shared local execution-plan builder: - `buildLocalExecutionPlan()` now owns compile/probe/extract/audio/freeze. - Legacy `plan()` remains a deprecated v1 transport wrapper. - Plan v2 calls the shared builder directly and publishes through the existing manifest/CAS contract. - Add neutral `createPlanV2FromExecutionPlan()`, `publishPlanV2FromExecutionPlan()`, `getPlanV2ExecutionPlanHash()`, and `PLAN_PROTOCOL_V1` names. - Retain deprecated v1-named exports and wire aliases. - Recommend explicit Plan v2 opt-in for new producer, Lambda, and Cloud Run integrations. ## Why Plan v2 previously looked like it invoked a v1 planner even though v1 and v2 share the same frozen local execution representation. This removes that migration-era coupling while preserving the public minor-version compatibility contract. ## How The shared builder returns neutral internal execution-plan fields. The v1 wrapper maps those fields back to the existing `PlanResult`; the v2 publisher consumes them directly. Compatibility is intentional and covered by exact shape tests: - omitted `planProtocol` still serializes/selects `"v1"`; - v1 layouts, descriptor-less decoding, event unions, workflow branches, and exports remain; - the v1 descriptor JSON is byte-identical and `CURRENT_PLAN_PROTOCOL` is an identity-preserving alias; - v2 manifest bytes, key order, hash framing, and `sourcePlanV1Hash` wire key remain unchanged; - no enumerable neutral hash field was added to manifests or returned result objects; - v1/v2 result objects, cloud event payloads, and SDK handle key sets remain unchanged. ## Test plan - Focused Plan v1/v2/protocol/export/size compatibility: 141 passed - `@hyperframes/core`: 1,419 passed - `@hyperframes/producer` unit lane: 990 passed - `@hyperframes/aws-lambda`: 140 passed - `@hyperframes/gcp-cloud-run`: 101 passed - Producer, Lambda, and Cloud Run typechecks - Repository-wide lint, format check, workspace/package-subpath checks - Full workspace build - `git diff --check` - [x] Unit tests added/updated - [ ] Manual testing performed - [x] Documentation updated (if applicable)
This commit is contained in:
@@ -79,6 +79,15 @@ describe("renderToLambda", () => {
|
||||
expect(handle.projectS3Uri).toMatch(
|
||||
/^s3:\/\/test-bucket\/sites\/[0-9a-f]{16}\/project\.tar\.gz$/,
|
||||
);
|
||||
expect(Object.keys(handle)).toEqual([
|
||||
"renderId",
|
||||
"executionArn",
|
||||
"bucketName",
|
||||
"stateMachineArn",
|
||||
"outputS3Uri",
|
||||
"projectS3Uri",
|
||||
"startedAt",
|
||||
]);
|
||||
|
||||
expect(sfn.starts).toHaveLength(1);
|
||||
const start = sfn.starts[0]!;
|
||||
@@ -96,7 +105,7 @@ describe("renderToLambda", () => {
|
||||
it("opts the complete execution into plan protocol v2 explicitly", async () => {
|
||||
const sfn = new FakeSFN();
|
||||
const s3 = new FakeS3();
|
||||
await renderToLambda({
|
||||
const handle = await renderToLambda({
|
||||
projectDir,
|
||||
bucketName: "test-bucket",
|
||||
stateMachineArn: "arn:aws:states:us-east-1:1234:stateMachine:hf",
|
||||
@@ -107,7 +116,13 @@ describe("renderToLambda", () => {
|
||||
s3: asS3Client(s3),
|
||||
});
|
||||
|
||||
expect(sfn.starts[0]?.input).toMatchObject({ PlanProtocol: "v2" });
|
||||
expect(sfn.starts[0]?.input).toEqual({
|
||||
ProjectS3Uri: handle.projectS3Uri,
|
||||
PlanOutputS3Prefix: "s3://test-bucket/renders/smoke-v2/",
|
||||
OutputS3Uri: "s3://test-bucket/renders/smoke-v2/output.mp4",
|
||||
Config: baseConfig,
|
||||
PlanProtocol: "v2",
|
||||
});
|
||||
});
|
||||
|
||||
it("derives the file extension from config.format", async () => {
|
||||
|
||||
Reference in New Issue
Block a user