Skip to content

fix(oracle): diagnose conformance + NSLock async warnings#970

Merged
datlechin merged 1 commit intomainfrom
fix/oracle-build-errors
May 3, 2026
Merged

fix(oracle): diagnose conformance + NSLock async warnings#970
datlechin merged 1 commit intomainfrom
fix/oracle-build-errors

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

Two build errors after #969 merged that prevented plugin-oracle-v1.2.0 from shipping. The premature v1.2.0 tag has been deleted (local + remote); after this merges, retag from main.

1. OraclePlugin does not conform to PluginDiagnosticProvider (compile error)

I declared OraclePlugin: ..., PluginDiagnosticProvider at the top of the file but pasted the diagnose(error:) implementation 1100 lines down — inside OraclePluginDriver (the connection driver class), not OraclePlugin (the main plugin class).

Moved the method into OraclePlugin where the conformance is declared.

2. NSLock.unlock() unavailable from asynchronous contexts (Swift 6 future error)

lock.lock() / lock.unlock() pairs in OracleConnection are flagged by Swift 5.10+/6 as unavailable from async contexts and fail under -warnings-as-errors.

Replaced the NSLock plus its two protected vars with a single OSAllocatedUnfairLock<LockedState> (Apple's recommended async-safe primitive — same type already used in this file for connectionCounter). All five critical sections now use state.withLock { ... } returning a value, including the throwing path in executeQuery / streamQuery and the connection extraction in disconnect().

No behavior change beyond async-safety.

Test plan

  • SwiftLint --strict clean on changed files
  • No remaining lock.lock() / lock.unlock() references in OracleConnection.swift
  • CI build passes
  • Re-tag plugin-oracle-v1.2.0 on main after merge

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.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin datlechin changed the title fix(oracle): build errors in v1.2.0 — diagnose conformance + NSLock async warnings fix(oracle): diagnose conformance + NSLock async warnings May 3, 2026
@datlechin datlechin merged commit b4be6b7 into main May 3, 2026
2 checks passed
@datlechin datlechin deleted the fix/oracle-build-errors branch May 3, 2026 09:13
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