Skip to content

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

TypeScript

fix(gfs): r3-l1 require canonical protocol upload limit

Josuée28aa2bbf940
diff --git a/gfs-controller/src/config.test.ts b/gfs-controller/src/config.test.ts
index e2adc119f..c56690702 100644
--- a/gfs-controller/src/config.test.ts
+++ b/gfs-controller/src/config.test.ts
@@ -171,6 +171,31 @@ describe('GFS_UPLOAD_V2 strict disabled contract', () => {
expect(() => loadConfig()).toThrow(/GFS_UPLOAD_PRODUCT_MAX_FILE_BYTES/)
})
+ it.each([
+ ['the configured minimum', 200 * 1024 * 1024],
+ ['a normal canonical value', 300 * 1024 * 1024],
+ ['the compiled maximum', 1024 * 1024 * 1024],
+ ] as const)('accepts %s as a canonical protocol maximum', (_label, bytes) => {
+ vi.stubEnv('GFS_DEV_MODE', 'true')
+ vi.stubEnv('GFS_UPLOAD_PROTOCOL_MAX_FILE_BYTES', String(bytes))
+ expect(loadConfig().uploadV2.protocolMaxFileBytes).toBe(bytes)
+ })
+
+ it.each([
+ '01073741824',
+ '+1073741824',
+ ' 1073741824',
+ '1073741824 ',
+ '1e9',
+ '1073741824.0',
+ '-1',
+ '9007199254740992',
+ ])('rejects non-canonical protocol maximum %s', raw => {
+ vi.stubEnv('GFS_DEV_MODE', 'true')
+ vi.stubEnv('GFS_UPLOAD_PROTOCOL_MAX_FILE_BYTES', raw)
+ expect(() => loadConfig()).toThrow(/GFS_UPLOAD_PROTOCOL_MAX_FILE_BYTES/)
+ })
+
it('accepts the plan-owned chunk and millisecond TTL names', () => {
vi.stubEnv('GFS_DEV_MODE', 'true')
vi.stubEnv('GFS_UPLOAD_PREFERRED_CHUNK_BYTES', '8388608')
diff --git a/gfs-controller/src/config.ts b/gfs-controller/src/config.ts
index 3d5e96e5c..668a06cae 100644
--- a/gfs-controller/src/config.ts
+++ b/gfs-controller/src/config.ts
@@ -245,6 +245,7 @@ function uploadConfig(): GfsUploadConfig {
GFS_UPLOAD_V2_DEFAULT_PRODUCT_MAX_BYTES,
GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES
)
+ requireCanonicalUploadInteger('GFS_UPLOAD_PROTOCOL_MAX_FILE_BYTES')
requireCanonicalUploadInteger('GFS_UPLOAD_PRODUCT_MAX_FILE_BYTES')
requireCanonicalUploadInteger('GFS_UPLOAD_MAX_FILE_BYTES')
const productMaxFileBytes = uploadIntegerWithAlias(