Skip to content

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

TypeScript

test: prove TypeError rollback on PostgreSQL (R17-M1)

Josué5451d825ea01
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 0627c44e9..fe86322be 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.782",
+ "version": "0.1.783",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.782",
+ "version": "0.1.783",
"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 e2e1f12a7..4faa2977a 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.782",
+ "version": "0.1.783",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/test/passwordWorkOwnership.operation.realPostgres.integration.test.ts b/control-api/test/passwordWorkOwnership.operation.realPostgres.integration.test.ts
index e34470f4d..3e7f6a38d 100644
--- a/control-api/test/passwordWorkOwnership.operation.realPostgres.integration.test.ts
+++ b/control-api/test/passwordWorkOwnership.operation.realPostgres.integration.test.ts
@@ -192,6 +192,36 @@ realPg('password-work operation preservation on PostgreSQL 16', () => {
}
})
+ it('rolls back a prior database write when the mutation callback throws a TypeError', async () => {
+ const fixture = await resetFixture()
+ const originalName = (
+ await local.query('SELECT name FROM users WHERE id = $1', [fixture.userId])
+ ).rows[0].name
+
+ await expect(
+ runPasswordMutation(
+ async transaction => {
+ await transaction.query('UPDATE users SET name = $2 WHERE id = $1', [
+ fixture.userId,
+ 'Must be rolled back',
+ ])
+ throw new TypeError('private callback diagnostic')
+ },
+ { mode: 'standard' }
+ )
+ ).rejects.toMatchObject({
+ name: 'PasswordMutationInternalError',
+ code: 'internal_error',
+ message: 'internal_error',
+ })
+
+ const persistedName = (
+ await local.query('SELECT name FROM users WHERE id = $1', [fixture.userId])
+ ).rows[0].name
+ expect(persistedName).toBe(originalName)
+ expect(await ownerCount()).toBe(0)
+ })
+
it('keeps a real lost-COMMIT outcome above failed owner cleanup in an outer reservation', async () => {
const fixture = await resetFixture()
const sibling = await createSilentPasswordResetInvitation({