commit d6f3de11fa8c5addfa5046f1762524301aacb59d
parent 401a7097de8bbc68732db7dd7584284e152e5222
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 13 Nov 2026 21:02:41 -0500
compact-saved-videos: a restart leaves the job for a person; the panel says re-encode
The kind is replayable (a Retry resumes at the first chunk not encoded) but not
resumed by the boot pass: under dropOriginal "after-verify" it deletes
originals, and the jobs doctrine keeps destructive kinds out of the boot pass.
The video page's Source video summary names a re-encoded copy. The channel
config key count and the resumeOnBoot list hold the new key and kind.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
7 files changed, 35 insertions(+), 15 deletions(-)
diff --git a/OPERATING.md b/OPERATING.md
@@ -1168,8 +1168,9 @@ pnpm ops drop-saved-alternate --json '{"slug":"example","id":"<videoId>","file":
- **The run.** One job per channel on the `compact` queue, one video at a time. The source's packets are scanned
once. Chunks of `chunkMinutes` (10) start on source keyframes, in `<store dir>/.compact-scratch/` on the store's
drive. Each chunk is one heavy-slot admission (1.5 GB, niced), so it waits while render mode holds the machine.
- Its frame count is checked; a short or long chunk is encoded once more. Cancel and drain stop between chunks,
- and a re-run (or the boot pass after a restart) resumes at the first chunk not done. The disk floor is checked
+ Its frame count is checked; a short or long chunk is encoded once more. A cancel stops the chunk running, a drain
+ waits for it, and a re-run (the job's Retry, or the same body again) resumes at the first chunk not done; a restart leaves the
+ job for a person to retry, because the run may drop originals. The disk floor is checked
before the first chunk and before each one: two outputs, less what the chunks hold, plus 2 GiB.
- **The checks.** Every one must pass, or the original stays active and untouched, the re-encode is removed, and the
reason is in the log, the result and `.compact-scratch/failed.json`:
diff --git a/common/jobs/jobKinds.test.ts b/common/jobs/jobKinds.test.ts
@@ -412,7 +412,7 @@ test("resumeOnBoot: exactly the kinds that continue on a re-run, every one repla
]);
for (const k of resumeOnBootKindIds()) assert.equal(getJobKind(k)?.replayable, true, `${k} is replayable`);
// Never a move, a delete or a one-shot.
- for (const k of ["relocate-channel-media", "repoint-storage-location", "purge-superseded-auto-subs", "evict-clips", "sync", "fetch-chat", "record-live"]) {
+ for (const k of ["relocate-channel-media", "repoint-storage-location", "purge-superseded-auto-subs", "evict-clips", "sync", "fetch-chat", "record-live", "compact-saved-videos"]) {
assert.equal(getJobKind(k)?.resumeOnBoot, undefined, `${k} does not resume`);
}
});
@@ -433,3 +433,18 @@ test("x-run: a network, drainable, replayable ingest kind on X's queue that a re
// A restart never re-queues one left queued (jobs/bootQueuedJobs.ts).
assert.equal(meta.startedByPerson, true);
});
+
+// COMPACT SAVED VIDEOS (controller/compactSavedVideos.ts): reads and writes
+// the store, stops between chunks, rewrites the pointer a playable build reads
+// — and may delete an original, so a restart never re-runs it by itself.
+test("compact-saved-videos is a drainable, replayable media ingest kind the boot pass leaves alone", () => {
+ const meta = getJobKind("compact-saved-videos");
+ assert.ok(meta, "registered");
+ assert.equal(jobKindLabel("compact-saved-videos"), "Compact saved videos");
+ assert.equal(isDrainableKind("compact-saved-videos"), true);
+ assert.equal(meta.replayable, true);
+ assert.equal(meta.resumeOnBoot, undefined);
+ assert.equal(kindNeedsMedia("compact-saved-videos"), true);
+ assert.equal(isIngestKind("compact-saved-videos"), true);
+ assert.equal(kindIsNetwork("compact-saved-videos"), false);
+});
diff --git a/common/jobs/jobKinds.ts b/common/jobs/jobKinds.ts
@@ -1575,12 +1575,14 @@ const JOB_KINDS: Record<string, JobKindMeta> = {
// stored container re-encoded to AV1 in keyframe-aligned chunks, verified,
// swapped in as the active copy, its original kept beside it (and dropped
// only in a later step, by the rules there). Media: it reads and writes the
- // store. Drainable: it stops between chunks, and a re-run — a replay, or the
- // boot pass after an interruption — resumes at the first chunk not encoded
- // (`.compact-scratch/state.json`); a video already compacted is skipped. An
- // INGEST kind: the pointer it rewrites is what a playable build reads. ONE
- // QUEUE MACHINE-WIDE (`compact`), so one video at a time; each chunk also
- // takes the heavy slot, so builds, e2e and renders interleave.
+ // store. Drainable: it stops between chunks, and a re-run — a replay (Retry)
+ // — resumes at the first chunk not encoded (`.compact-scratch/state.json`);
+ // a video already compacted is skipped. NOT resumed by the boot pass: under
+ // `dropOriginal: "after-verify"` it deletes originals, and whether a
+ // destructive kind runs again is a person's call, not a boot's. An INGEST
+ // kind: the pointer it rewrites is what a playable build reads. ONE QUEUE
+ // MACHINE-WIDE (`compact`), so one video at a time; each chunk also takes the
+ // heavy slot, so builds, e2e and renders interleave.
"compact-saved-videos": {
kind: "compact-saved-videos",
label: "Compact saved videos",
@@ -1588,7 +1590,6 @@ const JOB_KINDS: Record<string, JobKindMeta> = {
replayable: true,
queueKeyStrategy: "custom",
needsMedia: true,
- resumeOnBoot: true,
},
};
diff --git a/common/lib/channelConfigSchema.test.ts b/common/lib/channelConfigSchema.test.ts
@@ -39,7 +39,7 @@ test("one key list: docs = coercions = schema shape, sync-state keys inside it",
assert.deepEqual(Object.keys(CHANNEL_CONFIG_COERCIONS), [...CHANNEL_CONFIG_KEYS]);
assert.deepEqual(Object.keys(channelConfigObjectSchema.shape), [...CHANNEL_CONFIG_KEYS]);
assert.deepEqual(Object.keys(CHANNEL_CONFIG_FIELD_DOCS), [...CHANNEL_CONFIG_KEYS]);
- assert.equal(CHANNEL_CONFIG_KEYS.length, 47); // 2026-11-11: `cleanAfterCaptureUnverified`; lane/local-media: opt-in `localMedia`; demo epic D1: `remoteOnly`, `remoteArchive`, `remoteUrl`
+ assert.equal(CHANNEL_CONFIG_KEYS.length, 48); // 2026-11-13: `excludeFromCompaction`; 2026-11-11: `cleanAfterCaptureUnverified`; lane/local-media: opt-in `localMedia`; demo epic D1: `remoteOnly`, `remoteArchive`, `remoteUrl`
assert.equal(sameKeys, true);
assert.equal(fits, true);
for (const k of CHANNEL_SYNC_STATE_KEYS) assert.ok(CHANNEL_CONFIG_KEYS.includes(k), k);
diff --git a/editor/app/channels/[slug]/videos/[id]/components/VideoPanel.tsx b/editor/app/channels/[slug]/videos/[id]/components/VideoPanel.tsx
@@ -445,7 +445,9 @@ export function VideoPanel({
title="Source video"
summary={
savedVideo
- ? `Persisted to the saved-video store (${formatBytes(savedVideo.bytes)}).`
+ ? savedVideo.compacted
+ ? `Persisted to the saved-video store as a re-encoded copy (${formatBytes(savedVideo.bytes)}, AV1 crf ${savedVideo.compacted.settings.crf}).`
+ : `Persisted to the saved-video store (${formatBytes(savedVideo.bytes)}).`
: "Persist the source video to the saved-video store."
}
defaultOpen={!!savedVideo}
diff --git a/editor/app/jobs/jobReplayRegistry.ts b/editor/app/jobs/jobReplayRegistry.ts
@@ -620,7 +620,7 @@ export const JOB_REPLAY_HANDLERS: Record<string, ReplayHandler> = {
minFreeMemMb: num(p.minFreeMemMb),
});
},
- // The same list, mode and overrides: a replay (or the boot pass) resumes at
+ // The same list, mode and overrides: a replay (a person's Retry) resumes at
// the first chunk not encoded and skips what is already compacted.
"compact-saved-videos": (spec) => {
const { p } = params(spec);
diff --git a/editor/app/saved-videos/compactActions.ts b/editor/app/saved-videos/compactActions.ts
@@ -53,8 +53,9 @@ function settingsFor(overrides: CompactOverrides): SavedVideoCompactionSettings
}
// One channel's list as one job on the compact queue. The job carries its ids,
-// its mode and its overrides in its spec, so a replay — or the boot pass after
-// a restart — re-runs the same list, resuming the chunks already encoded.
+// its mode and its overrides in its spec, so a replay (the job's Retry, after a
+// cancel or a restart) re-runs the same list, resuming the chunks already
+// encoded. The boot pass never re-runs it by itself: it may drop originals.
export async function compactChannelVideosAction(
slug: string,
ids: string[],