Baton

Reference

The two runtimes, one map

A file per concept in the Swift and the Kotlin tree, checked by the boundary script.

The Swift and the Kotlin runtimes are one machine written twice (the decision): the same concepts, the same mechanisms, the same fixtures under spec/. A reader moving between them finds a mechanism under the same file name in both trees, and this map is where that is checked: scripts/check-boundaries.sh fails when a file named here is missing from its tree, or when a runtime source file is not on the map. A row is a concept or a mechanism of the vocabulary; a cell names the files that hold it. Swift's files are under swift/Sources/Baton/; Kotlin's under kotlin/baton/src/commonMain/kotlin/baton/, with a platform's actuals named by their source set.

Concept or mechanismSwiftKotlin
The store: records by key, batches, layers, the commitStore.swiftStore.kt
Records and valuesRecord.swift, Value.swiftRecord.kt, Value.kt
Scalars as the store keeps them: text, and a double's digitsScalars.swiftText.kt, jvmSharedMain/Doubles.jvmShared.kt, jvmMain/Doubles.jvm.kt, androidMain/Doubles.android.kt
The ingest: scanner, cursor, change setIngest.swift, Cursor.swift, ChangeSet.swiftIngest.kt, Cursor.kt, ChangeSet.kt, Bytes.kt, jvmSharedMain/Bytes.jvmShared.kt
The plan, and the format the generated code namesPlan.swiftPlan.kt, Generated.kt, Markers.kt
Resolution: a plan for one set of variablesResolution.swiftResolution.kt
Membership: which types satisfy which abstract typeMembership.swiftMembership.kt
Lenses and ownersLens.swift, Owner.swiftLens.kt, Owner.kt
Keys and the registryKeys.swift, Registry.swiftKeys.kt, Registry.kt
Connections: the merge of a page, the edge directives' editsConnections.swiftConnections.kt
Roots, the verdict, retention, collectionRoots.swiftRoots.kt
Operation values, policies, the phaseOperation.swiftOperation.kt
The handleHandle.swiftHandle.kt
The subscriptionSubscription.swiftSubscription.kt
The availability checkAvailability.swiftAvailability.kt
Hydration from the image, and the rows decoded aheadHydration.swift; the adoption in Availability.swift, the decoding in Persistence.swiftHydration.kt; nothing is decoded ahead
The environment, the one doorEnvironment.swiftEnvironment.kt
Transports, framing, payloadsTransport.swift, Payload.swiftTransport.kt, Framing.kt, Payload.kt, GraphQLTransportWebSocket.kt, jvmSharedMain/HttpTransport.kt, jvmMain/JdkWebSocketClient.kt
Delivery of payloads to handlesDelivery.swiftDelivery.kt
The image: persistence, the disk, the row codecPersistence.swift, Disk.swift, Row.swiftPersistence.kt, Disk.kt, Row.kt, Image.kt, jvmSharedMain/Image.jvmShared.kt, jvmMain/Image.jvm.kt, androidMain/Image.android.kt
The host's observationSwiftUI.swift, Macros.swiftCompose.kt
Threadsthe main actor and the ingest's actor, in the files aboveThreads.kt, jvmSharedMain/Threads.jvmShared.kt
Log and errorsLog.swift, Errors.swiftLog.kt, Errors.kt
Inspection: the store as spec/ freezes itthe BatonInspector productDump.kt

What differs is the host and the platform: Swift observes through Observation and the macros, Kotlin through Compose's snapshot state; Swift's threads are actors, Kotlin's are dispatchers and a lock; the image sits on the system's SQLite in Swift and on the AndroidX driver in Kotlin; the socket is the platform's in Swift and, in Kotlin, the JVM's own or the one an app brings through the baton-okhttp edge, the protocol over it being the runtime's in both. A mechanism in one tree and not the other is a gap, listed in the changelog until it closes.