Skip to content

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

TypeScript

test(plugin-sdk): address zach88 review nits (R1-M1/L3/L4)

Alfredo Lopezc4417dc00a8a
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 6e79b6515..305db4444 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.459",
+ "version": "0.1.460",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.459",
+ "version": "0.1.460",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/image-policy": "file:../packages/image-policy",
diff --git a/control-api/package.json b/control-api/package.json
index 0afc4d0f2..5af12984c 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.459",
+ "version": "0.1.460",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/src/services/pluginWorkloadSdkQuotaTracker.ts b/control-api/src/services/pluginWorkloadSdkQuotaTracker.ts
index 711880989..2f74147d5 100644
--- a/control-api/src/services/pluginWorkloadSdkQuotaTracker.ts
+++ b/control-api/src/services/pluginWorkloadSdkQuotaTracker.ts
@@ -12,9 +12,10 @@ import {
// (platform protection against control-plane DoS); a grant-level per-minute
// override still wins (decision §3.1) — it is a per-recipe fairness knob, NOT
// the platform DoS ceiling, so it is intentionally NOT clamped to the default.
-// A raised override stays bounded by the grant-independent 600/min request
-// bucket + pre-auth limits (pluginWorkloadSdkRateLimits.ts /
-// plugin-workload-sdk.routes.ts), which are the actual anti-DoS backstop.
+// A raised override stays bounded by the grant-independent request bucket
+// (CONTROL_API_PLUGIN_SDK_REQUEST_BUCKET_PER_MIN, default 600/min) + pre-auth
+// limits (pluginWorkloadSdkRateLimits.ts / plugin-workload-sdk.routes.ts),
+// which are the actual anti-DoS backstop.
//
// The former per-period leg (`consumeQuota`, backed by
// plugin_workload_sdk_quota_counters) was DELETED (issue #348): the deprecated
diff --git a/control-ui/components/__tests__/PluginWorkloadSdkPage.test.tsx b/control-ui/components/__tests__/PluginWorkloadSdkPage.test.tsx
index 96f7aaa18..926ced242 100644
--- a/control-ui/components/__tests__/PluginWorkloadSdkPage.test.tsx
+++ b/control-ui/components/__tests__/PluginWorkloadSdkPage.test.tsx
@@ -2,6 +2,7 @@ import React from 'react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
import {
+ type PluginWorkloadSdkGrant,
getAdminUsers,
getPluginWorkloadSdkLegacyInventory,
getRecipes,
@@ -77,6 +78,31 @@ const prefilledUser = {
displayName: null,
}
+function makeGrant(overrides: Partial<PluginWorkloadSdkGrant>): PluginWorkloadSdkGrant {
+ return {
+ id: 'grant-1',
+ recipeNamespace: 'sandbox-recipes',
+ recipeName: 'notify-recipe',
+ capabilityFamily: 'clientNotifications',
+ provider: null,
+ allowedModels: [],
+ allowedEventTypes: ['scan.complete'],
+ allowedTargetRefs: [],
+ allowedUserRefs: [],
+ allowedCallers: ['scanner'],
+ quotaLimits: {},
+ modelPolicies: {},
+ promptTargets: [],
+ defaultTargetRef: null,
+ policyState: 'active',
+ revocationId: null,
+ policyRevision: 1,
+ createdAt: '2026-01-01T00:00:00Z',
+ updatedAt: '2026-01-01T00:00:00Z',
+ ...overrides,
+ }
+}
+
beforeEach(() => {
vi.mocked(getAdminUsers).mockResolvedValue({ items: [manualUser] })
vi.mocked(getPluginWorkloadSdkLegacyInventory).mockResolvedValue({
@@ -135,4 +161,27 @@ describe('Plugin Workload SDK operator page', () => {
expect(within(selected).getByText('Manual user')).toBeInTheDocument()
expect(within(selected).queryByText('Prefilled user')).not.toBeInTheDocument()
})
+
+ it('renders the quota cell as N/min for a per-minute override and "platform defaults" without one', async () => {
+ // Issue #348: the grants table shows API-set per-minute overrides when
+ // present, else 'platform defaults'. Covers the PR's only observable UI
+ // change (per-run caps removed; per-minute override surfaced).
+ vi.mocked(listPluginWorkloadSdkGrants).mockResolvedValue({
+ items: [
+ makeGrant({
+ id: 'grant-override',
+ recipeName: 'override-recipe',
+ capabilityFamily: 'promptBridge',
+ provider: 'openai',
+ quotaLimits: { maxInvocationsPerMinute: 4 },
+ }),
+ makeGrant({ id: 'grant-default', recipeName: 'default-recipe', quotaLimits: {} }),
+ ],
+ })
+
+ render(<PluginWorkloadSdkPage />)
+
+ expect(await screen.findByText('4/min')).toBeInTheDocument()
+ expect(screen.getByText('platform defaults')).toBeInTheDocument()
+ })
})
diff --git a/control-ui/lib/api.ts b/control-ui/lib/api.ts
index a2f2a9e41..84b0048da 100644
--- a/control-ui/lib/api.ts
+++ b/control-ui/lib/api.ts
@@ -3408,7 +3408,10 @@ export type PluginWorkloadSdkGrantInput = {
allowedTargetRefs?: string[]
allowedUserRefs?: string[]
allowedCallers?: string[]
- quotaLimits?: PluginWorkloadSdkQuotaLimits
+ // Input type omits the deprecated per-run keys (issue #348): this UI never
+ // sends them and the server strips them on write. The response
+ // PluginWorkloadSdkQuotaLimits still carries them for legacy grants.
+ quotaLimits?: Omit<PluginWorkloadSdkQuotaLimits, 'maxRequestsPerRun' | 'maxNotificationsPerRun'>
modelPolicies?: Record<string, PluginWorkloadSdkModelPolicy>
promptTargets?: PluginWorkloadSdkPromptTarget[]
defaultTargetRef?: string
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 0661c711b..9a8c85f8a 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.430",
+ "version": "0.1.431",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.430",
+ "version": "0.1.431",
"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 ac5504573..6ef51ab64 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.430",
+ "version": "0.1.431",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",