Fix PgClient makeClient missing error event handler - #7142
Conversation
🦋 Changeset detectedLatest commit: ad78b45 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Important
This PR currently advertises a fix in its title and changeset, but no source code in packages/sql/pg/src/PgClient.ts is changed. The added test is a placeholder that cannot fail, and pnpm lint fails on it.
Reviewed changes
- Added a changeset describing a
PgClienterror-handling fix. - Added an integration test for
makeClienterror-event handling.
⚠️ Fix is described but not implemented
The PR body correctly identifies the bug: makeClient creates a Pg.Client and calls client.connect() without an 'error' listener, and fromClient attaches a no-op function onError() {}. However, the diff only adds a changeset and a test — packages/sql/pg/src/PgClient.ts is untouched. The changeset therefore describes a source fix that does not exist.
⚠️ Placeholder test cannot catch the bug
packages/sql/pg/test/Client.integration.test.ts:466-480 only contains explanatory comments and Effect.void. It does not construct, connect, or observe a Pg.Client, so it will pass regardless of whether the bug is present. A regression test must actually fail before the fix and pass after it.
⚠️ Lint failure
pnpm lint fails with no-unused-expressions on the bare Effect.void statement in the new test.
@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏
9306ddd to
489359a
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Removed the placeholder integration test and the premature changeset.
- Added a focused regression test in
packages/sql/pg/test/Client.test.tsthat monkey-patchesPg.Client.prototype.connectto emit an'error'event during connection and asserts the error is handled.
The test fails on the current base (AssertionError: expected Error: connection failed to equal undefined), confirming it exercises the bug described in the PR body.
ℹ️ PR title scopes the change as a fix
The title says "Fix PgClient makeClient missing error event handler", but the diff and PR body are test-only. The body states this is intentional, so the only suggestion is to align the title with the actual scope (e.g., "Add regression test for PgClient makeClient missing error event handler") so reviewers are not surprised by the absence of a source fix.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|

Summary
pg.Clienterror listener beforePgClient.makeClientstarts connecting, and remove it during scoped release.@effect/sql-pg.Testing
EFFECT_INTEGRATION_TESTS=1 pnpm vitest --run packages/sql/pg/test/Client.integration.test.ts -t "PgClient.makeClient handles errors emitted while connecting"pnpm vitest --run --project @effect/sql-pgpnpm --filter @effect/sql-pg checkpnpm lintCloses EFF-570