fix(artifacts): deduplicate keyed archive selector choices

This commit is contained in:
morluto
2026-10-27 07:54:09 +08:00
parent b8f58fd7ca
commit 8a47cbbcce
2 changed files with 16 additions and 7 deletions
+3 -6
View File
@@ -240,18 +240,15 @@ export const inspectStandaloneKeyedArchive = (input: {
const selected = keyedArchiveInputSchema.parse(input.parameters);
const selectedBasename = basename(input.selectedPath);
const physicalBasename = basename(input.path);
if (
selected.path !== "." &&
selected.path !== selectedBasename &&
selected.path !== physicalBasename
)
const basenames = [...new Set([selectedBasename, physicalBasename])];
if (selected.path !== "." && !basenames.includes(selected.path))
throw new AnalysisInputError("inspect_keyed_archive", undefined, [
{
path: ["path"],
reason: "invalid_value",
message:
"For an active plist, path must select that archive (omit path or use its basename).",
expected: [selectedBasename, physicalBasename],
expected: basenames.length === 1 ? selectedBasename : basenames,
},
]);
await assertStandaloneArchiveSelection(
@@ -76,7 +76,19 @@ it.skipIf(process.platform === "win32")(
await session.execute("inspect_keyed_archive", {
path: "unrelated.plist",
}),
).toMatchObject({ ok: false, error: { _tag: "AnalysisInputError" } });
).toMatchObject({
ok: false,
error: {
_tag: "AnalysisInputError",
issues: [
{
path: ["path"],
reason: "invalid_value",
expected: [alias.split("/").at(-1), "stored.plist"],
},
],
},
});
}
await unlink(aliases[1]!);
await symlink(other, aliases[1]!);