Skip to content

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

TypeScript

docs(control-api): document owner-blind service grant uniqueness (R1-M2)

Diego Zacarias85fe4f21813d
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 94317002b..45c93ac23 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.470",
+ "version": "0.1.471",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.470",
+ "version": "0.1.471",
"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 32f95cd2f..d4f9cf5ff 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.470",
+ "version": "0.1.471",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/src/db.ts b/control-api/src/db.ts
index 6e9dd6641..f335c7a18 100644
--- a/control-api/src/db.ts
+++ b/control-api/src/db.ts
@@ -6078,6 +6078,18 @@ async function applyOAuthGrantsOwnerGeneralization(db: DbClient): Promise<void>
CREATE UNIQUE INDEX IF NOT EXISTS oauth_grants_shared_unique
ON oauth_grants (owner_kind, recipe_namespace, recipe_name, context_id, oauth_client_id)
WHERE grant_kind = 'shared';
+ -- NOTE (R1-M2): oauth_grants_service_unique (applyOAuthServiceGrants above)
+ -- is DELIBERATELY left owner-blind — it is NOT recreated here with
+ -- owner_kind, unlike its two siblings (oauth_grants_unique,
+ -- oauth_grants_shared_unique). Rationale: service grants are recipe-only.
+ -- OAuth mcp-servers never create them — resolveServerOAuth only ever derives
+ -- grantScope 'user'|'context' (mcpServerOAuthSpec.ts), so an mcp-server's
+ -- grant_kind is never 'service'. Every service row therefore has
+ -- owner_kind='recipe', making (recipe_namespace, recipe_name, oauth_client_id)
+ -- unique without owner_kind in the key. If a future unit lets an
+ -- owner_kind='mcpserver' row take grant_kind='service', this index MUST gain
+ -- owner_kind (else a service INSERT could DO UPDATE a same-key recipe row's
+ -- tokens — silent cross-owner overwrite).
`)
}