Skip to content

Commit 888f286

Browse files
committed
chore(uploads): trim verbose comments
Drop inline comments that restate code ("Use the full storageKey as fileName"), collapse a multi-line block comment into a tighter TSDoc on the existence check, and prune verbose vitest file headers — describe blocks already document what's tested.
1 parent 2aa4f2f commit 888f286

5 files changed

Lines changed: 7 additions & 21 deletions

File tree

apps/sim/app/api/files/multipart/route.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/**
2-
* Tests for the generic multipart upload route — focuses on parts shape
3-
* normalization across S3 and Azure Blob providers.
4-
*
52
* @vitest-environment node
63
*/
74
import { authMockFns, permissionsMock, permissionsMockFns } from '@sim/testing'

apps/sim/app/api/workspaces/[id]/files/presigned/route.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/**
2-
* Tests for workspace presigned upload API route.
3-
*
42
* @vitest-environment node
53
*/
64
import {

apps/sim/app/api/workspaces/[id]/files/register/route.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/**
2-
* Tests for workspace file register API route.
3-
*
42
* @vitest-environment node
53
*/
64
import {

apps/sim/lib/uploads/client/direct-upload.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
/**
2-
* Tests for the client-side direct-upload transport. Focuses on:
3-
* - Strategy selection at the LARGE_FILE_THRESHOLD boundary.
4-
* - Parts shape `{ partNumber, etag? }` sent to /complete.
5-
* - FALLBACK_REQUIRED propagation when the server reports no cloud storage.
6-
*
72
* @vitest-environment jsdom
83
*/
94
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

apps/sim/lib/uploads/contexts/workspace/workspace-file-manager.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ export async function uploadWorkspaceFile(
175175

176176
const uploadResult = await uploadFile({
177177
file: fileBuffer,
178-
fileName: storageKey, // Use the full storageKey as fileName
178+
fileName: storageKey,
179179
contentType,
180180
context: 'workspace',
181-
preserveKey: true, // Don't add timestamp prefix
182-
customKey: storageKey, // Explicitly set the key
183-
metadata, // Pass metadata for cloud storage consistency
181+
preserveKey: true,
182+
customKey: storageKey,
183+
metadata,
184184
})
185185

186186
logger.info(`Upload returned key: ${uploadResult.key}`)
@@ -240,7 +240,7 @@ export async function uploadWorkspaceFile(
240240
name: uniqueName,
241241
size: fileBuffer.length,
242242
type: contentType,
243-
url: serveUrl, // Use authenticated serve URL (enforces context)
243+
url: serveUrl,
244244
key: uploadResult.key,
245245
context: 'workspace',
246246
}
@@ -323,10 +323,8 @@ export async function registerUploadedWorkspaceFile(params: {
323323
}
324324

325325
/**
326-
* Existence check runs before the quota guard so a retry after a
327-
* successful-but-network-dropped register does not (a) fail quota because
328-
* the bytes are now counted, or (b) invoke cleanupOrphan on an already
329-
* registered object.
326+
* Existence check precedes the quota guard so a network-dropped retry doesn't
327+
* double-charge quota or orphan-cleanup an already-registered object.
330328
*/
331329
const existing = await getFileMetadataByKey(key, 'workspace')
332330

0 commit comments

Comments
 (0)