Files
vfxreview/lib/shot-code.test.ts
twotalesanimation 9660cdc21c
Deploy / deploy (push) Successful in 3m23s
feat(review): High quality playback switch and per-version ProRes download
Worker 1.7.0 (preview.highQuality, default on) now, after the AE render:
- encodes a High quality MP4 from the delivery MOV (full-res H.264 High,
  CRF 14 capped at 100 Mbps) -> Version.hqFileUrl
- uploads the MOV itself -> Version.highResKey/Filename/Size
Both best-effort (the preview never fails over them), with a lease
keep-alive during the long encode/uploads; the export timeline records
what was attached.

Player: HQ switch when a High quality source exists; keeps frame, play
state, speed and zoom, remembered per browser, falls back to Standard if
the file won't load. ProRes itself stays download-only (browser support).

Downloads: the client portal's High Res button serves the version's
ProRes (client-code filename), falling back to the shot's manual file;
staff get a ProRes button on the review page.

Housekeeping (lib/render-pipeline/high-res.ts): HQ MP4 + ProRes are kept
while a version is latest, client-shared, approved or younger than
preview.highResRetentionDays (14); otherwise deleted from storage. Runs
per task after finalize and hourly from the reaper; deleting a version or
a reslate removes its files. The Standard MP4 is never touched.

Also: ProRes/Handles top-bar buttons go icon-only below lg so they don't
overlap the version selector.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 16:32:18 +02:00

64 lines
2.5 KiB
TypeScript

import { describe, it, expect } from "vitest";
import { clientHighResFilename, clientShotCode, clientTaskTitle } from "./shot-code";
describe("clientShotCode", () => {
it("prefers the client's alias", () => {
expect(clientShotCode({ shotCode: "UNG_106_010_020", clientCode: "EP6_VFX_012" })).toBe("EP6_VFX_012");
});
it("falls back to our code when there is no alias", () => {
expect(clientShotCode({ shotCode: "UNG_106_010_020", clientCode: null })).toBe("UNG_106_010_020");
expect(clientShotCode({ shotCode: "UNG_106_010_020" })).toBe("UNG_106_010_020");
});
it("ignores a whitespace-only alias", () => {
expect(clientShotCode({ shotCode: "UNG_106_010_020", clientCode: " " })).toBe("UNG_106_010_020");
});
});
describe("clientTaskTitle", () => {
const shot = { shotCode: "UNG_106_010_020", clientCode: "EP6_VFX_012" };
it("swaps the internal code out of a house-convention title", () => {
expect(clientTaskTitle("UNG_106_010_020_cmp_TT_v004", shot)).toBe("EP6_VFX_012_cmp_TT_v004");
});
it("leaves the title alone when there is no alias", () => {
const t = "UNG_106_010_020_cmp_TT_v004";
expect(clientTaskTitle(t, { shotCode: "UNG_106_010_020", clientCode: null })).toBe(t);
});
it("leaves a title that does not carry the code untouched", () => {
// Hand-edited titles are not guessed at — better an unhelpful title than a
// mangled one.
expect(clientTaskTitle("Roto pass", shot)).toBe("Roto pass");
});
it("swaps every occurrence", () => {
expect(clientTaskTitle("UNG_106_010_020 / UNG_106_010_020_cmp", shot)).toBe("EP6_VFX_012 / EP6_VFX_012_cmp");
});
it("is a no-op when the alias equals the code", () => {
const same = { shotCode: "UNG_106_010_020", clientCode: "UNG_106_010_020" };
expect(clientTaskTitle("UNG_106_010_020_cmp", same)).toBe("UNG_106_010_020_cmp");
});
});
describe("clientHighResFilename", () => {
const shot = { shotCode: "UNG_104_051_040", clientCode: "EP4_0510" };
it("uses the slate's client naming when the shot has an alias", () => {
expect(clientHighResFilename("UNG_104_051_040_cmp_TT_v006.mov", shot)).toBe("EP4_0510_v006.mov");
});
it("keeps our own name when there is no alias", () => {
expect(clientHighResFilename("UNG_104_051_040_cmp_TT_v006.mov", { shotCode: "UNG_104_051_040" })).toBe(
"UNG_104_051_040_cmp_TT_v006.mov"
);
});
it("swaps the code in a name that doesn't follow the convention", () => {
expect(clientHighResFilename("final_UNG_104_051_040.mov", shot)).toBe("final_EP4_0510.mov");
});
});