commit be64cfe0d213e142a86820f4b35eedc22c25f67d
parent a81051b9a44607e3edf15cd3cdd4406733d9717e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 21 Nov 2026 19:58:50 -0500
record-live: the landing never deletes around, or replaces, a stored recording it is not proven to hold
Two losses in the shipped landing (REVIEW-1 1.1 and 1.2 of live-guard-2),
re-implemented minimally on main without any of that lane's recorders:
- When landMediaFile keeps the container already in the store, nothing
of this run was stored, yet the part meant to land and every part
collected for removal were deleted. Now nothing is removed: they stay
in staging as keptParts, the run fails "not landed" and needs a person.
- A container already in the store was replaced by any longer file: a
live-edge part recorded after a restart replaced the stream's start.
Now it is replaced only by a file that holds the whole stream from its
start (the coverage rule); otherwise nothing lands.
Also: an index-0 part (ffmpeg at the playlist's first listed segment) is
never "inside" a longer part of the run unless the playlist reached the
start; a part not from the start goes, under the coverage rule, only when
the landed file is from the start and at least the ended stream's own
duration less 60 s, never on a coverage by the clock. Removals still
happen only after the landing is stored.
Tests changed with the rules: the preclip case has its own id (it shared
the path-B case's store), 2.3's short run is now "not landed", covered (b)
gives its earlier part a row, and covered (a) is replaced by a Kick case
proven on the ended stream's duration (and kept on the clock).
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
5 files changed, 253 insertions(+), 66 deletions(-)
diff --git a/OPERATING.md b/OPERATING.md
@@ -1450,7 +1450,13 @@ pnpm ops keep-videos --json '{"slug":"example-rumble","ids":["v1abcde"],"note":
holds bytes — an earlier run's, one from the live edge, one that cannot be landed as it is, fragments a recorder
left — stays in the store's staging dir, listed as `keptParts` (files, sizes, why), and the row needs a person
until acknowledged. A later recording does not clear that; nothing removes kept files automatically. On Kick, a
- VOD that covers the stream removes the channel's live-edge part; one that does not keeps it.
+ VOD that covers the stream removes the channel's live-edge part; one that does not keeps it. A part not from the
+ start (a live-edge part, one no row describes) goes only when the landed file is from the start and at least the
+ ENDED stream's own duration less 60 s — never on a coverage by the clock; an index-0 part is never "inside" a longer
+ one by itself. **A recording already in the store** (an earlier run's landing, a shutdown's included) is replaced
+ only by a file that holds the whole stream from its start; otherwise nothing lands, every part stays listed
+ (`keptParts`), the run is `failed` ("not landed: …") and needs a person — and whenever the landing keeps the stored
+ container, nothing is removed.
- **An editor shutdown is not a Cancel.** A run stopped by the editor going down (a restart, a rollout) is
`interrupted` (`stoppedBy: "shutdown"`), never `cancelled`, and needs a person — Record again if the stream is still
live. A person's Cancel is `cancelled`; it needs a person only when the stream was must-keep (`doNotClean` or a
diff --git a/common/controller/recordLive.test.ts b/common/controller/recordLive.test.ts
@@ -184,8 +184,8 @@ test("preclip: the knob parsed (implies transcribe), the pre-clip asked for once
const log: string[] = [];
await recordLiveRun({
paths,
- request: { slug: SLUG, url: "https://rumble.com/v3ccccc-show.html", preclip: p.preclip },
- plan: { url: "https://rumble.com/v3ccccc-show.html", platform: "rumble", id: "v3ccccc" },
+ request: { slug: SLUG, url: "https://rumble.com/v3ppppp-show.html", preclip: p.preclip },
+ plan: { url: "https://rumble.com/v3ppppp-show.html", platform: "rumble", id: "v3ppppp" },
channelConfig: CONFIG,
cookiePolicy: NO_COOKIES,
onLog: (l) => void log.push(l),
@@ -208,10 +208,10 @@ test("preclip: the knob parsed (implies transcribe), the pre-clip asked for once
handoff,
},
});
- assert.deepEqual(asked, [{ slug: SLUG, id: "v3ccccc", every: 5 }]);
+ assert.deepEqual(asked, [{ slug: SLUG, id: "v3ppppp", every: 5 }]);
assert.ok(log.some((l) => /Live pre-clip: job job-pre/.test(l)));
- const rec = await liveRecordingSidecar.load(path.join(CORPUS, "channels", SLUG, "data", "v3ccccc"));
- assert.match(rec?.parts[0]?.stem ?? "", /^\.v3ccccc\.live-.+\.ytdlp$/);
+ const rec = await liveRecordingSidecar.load(path.join(CORPUS, "channels", SLUG, "data", "v3ppppp"));
+ assert.match(rec?.parts[0]?.stem ?? "", /^\.v3ppppp\.live-.+\.ytdlp$/);
});
test("yt-dlp cannot start at the start: --no-live-from-start with ffmpeg at index 0; the longest part lands", async () => {
@@ -978,23 +978,33 @@ test("2.3: only a landed from-start run that covers the stream supersedes; a liv
const id = "exmplcover1";
const first = await incidentRun(id, writesAfter(Infinity));
await assert.rejects(first.run);
- const stillNeeds = async () => (await rowOf(id)).find((r) => r.status === "failed")!;
+ const stillNeeds = async () => (await rowOf(id)).find((r) => r.status === "failed" && !/not landed/.test(r.error ?? ""))!;
// (a) asked not from its start: lands, does not supersede.
const edge = await incidentRun(id, writesAfter(0), { request: { fromStart: false } });
assert.equal((await edge.run).status, "landed");
assert.equal((await stillNeeds()).needsAttention, true, "a run from now does not hold the start");
assert.equal((await stillNeeds()).supersededBy, undefined);
- // (b) from its start, 600 s of a stream that has run two hours.
+ // (b) from its start, 600 s of a stream that has run two hours: the store
+ // holds (a)'s recording, which this one is not proven to hold — not landed,
+ // kept, needing a person.
const short = await incidentRun(id, writesAfter(0));
- const shortLog = short.log;
- assert.equal((await short.run).status, "landed");
+ await assert.rejects(short.run, /not landed/);
assert.equal((await stillNeeds()).needsAttention, true, "a short partial does not supersede");
- assert.ok(shortLog.some((l) => /does not supersede/.test(l)));
- const shortRow = (await rowOf(id)).find((r) => r.status === "landed" && r.fromStart && r.coverage)!;
+ const shortRow = (await rowOf(id)).find((r) => r.status === "failed" && /not landed/.test(r.error ?? ""))!;
+ assert.equal(shortRow.keptParts?.length, 1);
assert.equal(shortRow.coverage?.covers, false);
assert.equal(shortRow.coverage?.basis, "clock");
// (c) the ended stream's own duration, 610 s, against 600 s captured: covers.
- const whole = await incidentRun(id, writesAfter(0), { meta: { ...YT_META(id), live_status: "post_live", duration: 610 } });
+ // (c) the ended stream's own duration, 710 s, against 700 s captured: covers,
+ // so it replaces the stored live-edge recording.
+ const whole = await incidentRun(
+ id,
+ async (args) => {
+ await writeFile(`${args[args.indexOf("-o") + 1]!.replace(/\.%\(ext\)s$/, "")}.mp4`, "format=mov,mp4;seconds=700;");
+ return { exitCode: 0, stderrTail: "", signalled: false };
+ },
+ { meta: { ...YT_META(id), live_status: "post_live", duration: 710 } },
+ );
assert.equal((await whole.run).status, "landed");
const failed = await stillNeeds();
assert.ok(failed.supersededBy, "the whole stream, from its start, supersedes");
@@ -1067,59 +1077,24 @@ const leftover = async (id: string, seconds: number) => {
return f;
};
-test("covered (a): a Kick VOD that covers the stream lands, the channel's live-edge part is removed, nobody is asked", async () => {
- const KICK = { handling: "transcribe", url: "https://kick.com/synthb/videos", platform: "kick", name: "Synth Kick B" } as ChannelConfig;
- const slug = "synth-kick-b";
- await mkdir(path.join(CORPUS, "channels", slug, "data"), { recursive: true });
- await writeFile(path.join(CORPUS, "channels", slug, "config.json"), JSON.stringify(KICK));
- const uuid = "01a164b1-0c18-723a-a785-f9637c98aaaa";
- const s = await recordLiveRun({
- paths,
- request: { slug, url: "https://kick.com/synthb" },
- plan: { url: "https://kick.com/synthb", platform: "kick", id: null, kickChannel: "synthb" },
- channelConfig: KICK,
- cookiePolicy: NO_COOKIES,
- onLog: () => {},
- signal: new AbortController().signal,
- deps: {
- kickVod: async () => ({ id: uuid, url: `https://kick.com/synthb/videos/${uuid}` }),
- refresh: refreshWith({
- id: uuid,
- extractor: "kick:vod",
- live_status: "is_live",
- uploader_id: "synthb",
- // Started 5000 s ago: the VOD's 5000 s is the whole stream.
- release_timestamp: Math.floor(Date.now() / 1000) - 5000,
- formats: [{ protocol: "m3u8_native", height: 360, url: "https://stream.kick.com/y/360p30/playlist.m3u8" }],
- }),
- spawn: async ({ args }) => {
- await writeFile(args[args.indexOf("-o") + 1]!, "format=mpegts;seconds=1000;");
- return { exitCode: 0, stderrTail: "", signalled: false };
- },
- poll: async (o) => {
- await writeFile(o.output, "format=mpegts;seconds=5000;");
- return { segments: 500, seconds: 5000, gaps: 0, firstSeq: 0, ended: "the VOD has not grown" };
- },
- land,
- freeBytes: async () => 1e15,
- handoff,
- shuttingDown: () => false,
- },
- });
- assert.equal(s.landed?.seconds, 5000);
- assert.deepEqual((await readdir(path.join(paths.savedVideosDir, slug))).filter((n) => n.startsWith(`.${uuid}.`)), [], "the live-edge part went");
- const { listLiveRecordings } = await import("./liveRecordings");
- const row = (await listLiveRecordings(paths, { slug, id: uuid, all: true })).rows[0]!;
- assert.equal(row.coverage?.covers, true);
- assert.equal(row.keptParts, undefined);
- assert.equal(row.removedParts?.length, 1);
- assert.match(row.removedParts![0]!.why, /holds the whole stream/);
- assert.equal(row.needsAttention, false);
-});
-
test("covered (b): a from-start landing that covers the stream removes an earlier run's partial, nobody is asked", async () => {
const id = "exmplcov0b1";
const earlier = await leftover(id, 300);
+ // Its run's row says it was recorded from the start (a part no row
+ // describes may hold the stream's end, and is kept).
+ const { upsertLiveRecordingRow } = await import("../lib/liveRecordings-server");
+ await ytChannel();
+ await upsertLiveRecordingRow(paths, YT_SLUG, {
+ id,
+ url: ytUrl(id),
+ platform: "youtube",
+ startedAt: "2026-11-20T01:00:00.000Z",
+ status: "failed",
+ fromStart: true,
+ attempts: 1,
+ mustKeep: true,
+ parts: [{ method: "ytdlp", url: ytUrl(id), fromStart: true, startedAt: "2026-11-20T01:00:00.000Z", stem: path.basename(earlier).replace(/\.mp4$/, "") }],
+ });
const { run } = await incidentRun(id, writesAfter(0), { meta: { ...YT_META(id), release_timestamp: Math.floor(Date.now() / 1000) - 590 } });
assert.equal((await run).status, "landed");
await assert.rejects(stat(earlier), "the earlier partial is inside the landed file");
@@ -1175,3 +1150,140 @@ test("a landing that fails removes nothing: the covered landing's other part and
assert.equal(row.keptParts?.length, 2);
assert.equal(row.needsAttention, true);
});
+
+// --- The landing and the store (lane landing-fix): a container already in the
+// store is never deleted around nor replaced by a part not proven to hold it ---
+
+const dataDir = (id: string) => path.join(CORPUS, "channels", YT_SLUG, "data", id);
+const storedSeconds = async (id: string): Promise<number | null> => {
+ const { savedVideoPath } = await import("../lib/savedVideo");
+ const p = await loadSavedVideo(dataDir(id));
+ return p ? ((await fakeProbe(savedVideoPath(p)))?.seconds ?? null) : null;
+};
+const okExit = { exitCode: 0, stderrTail: "", signalled: false };
+const failEmpty = { exitCode: 1, stderrTail: EMPTY, signalled: false };
+const left = async (id: string) => (await readdir(store()).catch(() => [] as string[])).filter((n) => n.startsWith(`.${id}.`));
+// Run 1: `seconds` from its start, landed by an editor shutdown.
+async function landedAtShutdown(id: string, seconds: number) {
+ const ac = new AbortController();
+ const r = await incidentRun(
+ id,
+ async (args) => {
+ await writeFile(`${outOf(args)}.mp4`, `format=mov,mp4;seconds=${seconds};`);
+ ac.abort();
+ return { exitCode: null, stderrTail: "", signalled: true };
+ },
+ { signal: ac.signal, deps: { shuttingDown: () => true } },
+ );
+ assert.equal((await r.run).status, "interrupted");
+ assert.equal(await storedSeconds(id), seconds);
+}
+
+test("landing 1.2/1.1: a later run's live-edge part — longer or shorter — never replaces the stored start and is never deleted: kept, the store untouched, a person asked", async () => {
+ for (const [id, edge] of [
+ ["exmpllf1201", 7000],
+ ["exmpllf1202", 2000],
+ ] as const) {
+ await landedAtShutdown(id, 3600);
+ const r = await incidentRun(id, async (args, n) => {
+ if (n <= 3) return failEmpty;
+ await writeFile(`${outOf(args)}.mp4`, `format=mov,mp4;seconds=${edge};`);
+ return okExit;
+ });
+ await assert.rejects(r.run, /not landed/);
+ assert.equal(await storedSeconds(id), 3600, `${id}: the stored start is still the stored container`);
+ assert.ok((await left(id)).some((n) => /ytdlp-edge-a4\.mp4$/.test(n)), `${id}: the live-edge part is still on disk`);
+ const row = (await rowOf(id)).find((x) => x.status === "failed")!;
+ assert.ok(row.keptParts?.some((k) => /ytdlp-edge-a4$/.test(k.stem)));
+ assert.equal(row.needsAttention, true);
+ }
+});
+
+test("landing 1.1: when the landing keeps the container already in the store, NOTHING is removed", async () => {
+ const id = "exmpllf1101";
+ const one = await incidentRun(id, async (args) => {
+ await writeFile(`${outOf(args)}.mp4`, "format=mov,mp4;seconds=7300;");
+ return okExit;
+ });
+ assert.equal((await one.run).status, "landed");
+ const earlier = await leftover(id, 300);
+ const two = await incidentRun(id, async (args) => {
+ await writeFile(`${outOf(args)}.mp4`, "format=mov,mp4;seconds=7200;");
+ return okExit;
+ });
+ await assert.rejects(two.run, /not landed/);
+ assert.equal(await storedSeconds(id), 7300);
+ assert.ok((await stat(earlier)).size > 0, "the earlier part is not removed");
+ assert.equal((await left(id)).filter((n) => n !== path.basename(earlier)).length, 1, "this run's part is not removed");
+ const row = (await rowOf(id)).find((x) => x.status === "failed")!;
+ assert.equal(row.removedParts, undefined);
+ assert.equal(row.keptParts?.length, 2);
+ assert.equal(row.needsAttention, true);
+});
+
+test("landing: an index-0 part is not 'inside' a longer index-0 part of the run (a sliding window): kept", async () => {
+ const id = "exmpllfidx1";
+ const UNSUPPORTED = "ERROR: [youtube] x: --live-from-start is passed, but there are no formats that can be downloaded from the start\n";
+ const { run } = await incidentRun(id, async (args, n) => {
+ if (n === 1) return { exitCode: 1, stderrTail: UNSUPPORTED, signalled: false };
+ if (n === 2) {
+ // Audio only, then the video stream failed: retried.
+ await writeFile(`${outOf(args)}.f140.m4a`, "format=mp4;seconds=300;v=none;");
+ return { exitCode: 1, stderrTail: "1: ERROR: The downloaded file is empty\n", signalled: false };
+ }
+ await writeFile(`${outOf(args)}.mp4`, "format=mov,mp4;seconds=600;");
+ return okExit;
+ });
+ assert.equal((await run).status, "landed");
+ assert.ok((await left(id)).some((n) => /\.f140\.m4a$/.test(n)), "the earlier index-0 part is kept");
+ const row = (await rowOf(id))[0]!;
+ assert.ok(row.keptParts?.length);
+});
+
+test("landing: a live-edge part goes only when the landed file is from the start and as long as the ended stream's own duration less a minute", async () => {
+ const KICK = { handling: "transcribe", url: "https://kick.com/synthc/videos", platform: "kick", name: "Synth Kick C" } as ChannelConfig;
+ const slug = "synth-kick-c";
+ await mkdir(path.join(CORPUS, "channels", slug, "data"), { recursive: true });
+ await writeFile(path.join(CORPUS, "channels", slug, "config.json"), JSON.stringify(KICK));
+ for (const [uuid, duration, gone] of [
+ ["01a164b1-0c18-723a-a785-f9637c98bbb1", null, false],
+ ["01a164b1-0c18-723a-a785-f9637c98bbb2", 5000, true],
+ ] as const) {
+ let reads = 0;
+ const meta = { id: uuid, extractor: "kick:vod", uploader_id: "synthc", release_timestamp: Math.floor(Date.now() / 1000) - 5000, formats: [{ protocol: "m3u8_native", height: 360, url: "https://stream.kick.com/y/360p30/playlist.m3u8" }] };
+ await recordLiveRun({
+ paths,
+ request: { slug, url: "https://kick.com/synthc" },
+ plan: { url: "https://kick.com/synthc", platform: "kick", id: null, kickChannel: "synthc" },
+ channelConfig: KICK,
+ cookiePolicy: NO_COOKIES,
+ onLog: () => {},
+ signal: new AbortController().signal,
+ deps: {
+ kickVod: async () => ({ id: uuid, url: `https://kick.com/synthc/videos/${uuid}` }),
+ // Live at the first read; ended (with its duration, when known) after.
+ refresh: async (cwd: string, args: string[]) => {
+ reads++;
+ const o = args[args.indexOf("-o") + 1]!;
+ const m = reads === 1 ? { ...meta, live_status: "is_live" } : { ...meta, live_status: "was_live", ...(duration ? { duration } : {}) };
+ await writeFile(path.join(cwd, path.dirname(o), "metadata.info.json"), JSON.stringify(m));
+ return { exitCode: 0, stderrTail: "", archiveLine: null, formatLine: null };
+ },
+ spawn: async ({ args }) => {
+ await writeFile(args[args.indexOf("-o") + 1]!, "format=mpegts;seconds=30;");
+ return { exitCode: 0, stderrTail: "", signalled: false };
+ },
+ poll: async (o) => {
+ await writeFile(o.output, "format=mpegts;seconds=5000;");
+ return { segments: 500, seconds: 5000, gaps: 0, firstSeq: 0, ended: "the VOD has not grown" };
+ },
+ land,
+ freeBytes: async () => 1e15,
+ handoff,
+ shuttingDown: () => false,
+ },
+ });
+ const files = (await readdir(path.join(paths.savedVideosDir, slug))).filter((n) => n.startsWith(`.${uuid}.`));
+ assert.equal(files.length === 0, gone, `${uuid}: the channel's live-edge part ${gone ? "goes" : "is kept (coverage by the clock proves nothing)"}`);
+ }
+});
diff --git a/common/controller/recordLive.ts b/common/controller/recordLive.ts
@@ -97,7 +97,8 @@ import { liveRecordingCheckCommand } from "./liveRecordings";
import { setDoNotClean } from "../lib/doNotClean-server";
import type { Paths } from "../lib/paths";
import { detectPlatform } from "../lib/platform";
-import { savedVideoDir, savedVideoRoot } from "../lib/savedVideo";
+import { savedVideoDir, savedVideoPath, savedVideoRoot } from "../lib/savedVideo";
+import { loadSavedVideo } from "../lib/savedVideo-server";
import { assertSavedVideosStoreWritable } from "../lib/savedVideoStore";
import { getFreeBytes } from "../lib/diskSpace";
import { formatBytes } from "../lib/format";
@@ -1092,6 +1093,7 @@ async function recordLiveRunInner(
): Promise<RecorderOutcome> => {
const file = separate ? stemPath(tag) : partPath(tag);
const part = begin("ytdlp", url, file, mode !== "now");
+ if (mode === "index0") part.index0 = true;
await save();
const args = ytdlpLiveArgs({
url,
@@ -1446,12 +1448,19 @@ async function recordLiveRunInner(
// Inside the landed file without asking how long the stream is: a shorter
// part of THIS run, both from the start (both begin where the stream's
// record begins).
+ // Never an index-0 part (`--no-live-from-start`, ffmpeg at the playlist's
+ // first LISTED segment) unless the playlist was read to reach the start: on
+ // a DVR window that slides, a later one starts later. Those go only by the
+ // coverage rule.
+ const sure = (p: LivePart) => !p.index0 || record.reach?.fromStart === true;
const contained = (c: Candidate) =>
c !== best &&
c.part !== undefined &&
best.part !== undefined &&
c.part.fromStart &&
best.part.fromStart &&
+ sure(c.part) &&
+ sure(best.part) &&
c.seconds !== null &&
best.seconds !== null &&
c.seconds <= best.seconds;
@@ -1502,11 +1511,24 @@ async function recordLiveRunInner(
});
const cov = record.coverage;
// Covered: every other part of the stream, this run's or an earlier one's,
- // is inside the landed file by definition, and goes (recorded, with why).
+ // is inside the landed file, and goes (recorded, with why) — except a part
+ // that may hold the stream's END: one not from the start (a live-edge part,
+ // one no row describes), which goes only when the landed file is from the
+ // start and, on the media's own length, at least the ENDED stream's own
+ // duration less 60 s; never on a coverage by the clock, nor on a live or
+ // unknown-length stream.
// Not covered — a live-edge landing, a partial, a stream whose length is
// not known — every other part with bytes is kept and needs a person.
+ const placeRows = await loadLiveRecordingRows(paths, req.slug).catch(() => []);
+ const placeOf = new Map(placeRows.filter((r) => r.id === id).flatMap((r) => r.parts).filter((x) => x.stem).map((x) => [x.stem!, x]));
+ const endedDuration = cov.basis === "duration" ? cov.streamSeconds : null;
+ const mayHoldEnd = (o: Other): boolean => {
+ const p = o.part ?? placeOf.get(o.group.stem);
+ if (p?.fromStart && sure(p)) return false;
+ return !(landedFromStart === true && best.seconds !== null && endedDuration !== null && best.seconds >= endedDuration - 60);
+ };
for (const o of others) {
- if (cov.covers) {
+ if (cov.covers && !mayHoldEnd(o)) {
toRemove.push({
group: o.group,
why: `inside the landed file, which holds the whole stream from its start (${spanWords(cov.capturedSeconds ?? 0)} of ${spanWords(cov.streamSeconds ?? 0)}, ${cov.basis === "duration" ? "its duration" : "by the clock"})`,
@@ -1538,6 +1560,37 @@ async function recordLiveRunInner(
say(`${RECORD_LIVE_RESULT_MARKER}${JSON.stringify(summary)}`);
throw new Error(record.error);
};
+ // NOTHING LANDED: the store keeps what it holds, and every part — the one
+ // that would have landed and every part meant for removal — stays, listed,
+ // needing a person. Nothing is removed.
+ const notLanded = async (why: string): Promise<RecordLiveSummary> => {
+ await keep(best.group, `not landed: ${why}`, { seconds: best.seconds, ...(best.part ? { part: best.part } : {}), extra: [best.file] });
+ for (const r of toRemove) await keep(r.group, `${r.o.why}; kept: nothing was landed`, r.o);
+ record.status = stopped?.status ?? "failed";
+ if (stopped) record.stoppedBy = stopped.by;
+ record.endedAt = now().toISOString();
+ record.error = `not landed: ${why}`;
+ if (kept.length) record.keptParts = kept;
+ sayKept();
+ await save();
+ summary.status = record.status;
+ say(`${RECORD_LIVE_RESULT_MARKER}${JSON.stringify(summary)}`);
+ if (!cancelled) throw new Error(record.error);
+ return summary;
+ };
+ // A CONTAINER ALREADY IN THE STORE (an earlier run's landing, a shutdown's
+ // included) is replaced only by a file that holds the whole stream from its
+ // start (the coverage rule): "longer" is not containment — a live-edge part
+ // after a restart is longer and holds none of the stored start.
+ const pointer = await loadSavedVideo(videoDir).catch(() => null);
+ const storedPath = pointer ? savedVideoPath(pointer) : null;
+ if (storedPath && (await stat(storedPath).then((x) => x.isFile(), () => false)) && !cov.covers) {
+ const storedSeconds = (await probe(storedPath, landSignal).catch(() => null))?.seconds ?? null;
+ return notLanded(
+ `the store already holds a recording of this stream (${storedSeconds !== null ? spanWords(storedSeconds) : "length unknown"}), ` +
+ "and this one is not proven to hold it (not the whole stream from its start): the stored one stays",
+ );
+ }
let landed: Awaited<ReturnType<typeof landMediaFile>>;
try {
landed = await landMediaFile({
@@ -1566,6 +1619,11 @@ async function recordLiveRunInner(
);
}
}
+ // The landing kept the store's own container: nothing of this run was
+ // stored, so nothing is removed.
+ if (landed.kept !== "new") {
+ return notLanded(`the store holds a recording as long or longer (${spanWords(landed.existingSeconds ?? 0)}); this one may hold time it does not`);
+ }
for (const r of toRemove) await removeGroup(r.group, r.why, r.extra);
// The landed part's files were staging scratch (it is moved or copied into
// the store), and so were the streams a merge was made from.
diff --git a/common/lib/liveCapture.ts b/common/lib/liveCapture.ts
@@ -449,6 +449,9 @@ export type LivePart = {
// nothing: the stream that is missing ("unknown": the one that wrote could
// not be read).
missingStream?: MissingStream;
+ // Recorded `--no-live-from-start` with ffmpeg at the playlist's first listed
+ // segment: from the start only if the playlist reaches it.
+ index0?: boolean;
};
export type MissingStream = "video" | "audio" | "unknown";
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,6 +1,14 @@
# Changelog
## [Unreleased]
+- **A live recording's landing never deletes around, or replaces, a recording already in the store that it is not
+ proven to hold.**
+ - When the landing keeps the container already stored, nothing is removed: the part and every part meant for
+ removal stay, listed, and the run says "not landed" and needs a person. Before, those parts were deleted.
+ - A stored container is replaced only by a file that holds the whole stream from its start; a longer live-edge
+ part (after a restart) no longer replaces the stream's start.
+ - A live-edge part goes only when the landed file is as long as the ended stream's duration less a minute; an
+ index-0 part is never taken as inside a longer one.
- **Network exits (trial): rumble and twitch listings through named proxies.**
- New `settings.network`: exits `{id, label, scheme, host, port, credentials, enabled}` (`socks5h`, `socks5`,
`http`, `https`), a policy per platform, cookie-jar pins, `credentialsFile` and `startupProbe`. Absent = every