Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-api): match optional-chained and cast pool ends in the teardown guard (J2)
Alfredo Lopez93d76d5a5e0f
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex b8901b3f7..641cde629 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.690",+ "version": "0.1.691","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.690",+ "version": "0.1.691","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.jsonindex 52f72d6a5..392a3831e 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.690",+ "version": "0.1.691","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/test/realPostgresTeardown.guard.test.ts b/control-api/test/realPostgresTeardown.guard.test.tsindex 40533af20..a2c56720d 100644--- a/control-api/test/realPostgresTeardown.guard.test.ts+++ b/control-api/test/realPostgresTeardown.guard.test.ts@@ -13,14 +13,16 @@ import { fileURLToPath } from 'node:url'// by `pid <> pg_backend_pid()` and nothing terminates it afterwards.//// The rule is lexical and deliberately narrow: in each test/*.realPostgres*-// suite that contains pg_terminate_backend, every `<identifier>.end()` whose-// receiver is not the identifier that issues the terminate query is a-// violation, wherever it sits in the file (beforeAll, a test body, afterAll).+// suite that contains pg_terminate_backend, every argument-less `.end()` —+// plain, optional-chained (`?.end()`) or on a parenthesised or indexed+// receiver — whose receiver is not the identifier that issues the terminate+// query is a violation, wherever it sits in the file (beforeAll, a test body,+// afterAll). `.end(<arg>)` is an http request or stream, not a pg pool.const testDir = dirname(fileURLToPath(import.meta.url))const REAL_POSTGRES_SUITE = /\.realPostgres.*\.test\.ts$/const TERMINATE_QUERY = /\b(\w+)\.query(?:<[^>]*>)?\(\s*`[^`]*pg_terminate_backend/g-const PLAIN_END = /\b(\w+)\.end\(\)/g+const PLAIN_END = /([\w)\]]+)\??\.end\(\)/ginterface ScannedSuite {file: string@@ -86,10 +88,10 @@ describe('real-Postgres teardown guard (R4-L11)', () => {// Witness: the terminate query named the pool that is allowed a plain end.expect(suite.terminators).toEqual(['adminPool'])expect(suite.violations).toEqual([- 'fixture.realPostgres.test.ts:2 dbPool.end(',- 'fixture.realPostgres.test.ts:3 pool?.end(',- 'fixture.realPostgres.test.ts:4 Pool).end(',- 'fixture.realPostgres.test.ts:5 corePool?.end(',+ 'fixture.realPostgres.test.ts:2 dbPool.end()',+ 'fixture.realPostgres.test.ts:3 pool?.end()',+ 'fixture.realPostgres.test.ts:4 Pool).end()',+ 'fixture.realPostgres.test.ts:5 corePool?.end()',])})})