commit 36e6766e1ff06d4fb9bc849f749b2da1e5c99a37
parent e010ef684b79d9aa001a179685379527afea6087
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 13 Nov 2026 20:28:40 -0500
Merge lane/persist-upgrade (follow-up): a saved copy that is itself short of the height asked is reported lower on every ask -- "best" is kept for a copy the box limits (an ultrawide one), so the first ask and the later ones say the same thing
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
3 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/common/lib/clipWindowTier-server.ts b/common/lib/clipWindowTier-server.ts
@@ -78,9 +78,13 @@ export async function tallerFromSaved(opts: {
// never reaches, so it would be cut again on every ask.
const best = fittedHeight(source.probe.width, source.probe.height, opts.cap) ?? Math.min(opts.cap, savedHeight);
if (best <= have) {
- return have >= best && opts.hitHeight !== null
+ // "best" only when the BOX is the limit (an ultrawide copy fits the 1080
+ // box at 810): the window is all the ask could ever get from this copy.
+ // A copy that is itself short of the ask (a 720 copy, a 1080 ask) is
+ // "lower", with why — the same answer the pointer's early exit gives.
+ return opts.hitHeight !== null && best < Math.min(opts.cap, savedHeight)
? { kind: "best", height: best }
- : { kind: "lower", why: `the saved copy gives ${best}p in the ${opts.cap}p box, no taller than the window` };
+ : { kind: "lower", why: `the saved copy is ${savedHeight}p, no taller than the window` };
}
return { kind: "cut", source, height: best };
}
diff --git a/common/lib/clipWindowTier.test.ts b/common/lib/clipWindowTier.test.ts
@@ -240,6 +240,15 @@ test("taller from the saved copy: only when the copy is taller than the window;
const r3 = await tallerFromSaved({ ...base, hitHeight: null, source: src(covers(1440)) });
assert.equal((r3 as { height: number }).height, 1080);
assert.equal(JSON.parse(await readFile(path.join(videoDir, "saved-video.json"), "utf8")).probed.height, 1440);
+ // A copy short of the ask, probed (no recorded height): "lower" on the first
+ // ask as on the second (the pointer exit), never "best".
+ await pointer(videoDir);
+ const short1 = await tallerFromSaved({ ...base, hitHeight: 720, source: src(covers(720)) });
+ assert.equal(short1.kind, "lower");
+ assert.match((short1 as { why: string }).why, /saved copy is 720p/);
+ const short2 = await tallerFromSaved({ ...base, hitHeight: 720, source: src(covers(720)) });
+ assert.equal(short2.kind, "lower");
+ await pointer(videoDir);
// A copy that does not hold the span, or has no picture: lower, with why.
const r4 = await tallerFromSaved({ ...base, hitHeight: 720, source: async () => ({ kind: "not-covering", container: "/s", durationSec: 5 }) });
assert.match((r4 as { why: string }).why, /does not hold this span/);
diff --git a/editor/app/channels/[slug]/videos/fetchWindowsTier.test.ts b/editor/app/channels/[slug]/videos/fetchWindowsTier.test.ts
@@ -61,7 +61,7 @@ const items = [
{ slug: SLUG, id: "equal1", from: 1, to: 3, clipId: "c#2" },
];
-test("a tall ask plans a taller cut beside a window lower than the saved copy; one as tall as the copy gives is a hit", async () => {
+test("a tall ask plans a taller cut beside a window lower than the saved copy, and lists the one that cannot be taller", async () => {
const r = await fetchWindowsAction({ items, requestedBy: "umtool", maxHeight: 1080, dryRun: true });
assert.ok(r.ok);
if (!r.ok) return;
@@ -69,9 +69,13 @@ test("a tall ask plans a taller cut beside a window lower than the saved copy; o
r.groups.map((g) => [g.platform, g.items.map((i) => i.clipId)]),
[["saved-video", ["c#1"]]],
);
- // 90p is all a 160×90 copy gives in the 1080 box: an ordinary hit, not "lower".
+ // A 90p copy is itself short of the 1080 ask: "lower", with why (not "best").
assert.deepEqual(r.cached.map((i) => i.clipId), ["c#2"]);
- assert.equal(r.lower, undefined);
+ assert.equal(r.lower?.length, 1);
+ assert.equal(r.lower![0].item.clipId, "c#2");
+ assert.equal(r.lower![0].height, 90);
+ assert.equal(r.lower![0].asked, 1080);
+ assert.match(r.lower![0].why, /saved copy is 90p/);
});
test("no ask plans as before: both held windows are cached, nothing listed lower", async () => {
@@ -89,7 +93,7 @@ test("an ask above clips.windowMaxHeight is planned at the ceiling, and says so"
assert.ok(r.ok);
if (!r.ok) return;
assert.equal(r.clampedFrom, 2160);
- assert.deepEqual(r.cached.map((i) => i.clipId), ["c#2"]);
+ assert.equal(r.lower?.[0]?.asked, 1080);
});
test("a tall refetch is not answered by a held window: planned onto the saved copy's cut", async () => {