Skip to content

Write HTML. Render video. Built for agents.

fix(producer): break aws-lambda↔producer build cycle for lambda-local harness

Jamesa18fc04bf405
diff --git a/packages/producer/src/regression-harness-lambda-local-types.ts b/packages/producer/src/regression-harness-lambda-local-types.ts
new file mode 100644
index 0000000000..bb021951a0
--- /dev/null
+++ b/packages/producer/src/regression-harness-lambda-local-types.ts
@@ -0,0 +1,37 @@
+/**
+ * Public-facing types for `./regression-harness-lambda-local.ts`.
+ *
+ * Kept in its own file because the implementation imports
+ * `@hyperframes/aws-lambda`, which can't be resolved by producer's
+ * tsc emit pass until aws-lambda's own dist/ is built. Splitting the
+ * types out lets producer's regression harness reference the lambda
+ * adapter's shape without pulling the aws-lambda graph into producer's
+ * type-check pass.
+ */
+
+/** Inputs for {@link runLambdaLocalRender}. Same contract as `runDistributedSimulatedRender`. */
+export interface RunLambdaLocalInput {
+ projectDir: string;
+ tempRoot: string;
+ renderedOutputPath: string;
+ fps: 24 | 30 | 60;
+ /**
+ * Width/height from the fixture's renderConfig. Forwarded directly to
+ * the Lambda event so this mode catches drift if the handler ever
+ * starts honouring `Config.width/height` for canvas sizing rather
+ * than reading the composition's `data-width`/`data-height`. The
+ * `distributed-simulated` mode hardcodes 1920×1080 because it
+ * bypasses the event-serialization boundary; lambda-local goes
+ * through it, which is the whole point.
+ */
+ width: number;
+ height: number;
+ format: "mp4" | "mov" | "png-sequence";
+ codec?: "h264" | "h265";
+ chunkSize?: number;
+ maxParallelChunks?: number;
+ variables?: Record<string, unknown>;
+}
+
+/** Public signature of the dynamically-loaded `runLambdaLocalRender`. */
+export type RunLambdaLocalRender = (input: RunLambdaLocalInput) => Promise<void>;
diff --git a/packages/producer/src/regression-harness-lambda-local.ts b/packages/producer/src/regression-harness-lambda-local.ts
index b731ac35d0..b1c342e628 100644
--- a/packages/producer/src/regression-harness-lambda-local.ts
+++ b/packages/producer/src/regression-harness-lambda-local.ts
@@ -46,29 +46,8 @@ import type {
SerializableDistributedRenderConfig,
} from "@hyperframes/aws-lambda";
-/** Inputs for {@link runLambdaLocalRender}. Same contract as `runDistributedSimulatedRender`. */
-export interface RunLambdaLocalInput {
- projectDir: string;
- tempRoot: string;
- renderedOutputPath: string;
- fps: 24 | 30 | 60;
- /**
- * Width/height from the fixture's renderConfig. Forwarded directly to
- * the Lambda event so this mode catches drift if the handler ever
- * starts honouring `Config.width/height` for canvas sizing rather
- * than reading the composition's `data-width`/`data-height`. The
- * `distributed-simulated` mode hardcodes 1920×1080 because it
- * bypasses the event-serialization boundary; lambda-local goes
- * through it, which is the whole point.
- */
- width: number;
- height: number;
- format: "mp4" | "mov" | "png-sequence";
- codec?: "h264" | "h265";
- chunkSize?: number;
- maxParallelChunks?: number;
- variables?: Record<string, unknown>;
-}
+export type { RunLambdaLocalInput } from "./regression-harness-lambda-local-types.js";
+import type { RunLambdaLocalInput } from "./regression-harness-lambda-local-types.js";
const FAKE_BUCKET = "harness-lambda-local";
diff --git a/packages/producer/src/regression-harness.ts b/packages/producer/src/regression-harness.ts
index 5b9d3c1536..9d413a79dd 100644
--- a/packages/producer/src/regression-harness.ts
+++ b/packages/producer/src/regression-harness.ts
@@ -37,10 +37,19 @@ import {
// In Dockerfile.test the workspace copy of aws-lambda's src isn't present,
// so a static import here would fail at module-load time even when
// running `--mode=in-process`. Load it on demand instead.
-async function loadLambdaLocalRender(): Promise<
- typeof import("./regression-harness-lambda-local.js").runLambdaLocalRender
-> {
- const mod = await import("./regression-harness-lambda-local.js");
+//
+// The signature is typed via `RunLambdaLocalRender` (in its own types-only
+// file) instead of `typeof import(...)` so producer's tsc doesn't have to
+// type-check the implementation. The implementation imports
+// `@hyperframes/aws-lambda`, whose types come from `dist/index.d.ts` after
+// aws-lambda's build runs — a chicken-and-egg with producer's tsc that
+// would otherwise fail the whole-repo build.
+import type { RunLambdaLocalRender } from "./regression-harness-lambda-local-types.js";
+
+async function loadLambdaLocalRender(): Promise<RunLambdaLocalRender> {
+ const mod = (await import("./regression-harness-lambda-local.js")) as {
+ runLambdaLocalRender: RunLambdaLocalRender;
+ };
return mod.runLambdaLocalRender;
}
diff --git a/packages/producer/tsconfig.json b/packages/producer/tsconfig.json
index cbe56306af..4e876a30f2 100644
--- a/packages/producer/tsconfig.json
+++ b/packages/producer/tsconfig.json
@@ -20,5 +20,11 @@
}
},
"include": ["src/**/*"],
- "exclude": ["node_modules", "dist", "src/**/*.test.ts", "src/**/__test_utils__/**"]
+ "exclude": [
+ "node_modules",
+ "dist",
+ "src/**/*.test.ts",
+ "src/**/__test_utils__/**",
+ "src/regression-harness-lambda-local.ts"
+ ]
}