Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(gfs): r1-m2 prove protocol ceiling at validator
Josué688c00e7dff6
diff --git a/gfs-controller/src/upload/protocol.test.ts b/gfs-controller/src/upload/protocol.test.tsindex d3fd2fbce..fe515c0a7 100644--- a/gfs-controller/src/upload/protocol.test.ts+++ b/gfs-controller/src/upload/protocol.test.ts@@ -1,12 +1,13 @@import { describe, expect, it } from 'vitest'import {GFS_UPLOAD_V2_DEFAULT_CONCURRENCY,+ GFS_UPLOAD_V2_DEFAULT_PRODUCT_MAX_BYTES,GFS_UPLOAD_V2_FALLBACK_CONCURRENCY,GFS_UPLOAD_V2_INSTABILITY_FAILURE_THRESHOLD,GFS_UPLOAD_V2_MAX_PART_BYTES,GFS_UPLOAD_V2_PREFERRED_PART_BYTES,- GFS_UPLOAD_V2_DEFAULT_PRODUCT_MAX_BYTES,GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES,+ GfsUploadGeometryError,disabledGfsUploadV2Capability,isGfsUploadV2Route,partCountFor,@@ -51,6 +52,27 @@ describe('GFS Upload v2 frozen contract', () => {expect(() => partGeometry(geometry, 25)).toThrow('invalid part number')})+ it('enforces the hard whole-file protocol ceiling in the geometry validator', () => {+ expect(() =>+ validateGeometry({+ expectedBytes: GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES,+ partBytes: GFS_UPLOAD_V2_MAX_PART_BYTES,+ })+ ).not.toThrow()++ expect(() =>+ validateGeometry({+ expectedBytes: GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES + 1,+ partBytes: GFS_UPLOAD_V2_MAX_PART_BYTES,+ })+ ).toThrowError(+ expect.objectContaining({+ name: 'GfsUploadGeometryError',+ code: 'invalid_expected_bytes',+ }) as GfsUploadGeometryError+ )+ })+it('accepts a short final part and rejects mismatched offset or length', () => {const geometry = { expectedBytes: 8_388_609, partBytes: 8_388_608 }const finalPart = partGeometry(geometry, 1)diff --git a/gfs-controller/src/upload/uploadSession.test.ts b/gfs-controller/src/upload/uploadSession.test.tsindex 50d295d2d..346ef3b9e 100644--- a/gfs-controller/src/upload/uploadSession.test.ts+++ b/gfs-controller/src/upload/uploadSession.test.ts@@ -653,7 +653,7 @@ describe('GfsUploadSessionService', () => {})- it('enforces the 1 GiB protocol ceiling independently of product-policy admission', async () => {+ it('admits exactly 1 GiB when product policy permits the protocol boundary', async () => {tempRoot = await mkdtemp(join(tmpdir(), 'gfsc-upload-protocol-boundary-'))const config = { ...CONFIG, productMaxFileBytes: GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES }const input = {@@ -671,19 +671,6 @@ describe('GfsUploadSessionService', () => {})expect(exact.session.expectedBytes).toBe(GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES)expect(exactDb.sessions).toHaveLength(1)-- const overDb = new MemoryDb()- await expect(- service(overDb, config).create({- ...input,- sizeBytes: GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES + 1,- idempotencyKey: '21111111-1111-4111-8111-111111111116',- })- ).rejects.toMatchObject({- code: 'payload_too_large',- message: `sizeBytes must be between 0 and ${GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES}`,- })- expect(overDb.sessions).toHaveLength(0)})it('keeps zero-byte uploads valid with a positive configured product limit', async () => {