Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(gfs): derive compatibility limit messages from defaults
Josuéd4ff87288942
diff --git a/control-ui/lib/__tests__/gfsFileUpload.test.ts b/control-ui/lib/__tests__/gfsFileUpload.test.tsindex 57662c88d..294a2fe6d 100644--- a/control-ui/lib/__tests__/gfsFileUpload.test.ts+++ b/control-ui/lib/__tests__/gfsFileUpload.test.ts@@ -7,6 +7,7 @@ import {isAmbiguousUploadStatus,isRetryableUploadStatus,normalizeInstabilityFailureThreshold,+ normalizeUploadProductMaxBytes,parseRetryAfter,uploadGfsFileLegacy,} from '@lib/gfsFileUpload'@@ -270,9 +271,11 @@ describe('GfsUploadJob', () => {expect(createCalls).toBe(0)})- it('uses the 200 MiB compatibility limit when an enabled writer omits maxFileBytes', async () => {+ it('reports the default compatibility limit when an enabled writer omits maxFileBytes', async () => {const file = new File([new Uint8Array([1])], 'missing-limit.bin')- Object.defineProperty(file, 'size', { value: 200 * 1024 * 1024 + 1 })+ const compatibilityMaxFileBytes = normalizeUploadProductMaxBytes(undefined)+ const compatibilityLimit = `${compatibilityMaxFileBytes / (1024 * 1024)} MiB`+ Object.defineProperty(file, 'size', { value: compatibilityMaxFileBytes + 1 })let createCalls = 0vi.stubGlobal('fetch',@@ -293,7 +296,9 @@ describe('GfsUploadJob', () => {name: file.name,target: { operation: 'create', parentRid: 'parent-missing-limit' },}).start()- ).rejects.toThrow(/200 MiB compatibility limit/)+ ).rejects.toThrow(+ `GFS uploads use the ${compatibilityLimit} compatibility limit because the writer omitted maxFileBytes.`+ )expect(createCalls).toBe(0)})diff --git a/control-ui/lib/gfsFileUpload.ts b/control-ui/lib/gfsFileUpload.tsindex 9d636dc53..fcf1de5a0 100644--- a/control-ui/lib/gfsFileUpload.ts+++ b/control-ui/lib/gfsFileUpload.ts@@ -28,6 +28,13 @@ const GFS_UPLOAD_RETRY_BASE_DELAY_MS = 250const GFS_UPLOAD_V2_PART_TIMEOUT_MS = 300_000const GFS_UPLOAD_V2_RECONCILE_TIMEOUT_MS = 60_000const GFS_UPLOAD_V2_RECONCILE_ATTEMPTS = 3+const MEBIBYTE_BYTES = 1024 * 1024++function formatBinaryUploadLimit(byteLength: number): string {+ return byteLength % MEBIBYTE_BYTES === 0+ ? `${byteLength / MEBIBYTE_BYTES} MiB`+ : `${byteLength} bytes`+}export function isRetryableUploadStatus(status: number): boolean {return GFS_UPLOAD_RETRYABLE_STATUS.has(status)@@ -1183,7 +1190,7 @@ export class GfsUploadJob {if (this.input.file.size > productMaxFileBytes) {if (resumable.maxFileBytes === undefined) {throw new Error(- 'GFS uploads use the 200 MiB compatibility limit because the writer omitted maxFileBytes.'+ `GFS uploads use the ${formatBinaryUploadLimit(GFS_FILE_UPLOAD_DEFAULT_PRODUCT_MAX_BYTES)} compatibility limit because the writer omitted maxFileBytes.`)}throw new Error(`GFS writer limit is ${productMaxFileBytes} bytes for this upload.`)diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 875b41811..f82798ed4 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.442",+ "version": "0.1.443","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.442",+ "version": "0.1.443","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/llm-providers": "file:../packages/llm-providers",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 903f97ff5..930743b63 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.442",+ "version": "0.1.443","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/desktop-app/src/gfs/upload.test.ts b/desktop-app/src/gfs/upload.test.tsindex e1ffc2adb..0f2a41034 100644--- a/desktop-app/src/gfs/upload.test.ts+++ b/desktop-app/src/gfs/upload.test.ts@@ -8,6 +8,7 @@ import {isAmbiguousUploadStatus,isRetryableUploadStatus,normalizeInstabilityFailureThreshold,+ normalizeUploadProductMaxBytes,uploadLocalFile,} from './upload.js'@@ -124,12 +125,14 @@ describe('desktop GFS indexed uploader', () => {}})- it('uses the 200 MiB compatibility limit when an enabled writer omits maxFileBytes', async () => {+ it('reports the default compatibility limit when an enabled writer omits maxFileBytes', async () => {const root = await mkdtemp(join(tmpdir(), 'evenfire-gfs-upload-missing-limit-'))try {const filePath = join(root, 'payload.bin')+ const compatibilityMaxFileBytes = normalizeUploadProductMaxBytes(undefined)+ const compatibilityLimit = `${compatibilityMaxFileBytes / (1024 * 1024)} MiB`await writeFile(filePath, Buffer.alloc(0))- await truncate(filePath, 200 * 1024 * 1024 + 1)+ await truncate(filePath, compatibilityMaxFileBytes + 1)let createCalls = 0const transport = {async requestJson<T>(method: 'GET' | 'POST') {@@ -153,7 +156,9 @@ describe('desktop GFS indexed uploader', () => {parentRid: 'parent-missing-limit',transport,}).start()- ).rejects.toThrow(/200 MiB compatibility limit/)+ ).rejects.toThrow(+ `GFS files are limited to the ${compatibilityLimit} compatibility limit because the writer omitted maxFileBytes`+ )expect(createCalls).toBe(0)} finally {await rm(root, { recursive: true, force: true })diff --git a/desktop-app/src/gfs/upload.ts b/desktop-app/src/gfs/upload.tsindex ab152444b..46b638c7d 100644--- a/desktop-app/src/gfs/upload.ts+++ b/desktop-app/src/gfs/upload.ts@@ -26,6 +26,13 @@ export const GFS_UPLOAD_RETRY_MAX_ATTEMPTS = 3export const GFS_UPLOAD_SERVICE_RETRY_MAX_ATTEMPTS = 6export const GFS_UPLOAD_RETRY_AFTER_CAP_MS = 5_000const GFS_UPLOAD_RETRY_BASE_DELAY_MS = 250+const MEBIBYTE_BYTES = 1024 * 1024++function formatBinaryUploadLimit(byteLength: number): string {+ return byteLength % MEBIBYTE_BYTES === 0+ ? `${byteLength / MEBIBYTE_BYTES} MiB`+ : `${byteLength} bytes`+}export interface DesktopUploadSession {uploadId: string@@ -1391,7 +1398,7 @@ export class DesktopGfsUploadJob {if (file.size > productMaxFileBytes) {if (resumable.maxFileBytes === undefined) {throw new Error(- 'GFS files are limited to the 200 MiB compatibility limit because the writer omitted maxFileBytes'+ `GFS files are limited to the ${formatBinaryUploadLimit(GFS_UPLOAD_V2_DEFAULT_PRODUCT_MAX_BYTES)} compatibility limit because the writer omitted maxFileBytes`)}throw new Error(`GFS files are limited to ${productMaxFileBytes} bytes by the writer`)