commit 1c24570048f55923966e5c7a4d1916cb9e2e33be
parent c89aec1a6c95033a2e3e4f2305fe9b9a528642f4
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 21 Sep 2026 02:36:07 -0400
channelSets: the settled rule belongs in a test beside the sets it changes
Two cases and a control: a settled video leaves missingNeverFetched and
undownloaded; an unsettled one still raises the alarm, so the subtraction has
not made the category unreachable; and an omitted (or empty) settled set is
byte-identical, which is every channel without a filter.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat:
1 file changed, 39 insertions(+), 0 deletions(-)
diff --git a/common/controller/channelSets.test.ts b/common/controller/channelSets.test.ts
@@ -21,11 +21,13 @@ function derive(input: {
roster: ReadonlyArray<string>;
listed: ReadonlyArray<string>;
onDisk: ReadonlyArray<string>;
+ settled?: ReadonlyArray<string>;
}) {
return deriveChannelSets({
roster: rosterOf(input.roster),
listedIds: new Set(input.listed),
onDiskIds: new Set(input.onDisk),
+ ...(input.settled ? { settledIds: new Set(input.settled) } : {}),
});
}
@@ -111,3 +113,40 @@ test("an empty channel derives empty sets rather than throwing", () => {
orphaned: [],
});
});
+
+test("a settled video is neither never-fetched nor undownloaded", () => {
+ // BOTH SETS ARE DEFINED BY THE ABSENCE OF A DIRECTORY, and a video the
+ // download filter settled has none — a title-filter rejection deletes its own
+ // prefetch dir. So without subtracting the settled set, a filtered-out video
+ // that later leaves the listing reads as "we were told about this, never got
+ // it, and it is gone", which is the loudest alarm this system raises and the
+ // sweep prints a recovery prompt for it.
+ const sets = derive({
+ roster: ["keep", "drop"],
+ listed: ["keep"],
+ onDisk: [],
+ settled: ["drop"],
+ });
+ assert.deepEqual(sets.missingNeverFetched, []);
+ assert.deepEqual(sets.undownloaded, ["keep"]);
+ // And the control: the same corpus with nothing settled still raises it, so
+ // the subtraction has not made the category unreachable.
+ const unsettled = derive({
+ roster: ["keep", "drop"],
+ listed: ["keep"],
+ onDisk: [],
+ });
+ assert.deepEqual(unsettled.missingNeverFetched, ["drop"]);
+});
+
+test("an omitted settled set changes nothing, for every channel without a filter", () => {
+ const withEmpty = derive({
+ roster: ["a", "b"],
+ listed: ["a"],
+ onDisk: [],
+ settled: [],
+ });
+ const without = derive({ roster: ["a", "b"], listed: ["a"], onDisk: [] });
+ assert.deepEqual(withEmpty, without);
+});
+