fix: scope extraction follow-up work

Remove .rd-output staging and merge handling, parse validated native extractor output, and drive nested extraction, rename, audio, cleanup, residual handling, and library collection from package-owned output records. Preserve provenance migration, package pruning, and run-owned waiter isolation while allowing one bounded legacy adoption scan only for provably exclusive package roots.
This commit is contained in:
Sucukdeluxe
2026-08-22 13:54:25 +02:00
parent 9049489e87
commit 58237bed0c
10 changed files with 952 additions and 533 deletions
+28
View File
@@ -17,6 +17,7 @@ import {
shouldSerialRetryParallelFailures,
findArchiveCandidates,
orderExtractorCandidatesForArchive,
parseNativeExtractOutput,
resolveExtractorBackendModeForArchive,
resolveExtractorBackendMode,
shouldFallbackLegacyRarToJvm,
@@ -1467,5 +1468,32 @@ describe("extractor", () => {
expect(fs.existsSync(path.join(targetDir, "second.txt"))).toBe(false);
});
it("strictly parses native output paths and fails closed for ambiguous rename output", () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), "rd-native-output-"));
tempDirs.push(root);
const targetDir = path.join(root, "out");
fs.mkdirSync(targetDir, { recursive: true });
const archivePath = path.join(root, "archive.7z");
const exactPath = path.join(targetDir, "folder", "episode.mkv");
fs.mkdirSync(path.dirname(exactPath), { recursive: true });
fs.writeFileSync(exactPath, "video");
expect(parseNativeExtractOutput("7z.exe", "- folder\\episode.mkv", archivePath, targetDir, "overwrite")).toEqual([
expect.objectContaining({ entryPath: "folder/episode.mkv", outputPath: exactPath, disposition: "overwritten" })
]);
expect(parseNativeExtractOutput("UnRAR.exe", `Extracting ${exactPath} OK`, archivePath, targetDir, "overwrite")).toEqual([
expect.objectContaining({ entryPath: "folder/episode.mkv", outputPath: exactPath })
]);
expect(parseNativeExtractOutput("7z.exe", "- ..\\foreign.mkv", archivePath, targetDir, "overwrite")).toEqual([]);
const renamedPath = path.join(targetDir, "episode (1).mkv");
fs.writeFileSync(path.join(targetDir, "episode.mkv"), "foreign");
fs.writeFileSync(renamedPath, "owned");
expect(parseNativeExtractOutput("7z.exe", "- episode.mkv", archivePath, targetDir, "rename")).toEqual([]);
expect(parseNativeExtractOutput("7z.exe", "- episode (1).mkv", archivePath, targetDir, "rename")).toEqual([
expect.objectContaining({ outputPath: renamedPath, disposition: "renamed" })
]);
});
});
});