Skip to content

fix(connections): unwrap optional session.driver in the metadata pool#1937

Merged
datlechin merged 1 commit into
mainfrom
fix/metadata-pool-optional-driver
Jul 21, 2026
Merged

fix(connections): unwrap optional session.driver in the metadata pool#1937
datlechin merged 1 commit into
mainfrom
fix/metadata-pool-optional-driver

Conversation

@datlechin

Copy link
Copy Markdown
Member

Problem

main does not compile after the PGlite PR (#1934). MetadataConnectionPool.acquireEntry uses session.driver (an optional DatabaseDriver?) as if it were non-optional:

guard session.driver.status == .connected else { throw DatabaseError.notConnected }
return Entry(driver: session.driver, ownsDriver: false)
error: Value of optional type '(any DatabaseDriver)?' must be unwrapped to refer to member 'status'
error: Value of optional type '(any DatabaseDriver)?' must be unwrapped to a value of type 'any DatabaseDriver'

Fix

Unwrap session.driver once with guard let, then use it for both the status check and the Entry. A session with no driver throws notConnected, matching the other paths in the pool.

Build fix only, no behavior change. #1934 is unreleased, so no CHANGELOG entry.

https://claude.ai/code/session_01FYwKEwKydeMG6WAHucMdY9

@datlechin
datlechin merged commit 8eb57f3 into main Jul 21, 2026
2 checks passed
@datlechin
datlechin deleted the fix/metadata-pool-optional-driver branch July 21, 2026 15:55
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.

1 participant