Release 2.6.2-rc1

This commit is contained in:
2026-10-05 19:35:58 +00:00 Unverified
parent 269675c562
commit 198b7866ef
14 changed files with 699 additions and 113 deletions
+91
View File
@@ -26,6 +26,59 @@ function digest(data: Uint8Array | string): Sha256Digest {
}
describe("source materialization", () => {
test("collects aggregate CAS and filesystem timing with manifest counts", async () => {
const root = await mkdtemp(join(tmpdir(), "kuber-materialize-"));
roots.push(root);
const data = Buffer.from("hello");
const manifest: WorkspaceManifest = {
version: BUILD_PROTOCOL_VERSION,
files: [
{
path: "example",
type: "file",
digest: digest(data),
size: data.byteLength,
mode: 0o644,
},
],
};
const manifestData = Buffer.from(JSON.stringify(manifest));
const workspace = digest(manifestData);
let release!: () => void;
let entered!: () => void;
const blocked = new Promise<void>((resolve) => {
release = resolve;
});
const started = new Promise<void>((resolve) => {
entered = resolve;
});
const timing = { casReadMs: 0, fsWriteMs: 0 };
const submission = materializeWorkspace(
{
get: async (requested) => {
if (requested === workspace) return manifestData;
entered();
await blocked;
return data;
},
},
workspace,
join(root, "workspace"),
timing,
);
await started;
await Bun.sleep(25);
release();
await submission;
expect(timing).toMatchObject({
fileCount: 1,
manifestBytes: manifestData.byteLength,
fileBytes: data.byteLength,
});
expect(timing.casReadMs).toBeGreaterThan(15);
expect(timing.fsWriteMs).toBeGreaterThan(0);
});
test("bounds concurrent CAS reads while materializing many files", async () => {
const root = await mkdtemp(join(tmpdir(), "kuber-materialize-"));
roots.push(root);
@@ -151,6 +204,28 @@ describe("source materialization", () => {
),
),
).toThrow("conflicts");
for (const [files, conflict] of [
[["a/b/c", "a"], "Workspace path conflicts with a directory: a"],
[["a/b/c", "a/b"], "Workspace path conflicts with a directory: a/b"],
[["a", "a/b/c"], "Workspace path conflicts with a file: a/b/c"],
] as const) {
expect(() =>
parseWorkspaceManifest(
Buffer.from(
JSON.stringify({
version: BUILD_PROTOCOL_VERSION,
files: files.map((path) => ({
path,
type: "file",
digest: `sha256:${"a".repeat(64)}`,
size: 0,
mode: 0o644,
})),
}),
),
),
).toThrow(conflict);
}
const root = await mkdtemp(join(tmpdir(), "kuber-materialize-"));
roots.push(root);
@@ -178,4 +253,20 @@ describe("source materialization", () => {
).rejects.toThrow("Unsafe symlink");
await expect(lstat(destination)).rejects.toMatchObject({ code: "ENOENT" });
});
test("accepts a large manifest with distinct nested paths", () => {
const manifest: WorkspaceManifest = {
version: BUILD_PROTOCOL_VERSION,
files: Array.from({ length: 3_000 }, (_, index) => ({
path: `dir-${index}/nested/file`,
type: "file" as const,
digest: `sha256:${"a".repeat(64)}` as Sha256Digest,
size: 0,
mode: 0o644 as const,
})),
};
expect(
parseWorkspaceManifest(Buffer.from(JSON.stringify(manifest))),
).toEqual(manifest);
});
});