Fix parallel extraction false positives

This commit is contained in:
Sucukdeluxe
2026-03-10 19:34:42 +01:00
parent d8535990ae
commit 113b34fadf
2 changed files with 61 additions and 0 deletions
+14
View File
@@ -12,6 +12,7 @@ import {
archiveFilenamePasswords,
detectArchiveSignature,
classifyExtractionError,
shouldSerialRetryParallelFailures,
findArchiveCandidates,
orderExtractorCandidatesForArchive,
resolveExtractorBackendModeForArchive,
@@ -1048,6 +1049,19 @@ describe("extractor", () => {
});
});
describe("shouldSerialRetryParallelFailures", () => {
it("keeps serial recovery enabled after mixed parallel results", () => {
expect(shouldSerialRetryParallelFailures(1, ["wrong_password"])).toBe(true);
expect(shouldSerialRetryParallelFailures(2, ["missing_parts"])).toBe(true);
});
it("only retries a total parallel wipe-out for contention-like failures", () => {
expect(shouldSerialRetryParallelFailures(0, ["crc_error", "wrong_password", "unknown"])).toBe(true);
expect(shouldSerialRetryParallelFailures(0, ["missing_parts"])).toBe(false);
expect(shouldSerialRetryParallelFailures(0, ["unsupported_format", "crc_error"])).toBe(false);
});
});
describe("password discovery", () => {
it("reports per-archive failures through onArchiveFailure", async () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), "rd-extract-failure-"));