Skip to content

Commit ced2454

Browse files
jrusso1020claude
andcommitted
ci(regression): add webm-vp9 to shard-3 + refactor formatExtension
Three follow-ups bundled together (Vai's review feedback on PR #952 plus the fallow audit finding that surfaced when the webm case was added): 1. **Wire webm-vp9 into CI regression.** The fixture was added in this PR but never appeared in any `.github/workflows/regression.yml` shard's args allowlist, so the regression harness's positional-args gate skipped it in CI. Append `webm-vp9` to shard-3 (which already carries `mp4-h264-sdr` + `webm-transparency`) so the fixture runs. 2. **Fix stale "four hard gates" prose in checkDistributedSupport docstring.** Earlier in the stack I removed the webm bullet but didn't update the count. Two gates remain (fps + hdr). 3. **Refactor `formatExtension` from switch to lookup table.** Adding the webm case made the switch dispatch's CRAP score hit 30.0 (cyclomatic = 5, plus the function's small body). Replaced with a `Record<DistributedFormat, string>` lookup, which: - drops cyclomatic from 5 → 1, - keeps exhaustiveness enforcement at compile time (TS errors if a new format gets added to `DistributedFormat` without a matching key in the Record literal), - drops the runtime `_exhaustive: never` throw, which was only guarding against an arbitrary string slipping past TS — a caller-side concern, not this function's job. The function now reads as a table lookup, which matches what it actually does, and the fallow audit now reports zero new complexity findings (down from 1). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b239af5 commit ced2454

3 files changed

Lines changed: 15 additions & 16 deletions

File tree

.github/workflows/regression.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
- shard: shard-2
6565
args: "style-15-prod hdr-hlg-regression style-1-prod many-cuts vfr-screen-recording render-symlinked-assets"
6666
- shard: shard-3
67-
args: "style-7-prod style-8-prod style-10-prod css-spinner-render-compat webm-transparency mp4-h264-sdr"
67+
args: "style-7-prod style-8-prod style-10-prod css-spinner-render-compat webm-transparency mp4-h264-sdr webm-vp9"
6868
- shard: shard-4
6969
args: "style-16-prod style-9-prod style-17-prod iframe-render-compat variables-prod mp4-h265-sdr"
7070
- shard: shard-5

packages/aws-lambda/src/formatExtension.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@
88

99
export type DistributedFormat = "mp4" | "mov" | "png-sequence" | "webm";
1010

11+
// Closed-enum lookup table. TS enforces exhaustiveness via the
12+
// `Record<DistributedFormat, string>` annotation — adding a format to
13+
// `DistributedFormat` without adding the matching key here fails to
14+
// typecheck, which is the same exhaustiveness guarantee a switch +
15+
// `_exhaustive: never` arm provides but at lower complexity.
16+
const FORMAT_EXTENSIONS: Record<DistributedFormat, string> = {
17+
mp4: ".mp4",
18+
mov: ".mov",
19+
webm: ".webm",
20+
"png-sequence": "",
21+
};
22+
1123
export function formatExtension(format: DistributedFormat): string {
12-
switch (format) {
13-
case "mp4":
14-
return ".mp4";
15-
case "mov":
16-
return ".mov";
17-
case "webm":
18-
return ".webm";
19-
case "png-sequence":
20-
return "";
21-
default: {
22-
const _exhaustive: never = format;
23-
throw new Error(`[formatExtension] unsupported format: ${_exhaustive as string}`);
24-
}
25-
}
24+
return FORMAT_EXTENSIONS[format];
2625
}

packages/producer/src/regression-harness-distributed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export type DistributedSupportResult = { supported: true } | { supported: false;
6767

6868
/**
6969
* Decide whether a fixture's `renderConfig` is one the distributed pipeline
70-
* can actually run. The four hard gates:
70+
* can actually run. Two hard gates:
7171
*
7272
* - fps must be `{ num: 24|30|60, den: 1 }`. `DistributedRenderConfig.fps`
7373
* accepts only the three integer values, and rationals like

0 commit comments

Comments
 (0)