feat: NativeConcurrency package trait — NIO/AsyncKit-free SQLiteKit#2
Draft
scottmarchant wants to merge 3 commits into
Draft
feat: NativeConcurrency package trait — NIO/AsyncKit-free SQLiteKit#2scottmarchant wants to merge 3 commits into
scottmarchant wants to merge 3 commits into
Conversation
…sm's pinned base), Embedded-only gating Replays the feat/swift-wasm-embedded-poc work (embedded SQLiteData encoder/decoder stubs, Codable row-decode gates, dynamic-cast-free version comparison) on top of the exact sqlite-kit revision khasm's Package.resolved pins (d6a7f12, feat/khasmPAL-2026) instead of the upstream-main base. The NIO-flavored gates become `#if hasFeature(Embedded)`; the khasmPAL NIOAsyncRuntime-based SQLiteConnectionSource is restored for regular WASI and gated out only on Embedded. NIO products + AsyncKit are dropped from the manifest only with KHASM_EMBEDDED=1; swift-nio/async-kit stay on the PassiveLogic fork URLs (NOT local path clones — transitive path deps override identities in the khasm root graph and the local swift-nio clone is not flavor-safe). sqlite-nio/sql-kit resolve to the local embedded clones. Prior upstream-main-based branch preserved as feat/swift-wasm-embedded-poc-upstream-base. Verified: embedded SDK build (KHASM_EMBEDDED=1) green; native green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add SwiftPM traits via a versioned Package@swift-6.1.swift, folding the former Package@swift-5.9.swift port manifest into it (two manifests total: the 5.8 base for old toolchains + the 6.1 traits manifest): - traits: `NIO` (default; SwiftNIO + AsyncKit exactly as today) and `NativeConcurrency` (NIO-free: no connection-pool source, async-only surface over sqlite-nio's NativeConcurrency driver). The NIO/AsyncKit products carry `.when(traits: ["NIO"])`; the KHASM_EMBEDDED env conditional is gone. The sqlite-nio and sql-kit edges forward `default`/`NativeConcurrency` conditionally on this package's own traits. - Source: NIO-swap gates re-keyed from `#if hasFeature(Embedded)` to `#if NativeConcurrency` (AsyncKit re-export, SQLiteConnectionSource whole-file, the SQLDatabase wrapper's eventLoop/future-execute/withSession). New for the (Foundation ∧ NativeConcurrency) combination: the Codable SQLiteDataDecoder's JSON blob fallback reads [UInt8] blobs, and the Codable encoder/decoder no longer import NIOCore/NIOFoundationCompat. Genuine Embedded language-limit gates (Codable coders' embedded stubs, UUID, `as? Self`, decode) stay on `hasFeature(Embedded)`. - Accepted loss under NativeConcurrency: no `ConnectionPoolSource`. Note: this commit keeps the branch-base remote URLs for PR-cuttability; the khasm-graph path wiring lands separately. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…om the fork's feat/native-concurrency-trait branches The trait-conditional dependency declarations enable NativeConcurrency on sqlite-nio and sql-kit, so the resolved revisions must declare that trait. Point both at the PassiveLogic fork branches carrying the trait manifests (sql-kit's upstream 3.33.1+ and the fork's feat/khasmPAL-2026 sqlite-nio branch declare no traits, which fails resolution under --traits). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Adds a
NativeConcurrencypackage trait to SQLiteKit: an opt-in, NIO/AsyncKit-free Swift-concurrency flavor.Package@swift-6.1.swift(versioned traits manifest): declaresNIO(member of the default trait set),NativeConcurrency, andFreestanding, and forwards the trait selection to the storage stack (sqlite-nio/sql-kittrait-conditional dependencies). Pre-6.1 toolchains never see this file and keep resolving the plainPackage.swift, so nothing changes for them.NIOstays the default trait: a consumer that specifies nothing gets the existing NIO/AsyncKit-based API (EventLoopGroup-drivenSQLiteConnectionSource,EventLoopFuturesurfaces), byte-identical to today.--traits NativeConcurrencyre-keys the sources (#if NativeConcurrency):SQLiteConnectionSource, the SQLKit bridging (SQLiteConnection+SQLKit), and the data encoder/decoder paths move onto plainasync/awaitwith no NIO or AsyncKit linkage.Why
Staged fork-internally ahead of a possible upstream proposal: it lets Swift-concurrency-native (and Embedded/WASI-leaning) consumers run the SQLite storage stack with zero NIO/EventLoopFuture surface while keeping one source tree, selected purely through SwiftPM package traits.
Verification
swift buildandswift testgreen — the default (NIO) trait build is unchanged behavior.swift build --traits NativeConcurrency: green, with noEventLoopFuture/NIO/AsyncKit surface in the flavor's API.Branch shape
Base is the fork's
feat/khasmPAL-2026at exactly the revision khasm pins. The head carries the one fork-internal Embedded-gating commit the trait conversion textually builds on (the embedded port rebased onto that base with Embedded-only gating), the trait conversion commit itself, and a follow-up build commit pointing the trait-forwardedsqlite-nio/sql-kitdependencies at the fork branches that actually declare theNativeConcurrencytrait (PassiveLogic/sqlite-nio#2, PassiveLogic/sql-kit#2) — required for standalone--traitsresolution, since the previously referenced revisions declare no traits.🤖 Generated with Claude Code