@blaxel/core 0.2.84-preview.155 → 0.2.85-preview.159

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,8 +5,8 @@ import { authentication } from "../authentication/index.js";
5
5
  import { env } from "../common/env.js";
6
6
  import { fs, os, path } from "../common/node.js";
7
7
  // Build info - these placeholders are replaced at build time by build:replace-imports
8
- const BUILD_VERSION = "0.2.84-preview.155";
9
- const BUILD_COMMIT = "b37c7bd0ef1257de732b54a2f784c6c91a8d450d";
8
+ const BUILD_VERSION = "0.2.85-preview.159";
9
+ const BUILD_COMMIT = "a9c088b49239125f1b129fbc95d1887556112a33";
10
10
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
11
11
  const BLAXEL_API_VERSION = "2026-04-16";
12
12
  // Cache for config.yaml tracking value
@@ -5,7 +5,7 @@ import { deleteFilesystemByPath, deleteFilesystemMultipartByUploadIdAbort, getFi
5
5
  // Multipart upload constants
6
6
  const MULTIPART_THRESHOLD = 5 * 1024 * 1024; // 5MB
7
7
  const CHUNK_SIZE = 5 * 1024 * 1024; // 5MB per part
8
- const MAX_PARALLEL_UPLOADS = 20; // Number of parallel part uploads
8
+ const MAX_PARALLEL_UPLOADS = 3; // Number of parallel part uploads
9
9
  export class SandboxFileSystem extends SandboxAction {
10
10
  process;
11
11
  constructor(sandbox, process) {
@@ -0,0 +1,31 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { SandboxFileSystem } from "./filesystem.js";
3
+ const waitForPartUpload = () => new Promise((resolve) => setTimeout(resolve, 5));
4
+ describe("SandboxFileSystem multipart upload", () => {
5
+ it("limits concurrent part uploads", async () => {
6
+ const filesystem = Object.create(SandboxFileSystem.prototype);
7
+ let inFlight = 0;
8
+ let maxInFlight = 0;
9
+ const uploadedParts = [];
10
+ let completedParts = [];
11
+ filesystem.initiateMultipartUpload = () => Promise.resolve({ uploadId: "upload-1" });
12
+ filesystem.uploadPart = async (_uploadId, partNumber) => {
13
+ inFlight += 1;
14
+ maxInFlight = Math.max(maxInFlight, inFlight);
15
+ await waitForPartUpload();
16
+ uploadedParts.push(partNumber);
17
+ inFlight -= 1;
18
+ return { partNumber, etag: `etag-${partNumber}` };
19
+ };
20
+ filesystem.completeMultipartUpload = (_uploadId, parts) => {
21
+ completedParts = parts;
22
+ return Promise.resolve({ message: "ok" });
23
+ };
24
+ filesystem.abortMultipartUpload = () => Promise.resolve({ message: "aborted" });
25
+ const blob = new Blob([new Uint8Array(16 * 1024 * 1024)]);
26
+ await filesystem.uploadWithMultipart("/tmp/large-file.bin", blob);
27
+ expect(maxInFlight).toBeLessThanOrEqual(3);
28
+ expect(uploadedParts.sort((a, b) => a - b)).toEqual([1, 2, 3, 4]);
29
+ expect(completedParts.map((part) => part.partNumber)).toEqual([1, 2, 3, 4]);
30
+ });
31
+ });