Skip to content

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

TypeScript

refactor(control-api): brand model-lock helpers as DbTransactionClient (dev-sync)

Diego Zacarias6da353232854
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index ebaa3a3e0..be2a61d83 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.467",
+ "version": "0.1.468",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.467",
+ "version": "0.1.468",
"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 7aaf5d425..6e03124d4 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.467",
+ "version": "0.1.468",
"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 48569df9d..a4e1e5403 100644
--- a/control-api/src/db.ts
+++ b/control-api/src/db.ts
@@ -6167,7 +6167,7 @@ export const HOST_MODEL_WRITE_CARRIER_IDLE_TIMEOUT_MS = boundedEnvInteger(
* inside an open transaction (`withTransaction`); the caller HOLDS it across the
* subsequent impact read + mutation / K8s write.
*/
-export async function advisoryLockModelName(db: DbClient, model: string): Promise<void> {
+export async function advisoryLockModelName(db: DbTransactionClient, model: string): Promise<void> {
await db.query(`SELECT pg_advisory_xact_lock(hashtext($1)::bigint)`, [
`${LLM_MODEL_LOCK_NAMESPACE}${model}`,
])
@@ -6180,7 +6180,10 @@ export async function advisoryLockModelName(db: DbClient, model: string): Promis
* pair acquires nothing (an empty set is a no-op). Key derivation stays in
* `advisoryLockModelName` (regla D4).
*/
-export async function advisoryLockModelNames(db: DbClient, models: string[]): Promise<void> {
+export async function advisoryLockModelNames(
+ db: DbTransactionClient,
+ models: string[]
+): Promise<void> {
const ordered = Array.from(new Set(models)).sort()
for (const model of ordered) {
await advisoryLockModelName(db, model)
@@ -6196,7 +6199,7 @@ export async function advisoryLockModelNames(db: DbClient, models: string[]): Pr
* unit) and comes from a bounded env, so it can never inject SQL.
*/
export async function boundCarrierTransactionIdleTimeout(
- db: DbClient,
+ db: DbTransactionClient,
ms: number = HOST_MODEL_WRITE_CARRIER_IDLE_TIMEOUT_MS
): Promise<void> {
await db.query(`SELECT set_config('idle_in_transaction_session_timeout', $1, true)`, [String(ms)])