Skip to content

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

TypeScript

test(gfs): prove runtime upload product-limit contracts

Josuéfd52752a91ff
diff --git a/control-ui/e2e/gfs-upload-v2.spec.ts b/control-ui/e2e/gfs-upload-v2.spec.ts
index 663cda3c1..ff3d9ad70 100644
--- a/control-ui/e2e/gfs-upload-v2.spec.ts
+++ b/control-ui/e2e/gfs-upload-v2.spec.ts
@@ -15,8 +15,10 @@ import {
removeDiskUploadFixture,
} from '../../tests/e2e/gfsUploadV2Fixtures'
import {
+ readGfsUploadProductMaxBytes,
readGfsUploadV2Enabled,
restartGfsWriter,
+ setGfsUploadProductMaxBytes,
setGfsUploadV2Enabled,
} from '../../tests/e2e/gfsUploadV2Runtime'
import { loginControlUi, openGlobalFileSystemFromSidebar } from './support/gfs-control-ui-session'
@@ -110,6 +112,11 @@ function isSuccessfulResponse(response: import('@playwright/test').Response): bo
return response.status() >= 200 && response.status() < 300
}
+function formattedControlUiBytes(byteLength: number): string {
+ const mebibytes = byteLength / (1024 * 1024)
+ return `${mebibytes >= 10 ? mebibytes.toFixed(0) : mebibytes.toFixed(1)} MB`
+}
+
function uploadIdFromEnvelope(body: unknown): string {
if (!body || typeof body !== 'object' || Array.isArray(body))
throw new Error('upload response is not an object')
@@ -168,7 +175,7 @@ async function exerciseCreate(
const row = current.getByRole('listitem').filter({ hasText: source.fileName })
await expect(row).toBeVisible({ timeout: 60_000 })
- await expect(row).toContainText('200 MB')
+ await expect(row).toContainText(formattedControlUiBytes(byteLength))
await expect
.poll(
() =>
@@ -250,7 +257,7 @@ async function exerciseReplace(
version: (before?.version ?? 0) + 1,
deleted: false,
})
- await expect(row).toContainText('200 MB')
+ await expect(row).toContainText(formattedControlUiBytes(byteLength))
const downloadPromise = page.waitForEvent('download')
await row.getByRole('button', { name: `Download ${fixture.fileName}` }).click()
const downloaded = await hashDownload(await downloadPromise)
@@ -367,6 +374,58 @@ test.describe('GFS Upload v2 — Control UI large-upload project', () => {
})
})
+test.describe('GFS Upload v2 — Control UI runtime product policy', () => {
+ test.skip(
+ process.env.GFS_UPLOAD_V2_RUNTIME_LIMIT_E2E !== '1',
+ 'Set GFS_UPLOAD_V2_RUNTIME_LIMIT_E2E=1 only on an owned non-production dev host.'
+ )
+ test.setTimeout(75 * 60_000)
+
+ test('uses 100 MiB then 300 MiB without rebuilding the deployed UI bundle', async ({ page }) => {
+ const previous = await readGfsUploadProductMaxBytes()
+ const lowerMax = 100 * 1024 * 1024
+ const raisedMax = 300 * 1024 * 1024
+ const rejectedFixtureName = uniqueGfsFixtureName('e2e-gfs-v2-runtime-cap-ui')
+ const rejectedFixture = seedGfsDirectoryFixture(rejectedFixtureName)
+ const rejectedSource = await createOversizedDiskUploadFixture(
+ '.parquet',
+ rejectedFixtureName,
+ lowerMax
+ )
+ try {
+ await setGfsUploadProductMaxBytes(lowerMax)
+ await exerciseCreate(page, lowerMax)
+
+ await openWritableFolder(page, rejectedFixture.name)
+ await page.getByRole('button', { name: 'Upload file', exact: true }).click()
+ const dialog = page.getByRole('dialog', { name: 'Upload file' })
+ 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` })
+ ).toBeVisible({ timeout: 30_000 })
+ expect(
+ await getGfsChildResourceSummary({
+ parentResourceId: rejectedFixture.resourceId,
+ name: rejectedSource.fileName,
+ })
+ ).toBeNull()
+
+ await page.reload()
+ await setGfsUploadProductMaxBytes(raisedMax)
+ await exerciseCreate(page, 250 * 1024 * 1024)
+ } finally {
+ try {
+ await setGfsUploadProductMaxBytes(previous)
+ } finally {
+ await removeDiskUploadFixture(rejectedSource)
+ cleanupGfsFixture(rejectedFixtureName)
+ assertGfsFixtureCleaned(rejectedFixtureName)
+ }
+ }
+ })
+})
+
test.describe('GFS Upload v2 — approved negative Control UI journeys', () => {
test.skip(
process.env.GFS_UPLOAD_V2_NEGATIVE_E2E !== '1',
@@ -385,7 +444,7 @@ 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 uploads are limited to 200 MB per file.' })
+ page.getByRole('status').filter({ hasText: 'GFS writer limit is 209715200 bytes' })
).toBeVisible({ timeout: 15_000 })
await expect
.poll(
diff --git a/control-ui/lib/__tests__/gfsUploadV2RuntimeMarker.test.ts b/control-ui/lib/__tests__/gfsUploadV2RuntimeMarker.test.ts
index 05783ff10..7c0b7dd93 100644
--- a/control-ui/lib/__tests__/gfsUploadV2RuntimeMarker.test.ts
+++ b/control-ui/lib/__tests__/gfsUploadV2RuntimeMarker.test.ts
@@ -1,5 +1,9 @@
import { describe, expect, it } from 'vitest'
-import { validateGfsRuntimeImageMarker } from '../../../tests/e2e/gfsUploadV2Runtime'
+import {
+ GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES,
+ validateGfsRuntimeImageMarker,
+ validateGfsUploadProductMaxBytes,
+} from '../../../tests/e2e/gfsUploadV2Runtime'
const base = {
clusterFingerprint: 'cluster-a',
@@ -46,3 +50,31 @@ describe('GFS Upload v2 runtime image marker contract', () => {
).toThrow(/imagesGeneratedAt/)
})
})
+
+describe('GFS Upload v2 runtime product maximum contract', () => {
+ it.each([1, 100 * 1024 * 1024, 200 * 1024 * 1024, 300 * 1024 * 1024])(
+ 'accepts a bounded integer product maximum of %i bytes',
+ value => {
+ expect(validateGfsUploadProductMaxBytes(value)).toBe(value)
+ }
+ )
+
+ it('accepts the exact protocol maximum', () => {
+ expect(validateGfsUploadProductMaxBytes(GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES)).toBe(
+ GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES
+ )
+ })
+
+ it.each([
+ 0,
+ -1,
+ 1.5,
+ GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES + 1,
+ Number.MAX_SAFE_INTEGER + 1,
+ '209715200',
+ null,
+ undefined,
+ ])('rejects invalid product maximum %p before mutating a runtime', value => {
+ expect(() => validateGfsUploadProductMaxBytes(value)).toThrow(/invalid GFS Upload v2/)
+ })
+})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index d3c00d762..186b759a2 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.434",
+ "version": "0.1.435",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.434",
+ "version": "0.1.435",
"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 e66af8377..414f82f1d 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.434",
+ "version": "0.1.435",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/desktop-app/test/e2e-playwright/gfs-upload-v2.test.ts b/desktop-app/test/e2e-playwright/gfs-upload-v2.test.ts
index 09970a082..486f4354b 100644
--- a/desktop-app/test/e2e-playwright/gfs-upload-v2.test.ts
+++ b/desktop-app/test/e2e-playwright/gfs-upload-v2.test.ts
@@ -19,9 +19,11 @@ import {
} from '../../../tests/e2e/gfsUploadV2Fixtures'
import {
countGfsCreateSessions,
+ readGfsUploadProductMaxBytes,
readGfsUploadV2Enabled,
restartGfsWriter,
revokeGfsUserWriteGrant,
+ setGfsUploadProductMaxBytes,
setGfsUploadV2Enabled,
} from '../../../tests/e2e/gfsUploadV2Runtime'
import { test } from './fixtures'
@@ -314,7 +316,8 @@ async function exerciseCreate(page: Page, byteLength: number): Promise<void> {
await page.getByRole('button', { name: 'Close manage dialog' }).click()
const resource = fileResourceControls(browser, source.fileName)
await expect(resource.name).toBeVisible({ timeout: 60_000 })
- await expect(browser.getByText(/^200\.0 MB · v\d+$/)).toBeVisible()
+ const displayedMebibytes = (byteLength / (1024 * 1024)).toFixed(1)
+ await expect(browser.getByText(new RegExp(`^${displayedMebibytes} MB · v\\d+$`))).toBeVisible()
await expect
.poll(
() =>
@@ -388,7 +391,8 @@ async function exerciseReplace(page: Page, byteLength: number): Promise<void> {
deleted: false,
})
await expect(resource.name).toBeVisible({ timeout: 60_000 })
- await expect(browser.getByText(/^200\.0 MB · v\d+$/)).toBeVisible()
+ const displayedMebibytes = (byteLength / (1024 * 1024)).toFixed(1)
+ await expect(browser.getByText(new RegExp(`^${displayedMebibytes} MB · v\\d+$`))).toBeVisible()
await expectGfsDownload(page, resource.download, fixture.fileName, {
bytes: byteLength,
sha256: source.sha256,
@@ -422,6 +426,63 @@ test.describe('GFS Upload v2 — packaged Desktop project', () => {
}
})
+test.describe('GFS Upload v2 — packaged Desktop runtime product policy', () => {
+ test.skip(
+ process.env.GFS_UPLOAD_V2_RUNTIME_LIMIT_E2E !== '1',
+ 'Set GFS_UPLOAD_V2_RUNTIME_LIMIT_E2E=1 only on an owned non-production dev host.'
+ )
+ test.setTimeout(75 * 60_000)
+
+ test('uses 100 MiB then 300 MiB without rebuilding the packaged Desktop', async ({ appPage }) => {
+ const previous = await readGfsUploadProductMaxBytes()
+ const lowerMax = 100 * 1024 * 1024
+ const raisedMax = 300 * 1024 * 1024
+ const fixtureName = uniqueGfsFixtureName('e2e-gfs-v2-runtime-cap-desktop')
+ const fixture = seedGfsDirectoryFixture(fixtureName)
+ await seedGfsGrant({
+ resourceId: fixture.resourceId,
+ subjectType: 'user',
+ subjectId: getE2EUserId(),
+ permissions: ['read', 'write', 'delete'],
+ inherit: true,
+ grantedBy: 'e2e:gfs-upload-v2-runtime-cap',
+ })
+ const rejectedSource = await createOversizedDiskUploadFixture('.parquet', fixtureName, lowerMax)
+ try {
+ await setGfsUploadProductMaxBytes(lowerMax)
+ await exerciseCreate(appPage, lowerMax)
+
+ const { browser, manageDialog } = await openFolder(appPage, fixture.name)
+ await selectFileThroughVisibleAction(
+ appPage,
+ manageDialog.getByRole('button').filter({ hasText: /^Upload file$/ }),
+ rejectedSource.filePath
+ )
+ await expect(
+ appPage.getByRole('alert').filter({ hasText: `GFS writer limit is ${lowerMax} bytes` })
+ ).toBeVisible({ timeout: 30_000 })
+ expect(
+ countGfsCreateSessions(fixture.resourceId, rejectedSource.fileName, getE2EUserId())
+ ).toBe(0)
+ await expect(
+ browser.getByRole('button', { name: rejectedSource.fileName, exact: true })
+ ).toHaveCount(0)
+
+ await appPage.reload()
+ await setGfsUploadProductMaxBytes(raisedMax)
+ await exerciseCreate(appPage, 250 * 1024 * 1024)
+ } finally {
+ try {
+ await setGfsUploadProductMaxBytes(previous)
+ } finally {
+ await removeDiskUploadFixture(rejectedSource)
+ cleanupGfsFixture(fixtureName)
+ assertGfsFixtureCleaned(fixtureName)
+ }
+ }
+ })
+})
+
test.describe('GFS Upload v2 — approved negative Desktop journeys', () => {
test.skip(
process.env.GFS_UPLOAD_V2_NEGATIVE_E2E !== '1',
@@ -449,9 +510,7 @@ test.describe('GFS Upload v2 — approved negative Desktop journeys', () => {
source.filePath
)
await expect(
- appPage
- .getByRole('alert')
- .filter({ hasText: 'GFS uploads are limited to 200 MB per file.' })
+ appPage.getByRole('alert').filter({ hasText: 'GFS writer limit is 209715200 bytes' })
).toBeVisible({ timeout: 15_000 })
await expect
.poll(
diff --git a/docs/deploy/gfs-permission-store.md b/docs/deploy/gfs-permission-store.md
index 82ae51761..8706cba33 100644
--- a/docs/deploy/gfs-permission-store.md
+++ b/docs/deploy/gfs-permission-store.md
@@ -94,8 +94,10 @@ retain the fail-closed replica state; no reset path patches the key ad hoc.
The Minikube T2 profile separately enables Upload v2 through the committed HCC
patch `deploy/overlays/minikube/patches/gfs-upload-v2.yaml`. The
`GlobalFileSystem` instance remains declarative storage/layout input; HCC env is
-the sole owner of feature activation and the exact 200 MiB/part/concurrency
-contract passed into generated GFSC workloads. Public-base and production
+the sole owner of feature activation, the product upload policy, and the exact
+part/concurrency contract passed into generated GFSC workloads. The product
+policy defaults to 200 MiB and may be configured from one byte through the
+compiled 1 GiB Upload v2 protocol maximum. Public-base and production
activation remain disabled and separate from this local profile contract.
Any later convergence failure reasserts the Control API fence together with the
other database-dependent controllers and waits for the Control API Pods to
diff --git a/docs/deploy/minikube.md b/docs/deploy/minikube.md
index 345a2aee5..aab96a8b1 100644
--- a/docs/deploy/minikube.md
+++ b/docs/deploy/minikube.md
@@ -289,10 +289,18 @@ Desktop App
The committed Minikube overlay enables GFS Upload v2 through
`patches/gfs-upload-v2.yaml`. It patches the host-context-controller, which is
-the owner of generated GFSC workload configuration, with the exact release
-contract: 200 MiB files, preferred 8 MiB / maximum 16 MiB parts, four parts per
-session, sixteen global part streams, and the documented TTL, admission, and
-free-space limits. `minikube-ghcr`, `minikube-no-uis`, and
+the owner of generated GFSC workload configuration, with the release defaults:
+a 200 MiB product file limit, preferred 8 MiB / maximum 16 MiB parts, four parts
+per session, sixteen global part streams, and the documented TTL, admission,
+and free-space limits. Operators may set
+`CONTEXT_MAPPER_GFSC_UPLOAD_PRODUCT_MAX_FILE_BYTES` from one byte through the
+compiled 1 GiB protocol maximum. HCC forwards the value as
+`GFS_UPLOAD_PRODUCT_MAX_FILE_BYTES`; GFSC advertises and enforces that exact
+value for new sessions. Invalid, non-integer, or above-protocol values make
+GFSC fail startup rather than being clamped. The deprecated
+`CONTEXT_MAPPER_GFSC_UPLOAD_MAX_FILE_BYTES` alias may remain during rollout,
+but when both names are present they must carry the same value. `minikube-ghcr`,
+`minikube-no-uis`, and
`minikube-no-uis-ghcr` inherit the same patch from the base Minikube overlay.
The `GlobalFileSystem` resource intentionally does not carry
@@ -307,6 +315,14 @@ Validate the committed profile without touching a cluster:
bash scripts/tests/test-minikube-gfs-upload-v2-profile.sh
```
+The opt-in packaged runtime journeys use the same built Desktop and deployed
+Control UI bundle while changing the owned HCC setting from 100 MiB to 300 MiB.
+They verify exact-cap acceptance, cap-plus-one rejection, and a 250 MiB upload
+after the increase. Set `GFS_UPLOAD_V2_RUNTIME_LIMIT_E2E=1` only after the
+branch-owned profile has passed pre-gate sync. The harness refuses an unowned,
+dirty, stale, or production-like context and restores the prior product limit
+in a `finally` block.
+
### Required Configuration Per Service
#### rpc-proxy-secrets (Secret, namespace: rpc-proxy)
diff --git a/tests/e2e/gfsUploadV2Fixtures.ts b/tests/e2e/gfsUploadV2Fixtures.ts
index 68add8a36..db44f97bd 100644
--- a/tests/e2e/gfsUploadV2Fixtures.ts
+++ b/tests/e2e/gfsUploadV2Fixtures.ts
@@ -4,10 +4,11 @@ import { mkdtemp, rm, truncate, writeFile } from 'node:fs/promises'
import os from 'node:os'
import path from 'node:path'
-export const GFS_UPLOAD_V2_MAX_BYTES = 209_715_200
+export const GFS_UPLOAD_V2_DEFAULT_PRODUCT_MAX_BYTES = 209_715_200
+export const GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES = 1_073_741_824
export const GFS_UPLOAD_V2_BOUNDARIES = [
- GFS_UPLOAD_V2_MAX_BYTES - 1,
- GFS_UPLOAD_V2_MAX_BYTES,
+ GFS_UPLOAD_V2_DEFAULT_PRODUCT_MAX_BYTES - 1,
+ GFS_UPLOAD_V2_DEFAULT_PRODUCT_MAX_BYTES,
] as const
export interface DiskUploadFixture {
@@ -27,7 +28,11 @@ export async function createDiskUploadFixture(
extension = '.parquet',
label = 'gfs-v2'
): Promise<DiskUploadFixture> {
- if (!Number.isSafeInteger(byteLength) || byteLength < 0 || byteLength > GFS_UPLOAD_V2_MAX_BYTES) {
+ if (
+ !Number.isSafeInteger(byteLength) ||
+ byteLength < 0 ||
+ byteLength > GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES
+ ) {
throw new Error(`invalid GFS v2 fixture size: ${byteLength}`)
}
const directory = await mkdtemp(path.join(os.tmpdir(), 'evenfire-gfs-upload-v2-'))
@@ -45,15 +50,22 @@ export async function createDiskUploadFixture(
}
/**
- * Creates the single-byte-over-limit fixture used by the opt-in negative
- * browser journey. Keep the normal fixture helper fail-closed at the product
- * ceiling so a positive test can never accidentally become an oversize test.
+ * Creates a single-byte-over-product-limit fixture for opt-in negative
+ * journeys. Both helpers remain fail-closed at the protocol ceiling.
*/
export async function createOversizedDiskUploadFixture(
extension = '.parquet',
- label = 'gfs-v2-oversize'
+ label = 'gfs-v2-oversize',
+ productMaxBytes = GFS_UPLOAD_V2_DEFAULT_PRODUCT_MAX_BYTES
): Promise<DiskUploadFixture> {
- const byteLength = GFS_UPLOAD_V2_MAX_BYTES + 1
+ if (
+ !Number.isSafeInteger(productMaxBytes) ||
+ productMaxBytes < 1 ||
+ productMaxBytes >= GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES
+ ) {
+ throw new Error(`invalid GFS v2 product maximum: ${productMaxBytes}`)
+ }
+ const byteLength = productMaxBytes + 1
const directory = await mkdtemp(path.join(os.tmpdir(), 'evenfire-gfs-upload-v2-'))
const fileName = `${label}-${byteLength}${extension}`
const filePath = path.join(directory, fileName)
diff --git a/tests/e2e/gfsUploadV2Runtime.ts b/tests/e2e/gfsUploadV2Runtime.ts
index 86ae738e8..3228fde23 100644
--- a/tests/e2e/gfsUploadV2Runtime.ts
+++ b/tests/e2e/gfsUploadV2Runtime.ts
@@ -5,6 +5,9 @@ import { homedir } from 'node:os'
import { resolve } from 'node:path'
import { promisify } from 'node:util'
import { firstDataLine, kubectlContext, runControlPostgresSql, sqlLiteral } from './gfsFixtureCore'
+import { GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES } from './gfsUploadV2Fixtures'
+
+export { GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES } from './gfsUploadV2Fixtures'
const execFileAsync = promisify(execFile)
const HCC_NAMESPACE = 'control-plane'
@@ -14,6 +17,9 @@ const GFS_WRITER_DEPLOYMENT = 'gfsc-writer'
const GFS_READER_DEPLOYMENT = 'gfsc-reader'
const GFS_V2_HCC_ENV = 'CONTEXT_MAPPER_GFSC_UPLOAD_V2_ENABLED'
const GFS_V2_WRITER_ENV = 'GFS_UPLOAD_V2_ENABLED'
+const GFS_PRODUCT_MAX_HCC_ENV = 'CONTEXT_MAPPER_GFSC_UPLOAD_PRODUCT_MAX_FILE_BYTES'
+const GFS_PRODUCT_MAX_HCC_ALIAS_ENV = 'CONTEXT_MAPPER_GFSC_UPLOAD_MAX_FILE_BYTES'
+const GFS_PRODUCT_MAX_WRITER_ENV = 'GFS_UPLOAD_PRODUCT_MAX_FILE_BYTES'
const BRANCH_CONTEXT_RE = /^clerum-[a-z0-9][a-z0-9-]*-[0-9a-f]{8}$/
export interface GfsRuntimeImageMarker {
@@ -228,6 +234,19 @@ async function renderedWriterFlag(): Promise<string> {
).trim()
}
+async function renderedWriterProductMax(): Promise<string> {
+ return (
+ await kubectl([
+ '-n',
+ GFS_NAMESPACE,
+ 'get',
+ `deployment/${GFS_WRITER_DEPLOYMENT}`,
+ '-o',
+ `jsonpath={range .spec.template.spec.containers[*]}{range .env[?(@.name=="${GFS_PRODUCT_MAX_WRITER_ENV}")]}{.value}{end}{end}`,
+ ])
+ ).trim()
+}
+
async function waitForRenderedWriterFlag(expected: boolean): Promise<void> {
const expectedValue = String(expected)
const deadline = Date.now() + 240_000
@@ -242,6 +261,33 @@ async function waitForRenderedWriterFlag(expected: boolean): Promise<void> {
)
}
+async function waitForRenderedWriterProductMax(expected: number): Promise<void> {
+ const expectedValue = String(expected)
+ const deadline = Date.now() + 240_000
+ let lastValue = ''
+ while (Date.now() < deadline) {
+ lastValue = await renderedWriterProductMax()
+ if (lastValue === expectedValue) return
+ await new Promise(resolve => setTimeout(resolve, 1_000))
+ }
+ throw new Error(
+ `GFS Upload v2 product maximum did not converge to ${expectedValue}; observed ${lastValue || '<empty>'}`
+ )
+}
+
+export function validateGfsUploadProductMaxBytes(value: unknown): number {
+ if (
+ !Number.isSafeInteger(value) ||
+ (value as number) < 1 ||
+ (value as number) > GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES
+ ) {
+ throw new Error(
+ `invalid GFS Upload v2 product maximum; expected an integer from 1 through ${GFS_UPLOAD_V2_PROTOCOL_MAX_BYTES}`
+ )
+ }
+ return value as number
+}
+
async function waitForDeployment(deployment: string): Promise<void> {
await kubectl([
'-n',
@@ -290,6 +336,46 @@ export async function readGfsUploadV2Enabled(): Promise<boolean> {
return value === 'true'
}
+/**
+ * Changes the HCC-owned product policy and waits for the generated writer and
+ * reader to converge. The caller must restore the original value in a finally
+ * block. This changes policy only; the compiled protocol geometry is untouched.
+ */
+export async function setGfsUploadProductMaxBytes(productMaxBytes: number): Promise<void> {
+ const validated = validateGfsUploadProductMaxBytes(productMaxBytes)
+ await assertOwnedRuntimeContext()
+ await kubectl([
+ '-n',
+ HCC_NAMESPACE,
+ 'set',
+ 'env',
+ `deployment/${HCC_DEPLOYMENT}`,
+ `${GFS_PRODUCT_MAX_HCC_ENV}=${String(validated)}`,
+ `${GFS_PRODUCT_MAX_HCC_ALIAS_ENV}=${String(validated)}`,
+ ])
+ await kubectl([
+ '-n',
+ HCC_NAMESPACE,
+ 'rollout',
+ 'status',
+ `deployment/${HCC_DEPLOYMENT}`,
+ '--timeout=240s',
+ ])
+ await waitForRenderedWriterProductMax(validated)
+ await waitForDeployment(GFS_WRITER_DEPLOYMENT)
+ await waitForDeployment(GFS_READER_DEPLOYMENT)
+}
+
+export async function readGfsUploadProductMaxBytes(): Promise<number> {
+ const value = await renderedWriterProductMax()
+ if (!/^[1-9]\d*$/.test(value)) {
+ throw new Error(
+ `GFS writer rendered an invalid ${GFS_PRODUCT_MAX_WRITER_ENV} value: ${value || '<empty>'}`
+ )
+ }
+ return validateGfsUploadProductMaxBytes(Number(value))
+}
+
export async function restartGfsWriter(): Promise<void> {
await assertOwnedRuntimeContext()
// Restart the real writer deployment while the upload is visibly active.
diff --git a/tests/e2e/package-lock.json b/tests/e2e/package-lock.json
index 558c31760..5ace9758b 100644
--- a/tests/e2e/package-lock.json
+++ b/tests/e2e/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-e2e-tests",
- "version": "0.1.66",
+ "version": "0.1.67",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-e2e-tests",
- "version": "0.1.66",
+ "version": "0.1.67",
"devDependencies": {
"@types/jsonwebtoken": "^9.0.10",
"@types/node": "^22.0.0",
diff --git a/tests/e2e/package.json b/tests/e2e/package.json
index 19145d619..6770e4a49 100644
--- a/tests/e2e/package.json
+++ b/tests/e2e/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-e2e-tests",
- "version": "0.1.66",
+ "version": "0.1.67",
"private": true,
"type": "module",
"scripts": {