Skip to content

fix(drizzle): add top-level url property to PostgresDrizzleConfig#889

Merged
jhaynie merged 2 commits intomainfrom
task/drizzle-config-887
Feb 6, 2026
Merged

fix(drizzle): add top-level url property to PostgresDrizzleConfig#889
jhaynie merged 2 commits intomainfrom
task/drizzle-config-887

Conversation

@jhaynie
Copy link
Member

@jhaynie jhaynie commented Feb 6, 2026

Summary

  • Adds url as a top-level convenience property on PostgresDrizzleConfig so users can pass the connection URL directly instead of nesting it under connection: { url }.
  • Updates the URL resolution priority chain: connection.url > url > connectionString > DATABASE_URL.
  • Adds 22 comprehensive config tests following the Kysely test pattern (type compatibility, direct instance creation, URL priority, backward compatibility).

Closes #887

Summary by CodeRabbit

  • New Features

    • PostgreSQL connections accept a new optional url setting; when present it takes precedence over other connection sources (falls back to other methods as before).
  • Tests

    • Added comprehensive tests for PostgreSQL configuration handling, covering type compatibility, URL precedence, and backward compatibility with existing connection methods.

Add url as a convenience property on PostgresDrizzleConfig so users can
pass the connection URL directly instead of nesting it under connection.

Priority chain: connection.url > url > connectionString > DATABASE_URL
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

Adds an optional top-level url to Postgres config, changes client URL resolution to prefer config.url over config.connectionString (then fallback to env), and introduces comprehensive tests validating precedence and backward compatibility.

Changes

Cohort / File(s) Summary
Postgres client logic
packages/drizzle/src/postgres.ts
Reworked URL resolution: if config.url is provided it sets clientConfig.url; otherwise falls back to config.connectionString and then process.env.DATABASE_URL. (Small control-flow change; +3/−1 lines.)
Types / Config API
packages/drizzle/src/types.ts
Added optional url?: string to PostgresDrizzleConfig to expose top-level shorthand for connection URL (+7/−0 lines).
Test coverage
packages/drizzle/test/config.test.ts
Added comprehensive tests (+363/−0) covering type shapes, direct instantiation scenarios, URL precedence (connection.url > url > connectionString), and backward compatibility; ensures created objects exist and cleanup via close.
Sandbox request formatting
packages/server/src/api/sandbox/create.ts
Non-functional formatting change in SandboxCreateRequestSchema.command.files[].path (description split across lines); no validation or behavior changes (+3/−1 lines).
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed PR successfully adds top-level url property to PostgresDrizzleConfig with correct priority chain and comprehensive test coverage, directly addressing issue #887.
Out of Scope Changes check ✅ Passed All changes are directly scoped to add url property support. Minor formatting change in packages/server/src/api/sandbox/create.ts is incidental and does not affect functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

📦 Canary Packages Published

version: 1.0.3-1564153

Packages
Package Version URL
@agentuity/evals 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-evals-1.0.3-1564153.tgz
@agentuity/opencode 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-opencode-1.0.3-1564153.tgz
@agentuity/core 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-core-1.0.3-1564153.tgz
@agentuity/auth 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-auth-1.0.3-1564153.tgz
@agentuity/runtime 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-runtime-1.0.3-1564153.tgz
@agentuity/workbench 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-workbench-1.0.3-1564153.tgz
@agentuity/react 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-react-1.0.3-1564153.tgz
@agentuity/server 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-server-1.0.3-1564153.tgz
@agentuity/drizzle 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-drizzle-1.0.3-1564153.tgz
@agentuity/postgres 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-postgres-1.0.3-1564153.tgz
@agentuity/cli 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-cli-1.0.3-1564153.tgz
@agentuity/frontend 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-frontend-1.0.3-1564153.tgz
@agentuity/schema 1.0.3-1564153 https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-schema-1.0.3-1564153.tgz
Install

Add to your package.json:

{
  "dependencies": {
    "@agentuity/evals": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-evals-1.0.3-1564153.tgz",
    "@agentuity/opencode": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-opencode-1.0.3-1564153.tgz",
    "@agentuity/core": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-core-1.0.3-1564153.tgz",
    "@agentuity/auth": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-auth-1.0.3-1564153.tgz",
    "@agentuity/runtime": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-runtime-1.0.3-1564153.tgz",
    "@agentuity/workbench": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-workbench-1.0.3-1564153.tgz",
    "@agentuity/react": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-react-1.0.3-1564153.tgz",
    "@agentuity/server": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-server-1.0.3-1564153.tgz",
    "@agentuity/drizzle": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-drizzle-1.0.3-1564153.tgz",
    "@agentuity/postgres": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-postgres-1.0.3-1564153.tgz",
    "@agentuity/cli": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-cli-1.0.3-1564153.tgz",
    "@agentuity/frontend": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-frontend-1.0.3-1564153.tgz",
    "@agentuity/schema": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-schema-1.0.3-1564153.tgz"
  }
}

Or install directly:

bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-evals-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-opencode-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-core-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-auth-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-runtime-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-workbench-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-react-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-server-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-drizzle-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-postgres-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-cli-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-frontend-1.0.3-1564153.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-1564153/agentuity-schema-1.0.3-1564153.tgz

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/drizzle/test/config.test.ts`:
- Around line 232-241: The test "can create instance with no config" relies on
ambient DATABASE_URL and may connect to a real DB; update the test around
createPostgresDrizzle() to make it deterministic by saving
process.env.DATABASE_URL, then explicitly unset or set it to a safe dummy value
before calling createPostgresDrizzle(), run assertions, and finally restore the
original process.env.DATABASE_URL in the finally block (ensuring close() still
runs); reference the createPostgresDrizzle() call and the DATABASE_URL
environment variable when making the change.
🧹 Nitpick comments (3)
packages/drizzle/src/types.ts (1)

13-18: Clean addition of the url property.

The new property is well-documented with clear fallback semantics. The JSDoc accurately describes the resolution chain from the url field's perspective.

One small observation: the JSDoc on connection (line 28) says it "takes precedence over connectionString" but doesn't mention it also takes precedence over url. Consider updating it to say: "Takes precedence over url and connectionString if both are provided." This would make the full priority chain discoverable from either direction.

📝 Suggested doc update
 	/**
 	 * Full PostgreSQL connection configuration.
-	 * Takes precedence over `connectionString` if both are provided.
+	 * Takes precedence over `url` and `connectionString` if both are provided.
 	 */
 	connection?: PostgresConfig;
packages/drizzle/test/config.test.ts (2)

112-123: close() is async but never awaited in finally blocks.

Throughout this file, close() returns a Promise<void> but every call site in finally blocks is synchronous (e.g., line 121). This means cleanup is fire-and-forget — the test can finish before the connection is released, potentially causing resource leaks or flaky interference between tests.

Mark the test callbacks as async and await close():

♻️ Example fix (apply to all similar tests)
-		it('can create instance with url', () => {
+		it('can create instance with url', async () => {
 			const { db, client, close } = createPostgresDrizzle({
 				url: 'postgres://localhost:5432/nonexistent_db',
 			});
 			try {
 				expect(db).toBeDefined();
 				expect(client).toBeDefined();
 				expect(typeof close).toBe('function');
 			} finally {
-				close();
+				await close();
 			}
 		});

244-284: URL priority tests don't actually verify priority at runtime.

These tests are labeled "URL priority chain" but only confirm that configs compile and produce a defined db instance. They don't inspect which URL was actually selected by the client. The inline comment (lines 245–247) does acknowledge this, but the test names like "connection.url takes highest precedence" could mislead future readers into thinking the priority logic is regression-tested.

Consider either:

  1. Renaming them to clearly indicate they are structural/compile-time checks (e.g., "accepts config with connection.url, url, and connectionString"), or
  2. Adding a spy/mock on the postgres() factory (via @agentuity/test-utils or a manual spy) to assert the actual URL passed to the client, which would make these true behavioral tests.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed7a5a5 and 80e3ebd.

📒 Files selected for processing (3)
  • packages/drizzle/src/postgres.ts
  • packages/drizzle/src/types.ts
  • packages/drizzle/test/config.test.ts
🧰 Additional context used
📓 Path-based instructions (6)
packages/drizzle/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/drizzle/AGENTS.md)

packages/drizzle/**/*.{ts,tsx}: Use createPostgresDrizzle() factory function to create Drizzle ORM instances
Define schemas using Drizzle's pgTable and column types rather than other schema definition methods
Use full TypeScript support with schema inference from Drizzle ORM for type-safe queries
Use drizzleAdapter from better-auth when integrating with @agentuity/auth

Files:

  • packages/drizzle/src/types.ts
  • packages/drizzle/src/postgres.ts
  • packages/drizzle/test/config.test.ts
**/*.{ts,tsx,js,jsx,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Use Prettier for code formatting with tabs (width 3), single quotes, and semicolons

Files:

  • packages/drizzle/src/types.ts
  • packages/drizzle/src/postgres.ts
  • packages/drizzle/test/config.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with ESNext target and bundler moduleResolution

Files:

  • packages/drizzle/src/types.ts
  • packages/drizzle/src/postgres.ts
  • packages/drizzle/test/config.test.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use StructuredError from @agentuity/core for error handling

Files:

  • packages/drizzle/src/types.ts
  • packages/drizzle/src/postgres.ts
  • packages/drizzle/test/config.test.ts
packages/drizzle/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (packages/drizzle/AGENTS.md)

Ensure tests run against a PostgreSQL instance and use @agentuity/test-utils for mocking

Files:

  • packages/drizzle/test/config.test.ts
packages/*/test/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/*/test/**/*.{ts,tsx}: Place test files in test/ folder, never in src/ or __tests__/
Import from ../src/ in test files
Use @agentuity/test-utils for mocks in tests

Files:

  • packages/drizzle/test/config.test.ts
🧠 Learnings (1)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.

Applied to files:

  • packages/drizzle/src/types.ts
  • packages/drizzle/src/postgres.ts
  • packages/drizzle/test/config.test.ts
🧬 Code graph analysis (1)
packages/drizzle/test/config.test.ts (2)
packages/drizzle/src/types.ts (1)
  • PostgresDrizzleConfig (10-58)
packages/drizzle/src/postgres.ts (1)
  • createPostgresDrizzle (49-105)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: Queue SDK Tests
  • GitHub Check: Build
  • GitHub Check: Package Installation & Usage Test
  • GitHub Check: Framework Integration Tests (TanStack & Next.js)
  • GitHub Check: Cloud Deployment Tests
  • GitHub Check: Sandbox CLI Tests
  • GitHub Check: SDK Integration Test Suite
  • GitHub Check: Playwright E2E Smoke Test
  • GitHub Check: Template Integration Tests
  • GitHub Check: Pack & Upload
🔇 Additional comments (2)
packages/drizzle/src/postgres.ts (1)

58-66: URL priority chain is correctly implemented.

The cascading fallback logic is clean and correctly enforces connection.url > url > connectionString > DATABASE_URL. The outer !clientConfig.url guard on line 58 ensures that a URL from the cloned connection object always wins.

packages/drizzle/test/config.test.ts (1)

1-11: Good test structure and organization.

The file follows the project convention: it's placed under test/, imports from ../src/, and is well-organized into logical describe blocks (type compat, direct usage, priority, backward compat). The comment header referencing the Kysely test pattern is helpful context. As per coding guidelines, @agentuity/test-utils should be used for mocking — that would be relevant if the URL priority tests are upgraded to behavioral tests.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@jhaynie jhaynie enabled auto-merge (squash) February 6, 2026 18:05
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/drizzle/test/config.test.ts`:
- Around line 112-123: The test calls createPostgresDrizzle and invokes the
returned close function in a finally block but close is async (async () => {
await client.close(); }), so the Promise is dropped; update all finally blocks
in this test file to await close() (e.g., change finally { close(); } to finally
{ await close(); }) and make the surrounding test callback async so the await is
valid; ensure the same change is applied to every test in this file that calls
close in a finally.
🧹 Nitpick comments (2)
packages/drizzle/test/config.test.ts (2)

254-293: URL priority tests don't actually verify the priority chain.

These tests create instances and assert db is defined, but they never inspect which URL the underlying postgres client received. The names ("takes highest precedence", "takes precedence over") imply behavioural verification that isn't happening — they're structurally identical to the "direct usage" tests above.

To meaningfully test the priority logic in createPostgresDrizzle, you'd need to either mock the postgres constructor and assert the URL it received, or expose/inspect the resolved clientConfig. Without that, regressions in the priority chain (connection.url > url > connectionString > DATABASE_URL) would go undetected.


296-361: Several backward-compatibility tests duplicate "direct usage" tests above.

For example, "connectionString still works" (Line 297) is nearly identical to "can create instance with connectionString" (Line 125), and "connection object still works" (Line 310) mirrors "can create instance with connection.url" (Line 138). Consider removing the duplicates or differentiating them (e.g., asserting specific backward-compat behaviour rather than repeating the same existence checks).

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 80e3ebd and 1564153.

📒 Files selected for processing (2)
  • packages/drizzle/test/config.test.ts
  • packages/server/src/api/sandbox/create.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/server/src/api/sandbox/create.ts
🧰 Additional context used
📓 Path-based instructions (6)
packages/drizzle/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/drizzle/AGENTS.md)

packages/drizzle/**/*.{ts,tsx}: Use createPostgresDrizzle() factory function to create Drizzle ORM instances
Define schemas using Drizzle's pgTable and column types rather than other schema definition methods
Use full TypeScript support with schema inference from Drizzle ORM for type-safe queries
Use drizzleAdapter from better-auth when integrating with @agentuity/auth

Files:

  • packages/drizzle/test/config.test.ts
packages/drizzle/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (packages/drizzle/AGENTS.md)

Ensure tests run against a PostgreSQL instance and use @agentuity/test-utils for mocking

Files:

  • packages/drizzle/test/config.test.ts
**/*.{ts,tsx,js,jsx,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Use Prettier for code formatting with tabs (width 3), single quotes, and semicolons

Files:

  • packages/drizzle/test/config.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with ESNext target and bundler moduleResolution

Files:

  • packages/drizzle/test/config.test.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use StructuredError from @agentuity/core for error handling

Files:

  • packages/drizzle/test/config.test.ts
packages/*/test/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/*/test/**/*.{ts,tsx}: Place test files in test/ folder, never in src/ or __tests__/
Import from ../src/ in test files
Use @agentuity/test-utils for mocks in tests

Files:

  • packages/drizzle/test/config.test.ts
🧠 Learnings (1)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.

Applied to files:

  • packages/drizzle/test/config.test.ts
🧬 Code graph analysis (1)
packages/drizzle/test/config.test.ts (2)
packages/drizzle/src/types.ts (1)
  • PostgresDrizzleConfig (10-58)
packages/drizzle/src/postgres.ts (1)
  • createPostgresDrizzle (49-105)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: SDK Integration Test Suite
  • GitHub Check: Playwright E2E Smoke Test
  • GitHub Check: Template Integration Tests
  • GitHub Check: Framework Integration Tests (TanStack & Next.js)
  • GitHub Check: Sandbox CLI Tests
  • GitHub Check: Package Installation & Usage Test
  • GitHub Check: Build
  • GitHub Check: Cloud Deployment Tests
🔇 Additional comments (3)
packages/drizzle/test/config.test.ts (3)

232-251: Good fix — DATABASE_URL is now properly saved and restored.

The nested try/finally with explicit save/restore of process.env.DATABASE_URL makes this test deterministic regardless of the CI environment. Nice work addressing the earlier feedback.


1-11: File structure and imports look good.

Test file is correctly placed in packages/drizzle/test/, imports use ../src/ paths, and bun:test is used as the test runner. Aligns with the coding guidelines. As per coding guidelines, test files should be placed in test/ folder and import from ../src/.


14-108: Type-compatibility tests are a clean compile-time safety net.

The pattern of wrapping config construction in a function and asserting typeof is a pragmatic way to catch type regressions without needing a running database. These cover all the relevant config shapes well.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +112 to +123
it('can create instance with url', () => {
const { db, client, close } = createPostgresDrizzle({
url: 'postgres://localhost:5432/nonexistent_db',
});
try {
expect(db).toBeDefined();
expect(client).toBeDefined();
expect(typeof close).toBe('function');
} finally {
close();
}
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

close() returns a Promise but is never awaited.

close is async () => { await client.close(); } (see postgres.ts Lines 100-102). Dropping the promise in finally blocks means the underlying connection teardown may not complete before the next test starts, potentially leaking sockets or causing flaky interference between tests across the whole file.

Example fix (apply to all `finally` blocks in this file)
-		it('can create instance with url', () => {
+		it('can create instance with url', async () => {
 			const { db, client, close } = createPostgresDrizzle({
 				url: 'postgres://localhost:5432/nonexistent_db',
 			});
 			try {
 				expect(db).toBeDefined();
 				expect(client).toBeDefined();
 				expect(typeof close).toBe('function');
 			} finally {
-				close();
+				await close();
 			}
 		});
🤖 Prompt for AI Agents
In `@packages/drizzle/test/config.test.ts` around lines 112 - 123, The test calls
createPostgresDrizzle and invokes the returned close function in a finally block
but close is async (async () => { await client.close(); }), so the Promise is
dropped; update all finally blocks in this test file to await close() (e.g.,
change finally { close(); } to finally { await close(); }) and make the
surrounding test callback async so the await is valid; ensure the same change is
applied to every test in this file that calls close in a finally.

@jhaynie jhaynie merged commit aa40796 into main Feb 6, 2026
14 of 15 checks passed
@jhaynie jhaynie deleted the task/drizzle-config-887 branch February 6, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@agentuity/drizzle config?

1 participant