Skip to content

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

TypeScript

test(control-api): cover success and error paths in refresh label matrix (BR-13)

Diego Zacariasd1b3eea17ad7
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index ec2042166..0c102d4f5 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.825",
+ "version": "0.1.826",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.825",
+ "version": "0.1.826",
"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 c6a69e4f7..0099df54b 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.825",
+ "version": "0.1.826",
"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.mcp-host.user-approval-requests.test.ts b/control-api/test/routes.mcp-host.user-approval-requests.test.ts
index 0146f7096..9977147c5 100644
--- a/control-api/test/routes.mcp-host.user-approval-requests.test.ts
+++ b/control-api/test/routes.mcp-host.user-approval-requests.test.ts
@@ -432,6 +432,36 @@ describe('User Approval Request Routes', () => {
await expectOnlyIncremented(before, 'failed')
})
+ it('counts a successful rotation as success', async () => {
+ const { refreshToken } = issueTestTokens()
+ const before = await snapshot()
+
+ const res = await postRefresh(refreshToken)
+
+ expect(res.status).toBe(200)
+ await expectOnlyIncremented(before, 'success')
+ })
+
+ it('counts a refresh-jti consumption error as failed', async () => {
+ const { refreshToken } = issueTestTokens()
+ failNextRefreshJtiInsert = new Error('db down')
+ const before = await snapshot()
+
+ const res = await postRefresh(refreshToken)
+
+ expect(res.status).toBe(500)
+ await expectOnlyIncremented(before, 'failed')
+ })
+
+ it('counts a request without bearer token as failed', async () => {
+ const before = await snapshot()
+
+ const res = await request(app).post('/api/v1/workflow-auth/refresh').send()
+
+ expect(res.status).toBe(401)
+ await expectOnlyIncremented(before, 'failed')
+ })
+
it('keeps an invalid refresh token on the failed label', async () => {
const before = await snapshot()