fix: rescan project files when category coverage changes

This commit is contained in:
muena
2026-10-19 12:34:07 +02:00
parent f71e46f735
commit 731c449c33
5 changed files with 33 additions and 3 deletions

View File

@@ -25,6 +25,7 @@ describe("Nachbearbeitung von Projektständen", () => {
PERSON_03: { type: "PERSON", original: "Hr. Fuchs" },
PERSON_04: { type: "PERSON", original: "Franz F." },
};
saved.run.entityTypes = ["PERSON", "EMAIL"];
saved.run.files = [{ source: "Bericht.txt", output: "PERSON_01-PERSON_03.txt", kind: "text" }];
saved.run.sourceState = { "Bericht.txt": { hash: "synthetic-hash", output: "PERSON_01-PERSON_03.txt" } };
await fs.writeFile(join(saved.directory, "files", "PERSON_01-PERSON_03.txt"),
@@ -47,6 +48,7 @@ describe("Nachbearbeitung von Projektständen", () => {
expect(result.run.mapping.PERSON_03.merged_into).toBe("PERSON_02");
expect(result.run.mapping.PERSON_04.merged_into).toBe("PERSON_02");
expect(result.run.mapping.PERSON_01).toBeUndefined();
expect(result.run.entityTypes).toEqual(["PERSON", "EMAIL"]);
expect(await project.loadProjectWhitelist(source, support))
.toEqual([{ type: "PERSON", original: "Falsch Positiv" }]);
expect(await fs.readFile(join(saved.directory, "files", "PERSON_01-PERSON_03.txt"), "utf8"))

View File

@@ -414,4 +414,18 @@ describe("Velum-Projektstände", () => {
expect(await project.reusableProjectOutput(created.run, created.directory, "PERSON_01.txt",
project.digest(Buffer.from("PERSON_01")))).toBe("PERSON_01.txt");
});
it("analysiert unveränderte Dateien bei unbekannter oder geänderter Kategorieauswahl neu", async () => {
const root = await fs.mkdtemp(join(tmpdir(), "velum-category-coverage-"));
roots.push(root);
const source = join(root, "Quelle");
const support = join(root, "Raycast");
await fs.mkdir(source);
const { run } = await project.createRun(source, support);
expect(project.sameEntityTypeCoverage(run, ["EMAIL"])).toBe(false);
run.entityTypes = ["PERSON", "EMAIL"];
expect(project.sameEntityTypeCoverage(run, ["EMAIL", "PERSON"])).toBe(true);
expect(project.sameEntityTypeCoverage(run, ["PERSON"])).toBe(false);
expect(project.sameEntityTypeCoverage(run, ["PERSON", "EMAIL", "URL"])).toBe(false);
});
});