Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(control-api): r3-m4 pin source limiter window
Josuéd91cf374e6cf
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex 355691863..62861e1d1 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.753",+ "version": "0.1.754","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.753",+ "version": "0.1.754","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.jsonindex 510f8b82b..7c81030c1 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.753",+ "version": "0.1.754","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/test/bug192.passwordLogin.realPostgres.integration.test.ts b/control-api/test/bug192.passwordLogin.realPostgres.integration.test.tsindex 0daadf25b..ce5494e77 100644--- a/control-api/test/bug192.passwordLogin.realPostgres.integration.test.ts+++ b/control-api/test/bug192.passwordLogin.realPostgres.integration.test.ts@@ -257,18 +257,26 @@ realPg('BUG-192 observable password-login regressions on real PostgreSQL', () =>expect(bcrypt.getRounds(compare.mock.calls[0][1] as string)).toBe(12)})it('denies a sixth source attempt before bcrypt', async () => {- for (let i = 0; i < 5; i++) {- await openPace()- expect((await login(`source-${i}@example.invalid`)).status).toBe(401)+ // Keep all six source hits in one fixed minute even when five bcrypt+ // compares straddle a wall-clock boundary; otherwise global pace can+ // deny the sixth request before the source limiter is observed.+ const wallClock = vi.spyOn(Date, 'now').mockReturnValue(Date.now())+ try {+ for (let i = 0; i < 5; i++) {+ await openPace()+ expect((await login(`source-${i}@example.invalid`)).status).toBe(401)+ }+ expect(compare).toHaveBeenCalledTimes(5)+ const sourceDenials = await denialCount('source_rate')+ const before = compare.mock.calls.length+ const response = await login('[email protected]')+ expect(response.status).toBe(429)+ expect(response.body.error).toBe('rate_limited')+ expect(compare.mock.calls.length).toBe(before)+ expect(await denialCount('source_rate')).toBe(sourceDenials + 1)+ } finally {+ wallClock.mockRestore()}- expect(compare).toHaveBeenCalledTimes(5)- const sourceDenials = await denialCount('source_rate')- const before = compare.mock.calls.length- const response = await login('[email protected]')- expect(response.status).toBe(429)- expect(response.body.error).toBe('rate_limited')- expect(compare.mock.calls.length).toBe(before)- expect(await denialCount('source_rate')).toBe(sourceDenials + 1)})it('denies rotating sources and canonical identifier variants after five attempts', async () => {for (let i = 0; i < 5; i++) {