fix(organize): recover legacy requests without dropping one-off intent

This commit is contained in:
root committed 2026-10-13 20:38:30 +08:00
1 parent ee0d62ae6f
commit 407cb7eb36
6 files changed
+616 -32

No files matched your search

@@ -1,3 +1,4 @@
import { randomUUID } from "node:crypto";
import { symlink, unlink, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { createTempTree, type TempTree } from "@umt/testkit";
@@ -123,7 +124,7 @@ describe.skipIf(!hasPg)("按路径身份补齐后恢复原整理", () => {
).toMatchObject({ retryOfRecordId: plan.recordId });
});
it("身份已找到但重新规划失败,保持原事项待处理", async () => {
const { dec } = await unknown("Blocked.Path", { targetLibraryRootId: "missing-root" });
const { dec } = await unknown("Blocked.Path", { targetLibraryRootId: randomUUID() });
const entityId = await seedEntity(h.db, { kind: "movie", title: "Blocked Path", year: 2022 });
await expect(assignOrganizeIdentity(h.d, dec.id, { mediaEntityId: entityId }, actor, "标题一致")).rejects.toThrow(
/重新整理没能执行/,
@@ -165,7 +166,9 @@ describe.skipIf(!hasPg)("按路径身份补齐后恢复原整理", () => {
it("旧记录没有请求快照时拒绝猜测一次性参数", async () => {
const { plan } = await unknown("Legacy.Path");
await h.db.updateTable("organization_record").set({ plan: "{}" }).where("id", "=", plan.recordId!).execute();
await expect(retryOrganizeRecord(h.d, plan.recordId!, actor, "test")).rejects.toThrow(/没有可恢复/);
await expect(retryOrganizeRecord(h.d, plan.recordId!, actor, "test")).rejects.toThrow(
/本次整理设置.*已保留可用信息/,
);
});
it("整理文件季集事项默认调查,无写授权降级建议,资源站普通事项不开启全局恢复", async () => {
await h.setSettings("agent", { autoInvestigate: false, autoIdentifyOrganize: true });