Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test: pin the #6930 driver patch in all three shipped copies in its own suite
garrytan222b42122243
diff --git a/test/postgres-driver-vendor-6930.test.ts b/test/postgres-driver-vendor-6930.test.tsnew file mode 100644index 0000000000..7a6c139fde--- /dev/null+++ b/test/postgres-driver-vendor-6930.test.ts@@ -0,0 +1,26 @@+/**+ * #6930: the vendored driver's shared array types and transaction pipelining ship in all three runtime copies+ * (ESM, CommonJS, workerd). The behaviour is proven on the ESM copy by test/pathological/pg-round-trips-6930.test.ts+ * and test/e2e/pgbouncer-transaction-pipeline-6930.test.ts; this pins that every copy carries the same patch.+ */+import { describe, expect, test } from 'bun:test';+import { readFileSync } from 'node:fs';++describe('vendored Postgres driver #6930 patch', () => {+ test('all three shipped copies carry the shared array types and transaction pipelining (offline)', () => {+ for (const path of ['src', 'cjs/src', 'cf/src']) {+ const connection = readFileSync(new URL('../vendor/postgres/' + path + '/connection.js', import.meta.url), 'utf8');+ expect(connection).toContain('needsTypes && options.array_types && options.array_types.rows');+ expect(connection).toContain('options.array_types && (options.array_types.rows = types.map(');+ expect(connection).toMatch(/noteBudget\(q\)\n\s+noteTransaction\(q\)/);+ expect(connection).toMatch(/&& sent\.length < pipelineLimit\(\)\n\s+&& mayPipeline/);+ expect(connection).toContain('return transaction_pipeline > max_pipeline && inTransactionAfterSent && connection.reserved');+ const index = readFileSync(new URL('../vendor/postgres/' + path + '/index.js', import.meta.url), 'utf8');+ expect(index).toContain("'max_pipeline', 'transaction_pipeline', 'backoff'");+ expect(index).toContain('array_types : o.array_types || null,');+ }+ const types = readFileSync(new URL('../vendor/postgres/types/index.d.ts', import.meta.url), 'utf8');+ expect(types).toContain('transaction_pipeline: number;');+ expect(types).toContain('array_types: { rows: Array<[number, number]> | null } | null;');+ });+});diff --git a/test/postgres-driver-vendor.test.ts b/test/postgres-driver-vendor.test.tsindex 6b47e8de85..550e3bf8ad 100644--- a/test/postgres-driver-vendor.test.ts+++ b/test/postgres-driver-vendor.test.ts@@ -87,21 +87,4 @@ describe('vendored Postgres driver packaging', () => {expect(types).toContain('inflight_max: number | null;');expect(types).toContain("reason: 'age' | 'idle'; budget_ms: number");});-- test('#6930: all three shipped copies carry the shared array types and transaction pipelining (offline)', () => {- for (const path of ['src', 'cjs/src', 'cf/src']) {- const connection = readFileSync(new URL(`../vendor/postgres/${path}/connection.js`, import.meta.url), 'utf8');- expect(connection).toContain('needsTypes && options.array_types && options.array_types.rows');- expect(connection).toContain('options.array_types && (options.array_types.rows = types.map(');- expect(connection).toMatch(/noteBudget\(q\)\n\s+noteTransaction\(q\)/);- expect(connection).toMatch(/&& sent\.length < pipelineLimit\(\)\n\s+&& mayPipeline/);- expect(connection).toContain('return transaction_pipeline > max_pipeline && inTransactionAfterSent && connection.reserved');- const index = readFileSync(new URL(`../vendor/postgres/${path}/index.js`, import.meta.url), 'utf8');- expect(index).toContain("'max_pipeline', 'transaction_pipeline', 'backoff'");- expect(index).toContain('array_types : o.array_types || null,');- }- const types = readFileSync(new URL('../vendor/postgres/types/index.d.ts', import.meta.url), 'utf8');- expect(types).toContain('transaction_pipeline: number;');- expect(types).toContain('array_types: { rows: Array<[number, number]> | null } | null;');- });});