Skip to content

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

TypeScript

test(control-api): r8-l24 exercise stream limiter outage

Josué0f744362fb2b
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 21ae3e5d6..b83eaf161 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.695",
+ "version": "0.1.696",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.695",
+ "version": "0.1.696",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",
diff --git a/control-api/package.json b/control-api/package.json
index a73dad17e..26b47d2bd 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.695",
+ "version": "0.1.696",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/test/routes.externalGfsRateLimitFailClosed.realPostgres.integration.test.ts b/control-api/test/routes.externalGfsRateLimitFailClosed.realPostgres.integration.test.ts
index 8e11bfa78..e808b72ce 100644
--- a/control-api/test/routes.externalGfsRateLimitFailClosed.realPostgres.integration.test.ts
+++ b/control-api/test/routes.externalGfsRateLimitFailClosed.realPostgres.integration.test.ts
@@ -275,12 +275,14 @@ describeRealPostgres('external GFS rate limiter backend (real PostgreSQL)', () =
await corePool.query('DELETE FROM rate_limit_buckets')
let grants: request.Response
+ let entityChanges: request.Response
let ack: request.Response
await injectLimiterFault()
try {
grants = await external(
request(app).get(`/api/v1/external/gfs/grants?drive=main&resourceId=${randomUUID()}`)
)
+ entityChanges = await external(request(app).get('/api/v1/external/entity-changes/stream'))
ack = await external(request(app).post(`/api/v1/external/notifications/${randomUUID()}/ack`))
} finally {
await removeLimiterFault()
@@ -292,6 +294,12 @@ describeRealPostgres('external GFS rate limiter backend (real PostgreSQL)', () =
expect(grants.body).toEqual({ error: 'rate_limit_unavailable', retryAfterSeconds: 2 })
expect(grants.headers['retry-after']).toBe('2')
expect(grants.headers['cache-control']).toBe('no-store')
+ // The entity-change stream uses the same shared rate-limit middleware but
+ // chooses fail-closed because its principal budget must remain distributed.
+ expect(entityChanges.status).toBe(503)
+ expect(entityChanges.body).toEqual({ error: 'rate_limit_unavailable', retryAfterSeconds: 2 })
+ expect(entityChanges.headers['retry-after']).toBe('2')
+ expect(entityChanges.headers['cache-control']).toBe('no-store')
// Witness for the process-memory policy under the same fault: the ack
// route's Postgres limiter could not count either, its in-memory counter
// admitted the first request, and its handler answered.