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 nested GFS seed change capture

Josuéb632dd9c15ed
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index beaecc0fd..8fa990243 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.608",
+ "version": "0.1.609",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.608",
+ "version": "0.1.609",
"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 9919d7f2e..6b17fc92c 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.608",
+ "version": "0.1.609",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/test/entityChangeFeed.realPostgres.integration.test.ts b/control-api/test/entityChangeFeed.realPostgres.integration.test.ts
index 829e23a24..81d2571eb 100644
--- a/control-api/test/entityChangeFeed.realPostgres.integration.test.ts
+++ b/control-api/test/entityChangeFeed.realPostgres.integration.test.ts
@@ -2,6 +2,7 @@ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
import { randomBytes, randomUUID } from 'node:crypto'
import { Pool } from 'pg'
import { initDb } from '../src/db.js'
+import { DbSeedResourceStore, seedRootDirectories } from '../src/gfs/seedResources.js'
import './realPostgres.requirement.ts'
const adminUrl = process.env.CONTROL_API_REAL_PG_ADMIN_URL
@@ -53,6 +54,38 @@ describeRealPostgres('entity change feed real PostgreSQL contract', () => {
}
})
+ it('captures nested GFS root provisioning and stays idempotent on reseed', async () => {
+ const client = await instancePool.connect()
+ const drive = `entity-change-seed-${randomUUID()}`
+ try {
+ const before = await client.query<{ count: string }>(
+ 'SELECT count(*)::text AS count FROM entity_change_outbox'
+ )
+ await client.query('BEGIN')
+ const seeded = await seedRootDirectories(new DbSeedResourceStore(client), drive, [
+ '/org/team/project',
+ ])
+ await client.query('COMMIT')
+ expect(seeded.rootResourceId).toBeTruthy()
+ expect(seeded.byPath['/org/team/project']).toBeTruthy()
+ const afterCreate = await client.query<{ count: string }>(
+ 'SELECT count(*)::text AS count FROM entity_change_outbox'
+ )
+ expect(Number(afterCreate.rows[0]?.count) - Number(before.rows[0]?.count)).toBe(4)
+
+ await client.query('BEGIN')
+ await seedRootDirectories(new DbSeedResourceStore(client), drive, ['/org/team/project'])
+ await client.query('COMMIT')
+ const afterReseed = await client.query<{ count: string }>(
+ 'SELECT count(*)::text AS count FROM entity_change_outbox'
+ )
+ expect(afterReseed.rows[0]?.count).toBe(afterCreate.rows[0]?.count)
+ } finally {
+ await client.query('ROLLBACK').catch(() => undefined)
+ client.release()
+ }
+ })
+
it('captures committed create, replace, rename/move, delete, grant, and membership changes', async () => {
const client = await instancePool.connect()
const drive = `entity-change-${randomUUID()}`