Files
rea/tests/boundary/filesystem/safeOutputTree.test.ts
morluto 61f1dede46 fix(resources)!: refuse Windows names ending in a dot or space (#15653)
* fix(resources)!: refuse Windows names ending in a dot or space

Node writes files through `\\?\` paths on Windows, so a member named
`dir/name.` or `dir/space ` is created literally. Win32 path
normalization drops a trailing dot or space when other programs open
the path, so `dir\name.` reads the bytes of a sibling `dir\name`, and
`dir\space ` cannot be opened. The extraction manifest then records a
digest for a path that ordinary tools resolve to different bytes.

A Windows output tree now refuses any path segment that ends in a dot
or space with DestinationPathUnrepresentableFailure, before creating
the path, using the trailing rule isPortablePathSegment already
applies. The refusal names the cause and the next step. Reserved device
names stay accepted, since Node creates them as ordinary files.

Every writer that materializes target-derived names goes through
SafeOutputTree (extract_artifact, firmware and UEFI publication,
desktop export, environment bundles, recovered JavaScript sources, web
script export), so all of them apply the rule. Web script export
already moves an unrepresentable URL path to its isolated layout.

Fixes #15613

BREAKING CHANGE: On Windows, extract_artifact and other output-tree
writers now refuse a path with a segment ending in a dot or space,
where they used to write it. To extract the rest of such an archive on
Windows, select occurrence_ids that leave those members out, or extract
on a non-Windows host. Web script export on Windows writes such URL
paths under its isolated layout instead.

* ci: run Windows extraction name tests in the curated Windows lane
2026-12-01 19:33:46 -05:00

657 lines
26 KiB
TypeScript

import { createHash } from "node:crypto";
import {
access,
chmod,
mkdir,
open,
readFile,
readdir,
readlink,
rename,
rm,
symlink,
writeFile,
} from "node:fs/promises";
import { join } from "node:path";
import { Readable } from "node:stream";
import { describe, expect, it, vi } from "vitest";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
import { SafeOutputTree } from "../../../src/resources/SafeOutputTree.js";
import { SafeOutputTreeDestinationRefusal } from "../../../src/resources/SafeOutputTreeAdmission.js";
import { SafeOutputTreeCreationFailure } from "../../../src/resources/SafeOutputTreeCreationFailure.js";
import { ArtifactReaderFailure } from "../../../src/resources/ArtifactReader.js";
import { DestinationPathUnrepresentableFailure } from "../../../src/resources/ArtifactPaths.js";
describe("safe artifact output cleanup", () => {
it("adopts an empty caller directory without taking authority to remove it", async () => {
const parent = await createTestTempDirectory("rea-admitted-output-");
const output = join(parent, "output");
await mkdir(output);
const tree = await SafeOutputTree.create(output, process.platform, {
acceptExistingEmpty: true,
});
await tree.write("file", Readable.from([Buffer.from("owned")]), {
bytes: 5,
sha256: createHash("sha256").update("owned").digest("hex"),
});
await tree.rollback();
expect(await readdir(output)).toEqual([]);
await tree.closeHandles();
});
it("keeps cleanup incomplete when the owned root disappears before commit", async () => {
const parent = await createTestTempDirectory("rea-safe-output-");
const output = join(parent, "published");
const tree = await SafeOutputTree.create(output);
await rm(output, { recursive: true });
await expect(tree.commit()).rejects.toMatchObject({ code: "ENOENT" });
await expect(tree.rollback()).rejects.toMatchObject({
reason: "integrity",
integrityCheck: "output-lifecycle",
cause: { code: "ENOENT" },
cleanup: { resources: [output] },
});
expect(tree.cleanup).toEqual({
status: "incomplete",
residualPaths: ["published"],
});
});
it("retries pending-file cleanup after the exclusive handle can be identified", async () => {
const parent = await createTestTempDirectory("rea-safe-output-pending-");
const output = join(parent, "published");
const destination = join(output, "payload.txt");
const prototypeHandle = await open(join(parent, "handle"), "w");
const handlePrototype = Object.getPrototypeOf(prototypeHandle) as Pick<
typeof prototypeHandle,
"stat"
>;
await prototypeHandle.close();
await rm(join(parent, "handle"));
const tree = await SafeOutputTree.create(output);
let pendingHandle: { fd: number } | undefined;
const stat = vi.spyOn(handlePrototype, "stat");
stat.mockImplementation(function (this: { fd: number }) {
pendingHandle = this;
return Promise.reject(new Error("injected file identity failure"));
});
try {
await expect(
tree.write("payload.txt", Readable.from(Buffer.from("owned")), {
sha256: createHash("sha256").update("owned").digest("hex"),
bytes: Buffer.byteLength("owned"),
}),
).rejects.toThrow("injected file identity failure");
expect(pendingHandle?.fd).toBeGreaterThanOrEqual(0);
const failure = await tree.rollback().catch((cause: unknown) => cause);
expect(failure).toMatchObject({
message: "injected file identity failure",
cleanup: { resources: [output] },
});
expect(pendingHandle?.fd).toBeGreaterThanOrEqual(0);
expect(await readFile(destination, "utf8")).toBe("");
expect(tree.cleanup).toEqual({
status: "incomplete",
residualPaths: ["published"],
});
stat.mockRestore();
expect(await tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
expect(pendingHandle?.fd).toBe(-1);
await expect(readFile(destination, "utf8")).rejects.toMatchObject({
code: "ENOENT",
});
} finally {
stat.mockRestore();
}
});
it("returns a non-empty accepted directory without wrapping or removing it", async () => {
const parent = await createTestTempDirectory("rea-safe-output-nonempty-");
const output = join(parent, "output");
await mkdir(output);
await writeFile(join(output, "caller.txt"), "keep");
const failure = await SafeOutputTree.create(output, process.platform, {
acceptExistingEmpty: true,
}).catch((cause: unknown) => cause);
expect(failure).toBeInstanceOf(SafeOutputTreeDestinationRefusal);
expect(failure).not.toBeInstanceOf(SafeOutputTreeCreationFailure);
expect(failure).toMatchObject({
message: "Output directory is not empty",
});
expect(await readFile(join(output, "caller.txt"), "utf8")).toBe("keep");
});
});
describe("safe artifact output file identity admission", () => {
it.skipIf(process.platform === "win32")(
"closes a captured pending identity and retries the path without that handle",
async () => {
const parent = await createTestTempDirectory(
"rea-safe-output-pending-path-",
);
const output = join(parent, "published");
const destination = join(output, "payload.txt");
const displaced = join(parent, "owned-payload.txt");
const prototypeHandle = await open(join(parent, "handle"), "w");
const handlePrototype = Object.getPrototypeOf(prototypeHandle) as Pick<
typeof prototypeHandle,
"stat"
>;
await prototypeHandle.close();
await rm(join(parent, "handle"));
const tree = await SafeOutputTree.create(output);
const originalStat = handlePrototype.stat;
let pendingHandle: { fd: number } | undefined;
const remember = (handle: { fd: number }): void => {
pendingHandle = handle;
};
const stat = vi.spyOn(handlePrototype, "stat");
stat.mockImplementationOnce(function (this: { fd: number }) {
remember(this);
return Promise.reject(new Error("injected file identity failure"));
});
await expect(
tree.write("payload.txt", Readable.from(Buffer.from("owned")), {
sha256: createHash("sha256").update("owned").digest("hex"),
bytes: Buffer.byteLength("owned"),
}),
).rejects.toThrow("injected file identity failure");
stat.mockImplementationOnce(async function (
this: typeof prototypeHandle,
...args
) {
remember(this);
const metadata = await originalStat.apply(this, args);
await rename(destination, displaced);
await writeFile(destination, "replacement");
return metadata;
});
try {
const failure = await tree.rollback().catch((cause: unknown) => cause);
expect(failure).toBeInstanceOf(ArtifactReaderFailure);
expect(failure).toMatchObject({
message: `Extraction file identity changed: ${destination}`,
cleanup: { resources: [output] },
});
expect(pendingHandle?.fd).toBe(-1);
expect(await readFile(destination, "utf8")).toBe("replacement");
expect(await readFile(displaced, "utf8")).toBe("");
await rm(destination);
await rename(displaced, destination);
expect(await tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
expect(await readdir(parent)).toEqual([]);
} finally {
stat.mockRestore();
}
},
);
it.skipIf(process.platform === "win32")(
"retains an O_EXCL file handle until its identity can be retried",
async () => {
const parent = await createTestTempDirectory("rea-safe-output-admit-");
const output = join(parent, "published");
const destination = join(output, "payload.txt");
const displaced = join(parent, "owned-payload.txt");
const outside = join(parent, "outside.txt");
await writeFile(outside, "outside bytes");
const prototypeHandle = await open(join(parent, "handle"), "w");
const handlePrototype = Object.getPrototypeOf(prototypeHandle) as Pick<
typeof prototypeHandle,
"stat"
>;
await prototypeHandle.close();
await rm(join(parent, "handle"));
const tree = await SafeOutputTree.create(output);
const originalStat = handlePrototype.stat;
const stat = vi.spyOn(handlePrototype, "stat");
stat
.mockImplementationOnce(function (
this: typeof prototypeHandle,
...args
) {
return originalStat.apply(this, args);
})
.mockRejectedValueOnce(new Error("injected file identity failure"));
await expect(
tree.write("payload.txt", Readable.from(Buffer.from("owned")), {
sha256: createHash("sha256").update("owned").digest("hex"),
bytes: Buffer.byteLength("owned"),
}),
).rejects.toThrow("injected file identity failure");
stat.mockRestore();
await rename(destination, displaced);
await symlink(outside, destination, "file");
const failure = await tree.rollback().catch((cause: unknown) => cause);
expect(failure).toBeInstanceOf(ArtifactReaderFailure);
expect(await readlink(destination)).toBe(outside);
expect(await readFile(outside, "utf8")).toBe("outside bytes");
await rm(destination);
await rename(displaced, destination);
expect(await tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
expect(await readdir(parent)).toEqual(["outside.txt"]);
},
);
});
describe("safe artifact output setup ownership", () => {
it.skipIf(process.platform === "win32")(
"returns its exact tree owner when setup fails after root identity capture",
async () => {
const parent = await createTestTempDirectory("rea-safe-output-setup-");
const output = join(parent, "published");
const blocker = join(output, "unowned.txt");
const prototypeHandle = await open(join(parent, "handle"), "w");
const handlePrototype = Object.getPrototypeOf(prototypeHandle) as Pick<
typeof prototypeHandle,
"chmod"
>;
await prototypeHandle.close();
await rm(join(parent, "handle"));
const chmodSpy = vi
.spyOn(handlePrototype, "chmod")
.mockImplementationOnce(async function (this: typeof prototypeHandle) {
await writeFile(blocker, "leave until cleanup retry");
throw new Error("injected setup failure");
});
const failure = await SafeOutputTree.create(output).catch(
(cause: unknown) => cause,
);
chmodSpy.mockRestore();
expect(failure).toBeInstanceOf(SafeOutputTreeCreationFailure);
if (!(failure instanceof SafeOutputTreeCreationFailure))
throw new Error("expected setup failure to retain its tree owner");
expect(failure.cause).toMatchObject({
message: "injected setup failure",
});
expect(failure.tree.outputRoot).toBe(output);
const cleanupFailure = await failure.tree
.rollback()
.catch((cause: unknown) => cause);
expect(cleanupFailure).toBeInstanceOf(ArtifactReaderFailure);
expect(await readFile(blocker, "utf8")).toBe("leave until cleanup retry");
await rm(blocker);
expect(await failure.tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
expect(await readdir(parent)).toEqual([]);
},
);
});
describe("safe artifact output tree identity", () => {
it.skipIf(process.platform === "win32")(
"refuses a replaced root and retries cleanup when the owned root is restored",
async () => {
const parent = await createTestTempDirectory("rea-safe-output-root-");
const output = join(parent, "published");
const displaced = join(parent, "owned-original");
const outside = join(parent, "outside");
await mkdir(outside);
const tree = await SafeOutputTree.create(output);
await rename(output, displaced);
await symlink(outside, output, "dir");
const writeFailure = await tree
.write("escaped.txt", Readable.from(Buffer.from("outside")), {
sha256: createHash("sha256").update("outside").digest("hex"),
bytes: Buffer.byteLength("outside"),
})
.catch((cause: unknown) => cause);
expect(writeFailure).toBeInstanceOf(ArtifactReaderFailure);
await expect(access(join(outside, "escaped.txt"))).rejects.toMatchObject({
code: "ENOENT",
});
await expect(tree.commit()).rejects.toBeInstanceOf(ArtifactReaderFailure);
const cleanupFailure = await tree
.rollback()
.catch((cause: unknown) => cause);
expect(cleanupFailure).toBeInstanceOf(ArtifactReaderFailure);
expect(cleanupFailure).toMatchObject({
cleanup: { resources: [output] },
});
expect(await readlink(output)).toBe(outside);
await rm(output);
await rename(displaced, output);
expect(await tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
expect(await readdir(parent)).toEqual(["outside"]);
},
);
it.skipIf(process.platform === "win32")(
"refuses a replaced nested parent without touching it and retries after restoration",
async () => {
const parent = await createTestTempDirectory("rea-safe-output-parent-");
const output = join(parent, "published");
const nested = join(output, "nested");
const displaced = join(parent, "owned-nested");
const outside = join(parent, "outside");
await mkdir(outside);
await writeFile(join(outside, "sentinel.txt"), "keep");
const tree = await SafeOutputTree.create(output);
const bytes = Buffer.from("owned");
await tree.write("nested/owned.txt", Readable.from(bytes), {
sha256: createHash("sha256").update(bytes).digest("hex"),
bytes: bytes.byteLength,
});
await rename(nested, displaced);
await symlink(outside, nested, "dir");
const writeFailure = await tree
.write("nested/escaped.txt", Readable.from(Buffer.from("outside")), {
sha256: createHash("sha256").update("outside").digest("hex"),
bytes: Buffer.byteLength("outside"),
})
.catch((cause: unknown) => cause);
expect(writeFailure).toBeInstanceOf(ArtifactReaderFailure);
await expect(access(join(outside, "escaped.txt"))).rejects.toMatchObject({
code: "ENOENT",
});
expect(await readFile(join(outside, "sentinel.txt"), "utf8")).toBe(
"keep",
);
const cleanupFailure = await tree
.rollback()
.catch((cause: unknown) => cause);
expect(cleanupFailure).toBeInstanceOf(ArtifactReaderFailure);
expect(await readlink(nested)).toBe(outside);
expect(await readFile(join(outside, "sentinel.txt"), "utf8")).toBe(
"keep",
);
await rm(nested);
await rename(displaced, nested);
expect(await tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
expect(await readdir(parent)).toEqual(["outside"]);
},
);
it.skipIf(process.platform === "win32")(
"preserves an outside file when a tracked output file is replaced by a symlink",
async () => {
const parent = await createTestTempDirectory("rea-safe-output-file-");
const output = join(parent, "published");
const tracked = join(output, "nested", "file.txt");
const displaced = join(parent, "owned-file.txt");
const outside = join(parent, "outside.txt");
await writeFile(outside, "outside bytes");
const tree = await SafeOutputTree.create(output);
const bytes = Buffer.from("owned bytes");
await tree.write("nested/file.txt", Readable.from(bytes), {
sha256: createHash("sha256").update(bytes).digest("hex"),
bytes: bytes.byteLength,
});
await rename(tracked, displaced);
await symlink(outside, tracked, "file");
const failure = await tree.rollback().catch((cause: unknown) => cause);
expect(failure).toBeInstanceOf(ArtifactReaderFailure);
expect(tree.cleanup).toMatchObject({ status: "incomplete" });
expect(await readlink(tracked)).toBe(outside);
expect(await readFile(outside, "utf8")).toBe("outside bytes");
await rm(tracked);
await rename(displaced, tracked);
expect(await tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
expect(await readFile(outside, "utf8")).toBe("outside bytes");
},
);
});
it("retains an untracked regular entry and retries after it is removed", async () => {
const parent = await createTestTempDirectory("rea-safe-output-untracked-");
const output = join(parent, "published");
const untracked = join(output, "untracked.txt");
const tree = await SafeOutputTree.create(output);
const bytes = Buffer.from("owned bytes");
await tree.write("owned.txt", Readable.from(bytes), {
sha256: createHash("sha256").update(bytes).digest("hex"),
bytes: bytes.byteLength,
});
await writeFile(untracked, "leave untouched");
const failure = await tree.rollback().catch((cause: unknown) => cause);
expect(failure).toBeInstanceOf(ArtifactReaderFailure);
expect(tree.cleanup).toMatchObject({ status: "incomplete" });
expect(await readdir(output)).toEqual(["untracked.txt"]);
expect(await readFile(untracked, "utf8")).toBe("leave untouched");
await rm(untracked);
expect(await tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
expect(await readdir(parent)).toEqual([]);
});
describe("safe artifact output tree", () => {
it("removes only its owned tree after digest failure and proves absence", async () => {
const parent = await createTestTempDirectory("rea-safe-output-");
const output = join(parent, "published");
const tree = await SafeOutputTree.create(output);
await expect(
tree.write("nested/file.txt", Readable.from(Buffer.from("unexpected")), {
sha256: "0".repeat(64),
bytes: Buffer.byteLength("unexpected"),
}),
).rejects.toThrow(/disagrees/u);
expect(await tree.rollback()).toMatchObject({
status: "complete",
residualPaths: [],
});
await expect(access(output)).rejects.toMatchObject({ code: "ENOENT" });
expect(await readdir(parent)).toEqual([]);
});
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
"reports the owned residual root when rollback lacks directory permissions",
async () => {
const parent = await createTestTempDirectory("rea-safe-output-rollback-");
const output = join(parent, "published");
const tree = await SafeOutputTree.create(output);
const bytes = Buffer.from("retained until rollback can retry");
await tree.write("nested/file.txt", Readable.from(bytes), {
sha256: createHash("sha256").update(bytes).digest("hex"),
bytes: bytes.byteLength,
});
try {
await chmod(output, 0o500);
const failure = await tree.rollback().catch((cause: unknown) => cause);
expect(failure).toBeInstanceOf(ArtifactReaderFailure);
expect(failure).toMatchObject({
cause: { code: "EACCES" },
cleanup: { resources: [output] },
});
} finally {
await chmod(output, 0o700).catch(() => undefined);
await tree.rollback();
}
},
);
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
"retains cleanup progress when one owned sibling is not writable",
async () => {
const parent = await createTestTempDirectory("rea-safe-output-siblings-");
const output = join(parent, "published");
const completed = join(output, "completed");
const blocked = join(output, "blocked");
const tree = await SafeOutputTree.create(output);
for (const directory of ["completed", "blocked"]) {
const bytes = Buffer.from(join(output, directory));
await tree.write(`${directory}/file.txt`, Readable.from(bytes), {
sha256: createHash("sha256").update(bytes).digest("hex"),
bytes: bytes.byteLength,
});
}
try {
await chmod(blocked, 0o500);
const failure = await tree.rollback().catch((cause: unknown) => cause);
expect(failure).toBeInstanceOf(ArtifactReaderFailure);
expect(failure).toMatchObject({
cause: { code: "EACCES" },
cleanup: { resources: [output] },
});
expect(await readdir(output)).toEqual(["blocked"]);
await expect(access(completed)).rejects.toMatchObject({
code: "ENOENT",
});
expect(await readFile(join(blocked, "file.txt"), "utf8")).toBe(blocked);
await expect(
tree.write("new/file.txt", Readable.from(Buffer.from("late")), {
sha256: createHash("sha256").update("late").digest("hex"),
bytes: Buffer.byteLength("late"),
}),
).rejects.toBeInstanceOf(ArtifactReaderFailure);
await expect(tree.commit()).rejects.toBeInstanceOf(
ArtifactReaderFailure,
);
} finally {
await chmod(blocked, 0o700);
}
expect(await tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
expect(await readdir(parent)).toEqual([]);
},
);
it("returns detached cleanup reports", async () => {
const parent = await createTestTempDirectory("rea-safe-output-");
const tree = await SafeOutputTree.create(join(parent, "published"));
const cleanup = await tree.rollback();
if (cleanup.status !== "complete") throw new Error("expected cleanup");
(cleanup.residualPaths as unknown as string[]).push("/forged/path");
expect(tree.cleanup).toEqual({ status: "complete", residualPaths: [] });
expect(await tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
await expect(
tree.write("late.txt", Readable.from(Buffer.from("late")), {
sha256: createHash("sha256").update("late").digest("hex"),
bytes: Buffer.byteLength("late"),
}),
).rejects.toBeInstanceOf(ArtifactReaderFailure);
await expect(tree.commit()).rejects.toBeInstanceOf(ArtifactReaderFailure);
});
});
it.each([
{ path: "hello.txt:hidden", kind: "stream syntax" },
{ path: "nested/hello.txt::$DATA", kind: "stream syntax" },
{ path: "folder:stream/file.txt", kind: "stream syntax" },
{ path: "Folder/Icon\r", kind: "control character" },
{ path: "Fold\ter/file.txt", kind: "control character" },
{ path: "Report*.txt", kind: "reserved name character" },
{ path: "nested/Why?.txt", kind: "reserved name character" },
{ path: 'Quoted".txt', kind: "reserved name character" },
{ path: "Piped|.txt", kind: "reserved name character" },
{ path: "nested/Angled<name>.txt", kind: "reserved name character" },
{ path: "dir/name.", kind: "trailing dot or space" },
{ path: "dir/space ", kind: "trailing dot or space" },
{ path: "dotted./file.txt", kind: "trailing dot or space" },
{ path: "spaced /file.txt", kind: "trailing dot or space" },
])(
"refuses Windows $kind before materializing $path",
async ({ path, kind }) => {
const parent = await createTestTempDirectory("rea-safe-output-name-");
const output = join(parent, "published");
const tree = await SafeOutputTree.create(output, "win32");
const bytes = Buffer.from("regular file content");
const source = Readable.from(bytes);
const message =
kind === "stream syntax"
? `Windows destination cannot materialize artifact path as a regular file: ${path}; ':' denotes alternate data stream syntax.`
: kind === "control character"
? `Windows destination cannot materialize artifact path: ${JSON.stringify(path)}; Windows names cannot contain U+0001-U+001F.`
: kind === "reserved name character"
? `Destination filesystem cannot represent ${JSON.stringify(path)}.`
: `Destination filesystem cannot represent ${JSON.stringify(path)}. Windows paths drop a trailing dot or space from a name, so other programs would open a different file or none. Leave this path out of the selection, or write the output on a non-Windows host.`;
try {
const writing = tree.write(path, source, {
sha256: createHash("sha256").update(bytes).digest("hex"),
bytes: bytes.byteLength,
});
// `PublishWebScripts` falls back to an isolated path on this class, so the
// type is part of the contract and not only the message.
if (
kind === "reserved name character" ||
kind === "trailing dot or space"
)
await expect(writing).rejects.toBeInstanceOf(
DestinationPathUnrepresentableFailure,
);
await expect(writing).rejects.toMatchObject({ reason: "path", message });
expect(source.destroyed).toBe(true);
expect(await readdir(output)).toEqual([]);
} finally {
expect(await tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
}
expect(await readdir(parent)).toEqual([]);
},
);
it.each([
"My Report.txt",
"a.b.c",
"naïve.txt",
"CONIN$notes.txt",
// Device names stay accepted: Node creates them as ordinary files.
"drivers/aux.c",
"docs/CON",
".hidden",
])("materializes the Windows-representable name %j", async (path) => {
const parent = await createTestTempDirectory("rea-safe-output-portable-");
const tree = await SafeOutputTree.create(join(parent, "published"), "win32");
const bytes = Buffer.from("regular file content");
try {
await expect(
tree.write(path, Readable.from(bytes), {
sha256: createHash("sha256").update(bytes).digest("hex"),
bytes: bytes.byteLength,
}),
).resolves.toMatchObject({ relativePath: path });
} finally {
expect(await tree.rollback()).toEqual({
status: "complete",
residualPaths: [],
});
}
expect(await readdir(parent)).toEqual([]);
});