Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
Merge remote-tracking branch 'origin/dev' into feat/llm-provider-lifecycle-control-api
Diego Zacarias77749436d2ae
diff --cc control-api/src/services/pluginWorkloadSdkDb.tsindex 741031b39,93f0a17cb..e9a602df9--- a/control-api/src/services/pluginWorkloadSdkDb.ts+++ b/control-api/src/services/pluginWorkloadSdkDb.ts@@@ -629,21 -671,20 +687,27 @@@ async function upsertGrantInTransaction})),]await appendControlApiPermissionEventsInTransaction(db, { operatorSub, changes })+ // issue #375 (P3): nudge the WRC to re-reconcile now that the grant changed.+ await notifyGrantUpdate(db, {+ recipeNamespace: params.recipeNamespace,+ recipeName: params.recipeName,+ capabilityFamily: params.capabilityFamily,+ })return grant- })+ }}-export async function listGrants(filter?: {- recipeNamespace?: string- recipeName?: string-}): Promise<PluginWorkloadSdkGrant[]> {+export async function listGrants(+ filter?: {+ recipeNamespace?: string+ recipeName?: string+ },+ // Accepts a transaction client so the grant write-gate can read the stored+ // grant (Pieza D no-worsening context) on the SAME connection that holds the+ // model advisory locks — no extra pool checkout under the lock (adenda A3).+ // Defaults to the global pool for every other (unlocked) caller.+ db: Pick<DbClient, 'query'> = pool+): Promise<PluginWorkloadSdkGrant[]> {const clauses: string[] = []const values: unknown[] = []if (filter?.recipeNamespace) {diff --cc control-api/test/routes.adminPluginWorkloadSdk.test.tsindex 15d164d2d,632dcffd8..95ea1eddf--- a/control-api/test/routes.adminPluginWorkloadSdk.test.ts+++ b/control-api/test/routes.adminPluginWorkloadSdk.test.ts@@@ -484,10 -470,36 +484,37 @@@ describe('routes/admin/pluginWorkloadSdcapabilityFamily: 'promptBridge',provider: 'zai',allowedCallers: ['api'],- quotaLimits: { maxRequestsPerRun: 10 },+ // Issue #348 (plan 2.6, strip has LANDED): the deprecated per-run key+ // is tolerated on write but STRIPPED before persistence — the persisted+ // quotaLimits must be empty, not { maxRequestsPerRun: 10 }.+ quotaLimits: {},+ }),+ '11111111-1111-4111-8111-111111111111'+ )+ })++ it('accepts deprecated per-run keys, strips them, keeps active keys', async () => {+ // Issue #348 (plan 2.6/2.7): deprecated per-run keys stay shape-validated+ // (malformed still 400s, pinned above) but are dropped on write, while the+ // active per-minute/token keys persist untouched.+ vi.mocked(sdkDb.upsertGrant).mockResolvedValue({ id: 'g1' } as never)+ const res = await request(buildApp())+ .post('/admin/plugin-workload-sdk/grants')+ .send({+ ...validGrantBody,+ quotaLimits: {+ maxRequestsPerRun: 5,+ maxNotificationsPerRun: 7,+ maxInvocationsPerMinute: 30,+ },+ })+ expect(res.status).toBe(200)+ expect(sdkDb.upsertGrant).toHaveBeenCalledWith(+ expect.objectContaining({+ quotaLimits: { maxInvocationsPerMinute: 30 },}),- '11111111-1111-4111-8111-111111111111'+ '11111111-1111-4111-8111-111111111111',+ expect.anything() // carrier transaction client (R1-H3 fase 2))})