Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(control-ui): clarify Upload v2 writer limits

Josuéc926d17aa5fc
diff --git a/control-ui/components/GfsBrowser.tsx b/control-ui/components/GfsBrowser.tsx
index 75838c0c0..f92b69f33 100644
--- a/control-ui/components/GfsBrowser.tsx
+++ b/control-ui/components/GfsBrowser.tsx
@@ -1145,7 +1145,7 @@ export function GfsBrowser(): React.JSX.Element {
fileSummary={
uploadCandidate ? `${formatBytes(uploadCandidate.size)} selected` : undefined
}
- guidance="The writer advertises the Upload v2 file limit (up to the 1 GiB protocol maximum); each request is streamed in 8 MiB parts (16 MiB hard maximum)."
+ guidance="Before upload starts, the 1 GiB Upload v2 protocol ceiling is the local safety bound. When upload begins, the writer resolves and enforces the actual product file limit. Each request is streamed in 8 MiB parts (16 MiB hard maximum)."
progress={
uploadSnapshot
? {
diff --git a/control-ui/components/__tests__/GfsBrowser.test.tsx b/control-ui/components/__tests__/GfsBrowser.test.tsx
index f345c8f4f..246ebd211 100644
--- a/control-ui/components/__tests__/GfsBrowser.test.tsx
+++ b/control-ui/components/__tests__/GfsBrowser.test.tsx
@@ -256,7 +256,10 @@ describe('GfsBrowser', () => {
fireEvent.click(newFile)
const uploadDialog = await screen.findByRole('dialog', { name: 'Upload file' })
expect(
- within(uploadDialog).getByText(/writer advertises the Upload v2 file limit/i)
+ within(uploadDialog).getByText(/1 GiB Upload v2 protocol ceiling is the local safety bound/i)
+ ).toBeTruthy()
+ expect(
+ within(uploadDialog).getByText(/writer resolves and enforces the actual product file limit/i)
).toBeTruthy()
expect(within(uploadDialog).getByText(/drag and drop, or click to browse/i)).toBeTruthy()
fireEvent.click(within(uploadDialog).getByRole('button', { name: 'Cancel' }))
diff --git a/control-ui/e2e/gfs-upload-v2.spec.ts b/control-ui/e2e/gfs-upload-v2.spec.ts
index 0b8c72b46..569caa16b 100644
--- a/control-ui/e2e/gfs-upload-v2.spec.ts
+++ b/control-ui/e2e/gfs-upload-v2.spec.ts
@@ -9,6 +9,7 @@ import {
uniqueGfsFixtureName,
} from '../../tests/e2e/gfsUiFixtures'
import {
+ E2E_GFS_UPLOAD_V2_DEFAULT_PRODUCT_MAX_BYTES,
GFS_UPLOAD_V2_BOUNDARIES,
createDiskUploadFixture,
createOversizedDiskUploadFixture,
@@ -425,7 +426,9 @@ test.describe('GFS Upload v2 — Control UI runtime product policy', () => {
await dialog.getByLabel('Choose file to upload').setInputFiles(rejectedSource.filePath)
await dialog.getByRole('button', { name: 'Upload', exact: true }).click()
await expect(
- page.getByRole('status').filter({ hasText: `GFS writer limit is ${lowerMax} bytes` })
+ page
+ .getByRole('status')
+ .filter({ hasText: `GFS writer permits files up to ${lowerMax / (1024 * 1024)} MiB` })
).toBeVisible({ timeout: 30_000 })
expect(
await getGfsChildResourceSummary({
@@ -458,7 +461,9 @@ test.describe('GFS Upload v2 — approved negative Control UI journeys', () => {
)
test.setTimeout(45 * 60_000)
- test('rejects a 209715201-byte file through the visible upload modal', async ({ page }) => {
+ test('rejects a file one byte above the compatibility default through the visible upload modal', async ({
+ page,
+ }) => {
const fixtureName = uniqueGfsFixtureName('e2e-gfs-v2-negative-oversize-ui')
let cleanupFixture: ReturnType<typeof seedGfsDirectoryFixture> | undefined
let cleanupSource: Awaited<ReturnType<typeof createOversizedDiskUploadFixture>> | undefined
@@ -473,7 +478,9 @@ test.describe('GFS Upload v2 — approved negative Control UI journeys', () => {
await dialog.getByLabel('Choose file to upload').setInputFiles(source.filePath)
await dialog.getByRole('button', { name: 'Upload', exact: true }).click()
await expect(
- page.getByRole('status').filter({ hasText: 'GFS writer limit is 209715200 bytes' })
+ page.getByRole('status').filter({
+ hasText: `GFS writer permits files up to ${E2E_GFS_UPLOAD_V2_DEFAULT_PRODUCT_MAX_BYTES / (1024 * 1024)} MiB`,
+ })
).toBeVisible({ timeout: 15_000 })
await expect
.poll(
diff --git a/control-ui/lib/__tests__/gfsFileUpload.test.ts b/control-ui/lib/__tests__/gfsFileUpload.test.ts
index 619c8bc5c..cf64ce515 100644
--- a/control-ui/lib/__tests__/gfsFileUpload.test.ts
+++ b/control-ui/lib/__tests__/gfsFileUpload.test.ts
@@ -5,6 +5,7 @@ import {
type GfsUploadStatus,
allowsLegacyCapabilityFallback,
assertGfsFileUploadSize,
+ formatGfsUploadLimit,
isAmbiguousUploadStatus,
isRetryableUploadStatus,
normalizeInstabilityFailureThreshold,
@@ -27,6 +28,15 @@ describe('assertGfsFileUploadSize', () => {
})
})
+describe('formatGfsUploadLimit', () => {
+ it('uses binary units for exact MiB boundaries without changing byte-accurate values', () => {
+ expect(formatGfsUploadLimit(300 * 1024 * 1024)).toBe('300 MiB')
+ expect(formatGfsUploadLimit(16 * 1024 * 1024)).toBe('16 MiB')
+ expect(formatGfsUploadLimit(1)).toBe('1 byte')
+ expect(formatGfsUploadLimit(1024 * 1024 * 1024)).toBe('1 GiB')
+ })
+})
+
describe('Upload v2 capability fallback classification', () => {
it.each([
['network failure', new TypeError('fetch failed'), true],
@@ -85,7 +95,7 @@ describe('uploadGfsFileLegacy', () => {
name: file.name,
target: { operation: 'create', parentRid: 'parent-legacy-limit' },
})
- ).rejects.toThrow(`legacy GFS is limited to ${GFS_LEGACY_UPLOAD_MAX_BYTES} bytes`)
+ ).rejects.toThrow('legacy GFS is limited to 16 MiB')
expect(arrayBuffer).not.toHaveBeenCalled()
expect(fetchMock).not.toHaveBeenCalled()
})
@@ -244,7 +254,7 @@ describe('GfsUploadJob', () => {
name: file.name,
target: { operation: 'create', parentRid: 'parent-ceiling' },
}).start()
- ).rejects.toThrow('writer limit is 1 bytes')
+ ).rejects.toThrow('writer permits files up to 1 byte')
expect(createCalls).toBe(0)
})
@@ -312,7 +322,7 @@ describe('GfsUploadJob', () => {
name: file.name,
target: { operation: 'create', parentRid: 'parent-runtime-lower' },
}).start()
- ).rejects.toThrow(`GFS writer limit is ${100 * 1024 * 1024} bytes`)
+ ).rejects.toThrow('GFS writer permits files up to 100 MiB')
expect(createCalls).toBe(0)
})
@@ -391,7 +401,7 @@ describe('GfsUploadJob', () => {
}).start()
).rejects.toThrow()
expect(compatibilityWarning).toHaveBeenCalledWith(
- 'GFS Upload v2 writer omitted maxFileBytes; using the 209715200-byte compatibility limit.'
+ 'GFS Upload v2 writer omitted maxFileBytes; using the 200 MiB compatibility limit.'
)
expect(createCalls).toBe(1)
expect(file.size).toBeLessThanOrEqual(compatibilityMaxFileBytes)
diff --git a/control-ui/lib/gfsFileUpload.ts b/control-ui/lib/gfsFileUpload.ts
index d25eb5295..647011428 100644
--- a/control-ui/lib/gfsFileUpload.ts
+++ b/control-ui/lib/gfsFileUpload.ts
@@ -29,11 +29,16 @@ const GFS_UPLOAD_V2_PART_TIMEOUT_MS = 300_000
const GFS_UPLOAD_V2_RECONCILE_TIMEOUT_MS = 60_000
const GFS_UPLOAD_V2_RECONCILE_ATTEMPTS = 3
const MEBIBYTE_BYTES = 1024 * 1024
+const GIBIBYTE_BYTES = 1024 * MEBIBYTE_BYTES
-function formatBinaryUploadLimit(byteLength: number): string {
- return byteLength % MEBIBYTE_BYTES === 0
- ? `${byteLength / MEBIBYTE_BYTES} MiB`
- : `${byteLength} bytes`
+/**
+ * Presentation only: GFSC remains the authority for the Upload v2 product policy.
+ */
+export function formatGfsUploadLimit(byteLength: number): string {
+ if (byteLength === 1) return '1 byte'
+ if (byteLength % GIBIBYTE_BYTES === 0) return `${byteLength / GIBIBYTE_BYTES} GiB`
+ if (byteLength % MEBIBYTE_BYTES === 0) return `${byteLength / MEBIBYTE_BYTES} MiB`
+ return `${byteLength} bytes`
}
export function isRetryableUploadStatus(status: number): boolean {
@@ -1203,7 +1208,7 @@ export class GfsUploadJob {
const productMaxFileBytes = normalizeUploadProductMaxBytes(resumable.maxFileBytes)
if (resumable.maxFileBytes === undefined) {
console.warn(
- `GFS Upload v2 writer omitted maxFileBytes; using the ${GFS_FILE_UPLOAD_DEFAULT_PRODUCT_MAX_BYTES}-byte compatibility limit.`
+ `GFS Upload v2 writer omitted maxFileBytes; using the ${formatGfsUploadLimit(GFS_FILE_UPLOAD_DEFAULT_PRODUCT_MAX_BYTES)} compatibility limit.`
)
}
const resumeId = this.session?.uploadId ?? this.input.resumeUploadId
@@ -1223,10 +1228,12 @@ export class GfsUploadJob {
if (this.input.file.size > productMaxFileBytes) {
if (resumable.maxFileBytes === undefined) {
throw new Error(
- `GFS uploads use the ${formatBinaryUploadLimit(GFS_FILE_UPLOAD_DEFAULT_PRODUCT_MAX_BYTES)} compatibility limit because the writer omitted maxFileBytes.`
+ `GFS uploads use the ${formatGfsUploadLimit(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.`)
+ throw new Error(
+ `GFS writer permits files up to ${formatGfsUploadLimit(productMaxFileBytes)} for this upload.`
+ )
}
const createBody = {
operation: this.input.target.operation,
@@ -1507,7 +1514,7 @@ export async function uploadGfsFileLegacy(input: {
}): Promise<unknown> {
if (input.file.size > GFS_LEGACY_UPLOAD_MAX_BYTES) {
throw new Error(
- `This writer does not advertise resumable uploads; legacy GFS is limited to ${GFS_LEGACY_UPLOAD_MAX_BYTES} bytes.`
+ `This writer does not advertise resumable uploads; legacy GFS is limited to ${formatGfsUploadLimit(GFS_LEGACY_UPLOAD_MAX_BYTES)}.`
)
}
const contentBase64 = digestBase64(await input.file.arrayBuffer())
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 5037093b5..4ac83d4a1 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.449",
+ "version": "0.1.450",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.449",
+ "version": "0.1.450",
"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.json
index 40c5592f7..5fef329e3 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.449",
+ "version": "0.1.450",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",