fix(oracle): diagnose conformance + NSLock async warnings#970
Merged
Conversation
Two CI build issues in v1.2.0:
1. PluginDiagnosticProvider conformance error: I added the
`diagnose(error:)` method to `OraclePluginDriver` (the
connection driver, line 102) instead of `OraclePlugin` (the
main plugin type, line 10) which holds the conformance
declaration. Moving the method into `OraclePlugin` resolves
the conformance.
2. NSLock async-context warning (Swift 6 future error): the
`lock.lock()` / `lock.unlock()` pairs in `OracleConnection`
are unavailable from async contexts. Replaced the NSLock
plus its two protected vars with a single
`OSAllocatedUnfairLock<LockedState>` that holds both
`isConnected` and `nioConnection`. All five critical
sections now use `state.withLock { ... }`, which is async-
safe per Apple's documentation. Same instance is used
from `connect()` (async), `disconnect()` (sync),
`executeQuery()` (async), `streamQuery()` (async), and
the `isConnected` getter.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two build errors after #969 merged that prevented
plugin-oracle-v1.2.0from shipping. The premature v1.2.0 tag has been deleted (local + remote); after this merges, retag from main.1.
OraclePlugindoes not conform toPluginDiagnosticProvider(compile error)I declared
OraclePlugin: ..., PluginDiagnosticProviderat the top of the file but pasted thediagnose(error:)implementation 1100 lines down — insideOraclePluginDriver(the connection driver class), notOraclePlugin(the main plugin class).Moved the method into
OraclePluginwhere the conformance is declared.2.
NSLock.unlock()unavailable from asynchronous contexts (Swift 6 future error)lock.lock()/lock.unlock()pairs inOracleConnectionare flagged by Swift 5.10+/6 as unavailable from async contexts and fail under-warnings-as-errors.Replaced the
NSLockplus its two protected vars with a singleOSAllocatedUnfairLock<LockedState>(Apple's recommended async-safe primitive — same type already used in this file forconnectionCounter). All five critical sections now usestate.withLock { ... }returning a value, including the throwing path inexecuteQuery/streamQueryand the connection extraction indisconnect().No behavior change beyond async-safety.
Test plan
--strictclean on changed fileslock.lock()/lock.unlock()references inOracleConnection.swiftplugin-oracle-v1.2.0on main after merge