drop review_plans.verified column and all its references

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-15 06:55:43 +02:00
parent 81b2990dca
commit cbf0025a81
6 changed files with 7 additions and 84 deletions
-58
View File
@@ -182,61 +182,3 @@ describe("processWebhookEvent — done-status override", () => {
expect(planStatusFor(db, fresh.Id)).toBe("pending");
});
});
describe("processWebhookEvent — webhook_verified flag", () => {
beforeEach(() => _resetDedupe());
async function runWebhook(db: Database, item: JellyfinItem, cfg: RescanConfig = RESCAN_CFG) {
return processWebhookEvent(
{ NotificationType: "ItemAdded", ItemId: item.Id, ItemType: item.Type as "Movie" | "Episode" },
{ db, jellyfin: JF, rescanCfg: cfg, getItemFn: async () => item },
);
}
function verifiedFor(db: Database, jellyfinId: string): number {
return (
db
.prepare(
"SELECT rp.verified as v FROM review_plans rp JOIN media_items mi ON mi.id = rp.item_id WHERE mi.jellyfin_id = ?",
)
.get(jellyfinId) as { v: number }
).v;
}
test("is_noop=1 on first scan sets webhook_verified=1 (no Jellyfin round-trip needed)", async () => {
const db = makeDb();
const fresh = fakeItem();
await runWebhook(db, fresh);
expect(verifiedFor(db, fresh.Id)).toBe(1);
});
test("a post-execute webhook that still says is_noop=1 keeps webhook_verified=1", async () => {
const db = makeDb();
const fresh = fakeItem();
await runWebhook(db, fresh);
_resetDedupe();
await runWebhook(db, fresh);
expect(verifiedFor(db, fresh.Id)).toBe(1);
});
test("webhook that flips plan off-noop clears webhook_verified back to 0", async () => {
const db = makeDb();
const noopItem = fakeItem();
await runWebhook(db, noopItem);
expect(verifiedFor(db, noopItem.Id)).toBe(1);
// Second probe: Jellyfin reports a drifted file (extra french track
// that the 'deu' language config would now remove → is_noop=0).
const driftedCfg: RescanConfig = { ...RESCAN_CFG, audioLanguages: ["deu"] };
const drifted = fakeItem({
MediaStreams: [
{ Type: "Video", Index: 0, Codec: "h264" },
{ Type: "Audio", Index: 1, Codec: "aac", Language: "eng", IsDefault: true },
{ Type: "Audio", Index: 2, Codec: "aac", Language: "fra" },
],
});
_resetDedupe();
await runWebhook(db, drifted, driftedCfg);
expect(verifiedFor(db, noopItem.Id)).toBe(0);
});
});