Skip to content

fix(data-source): export kotlinx-io as api — Source/Sink are in the public API - #1295

Open
michalharakal wants to merge 1 commit into
developfrom
fix/data-source-kotlinx-io-api
Open

michalharakal wants to merge 1 commit into
developfrom
fix/data-source-kotlinx-io-api

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

Found by dog-fooding: the cartridge blueprint materializer (SKaiNET-cartridge-blueprints#1) now fetches model sources through skainet-data-source (hf://, sha256, shared cache, offline policy) instead of its own downloader — the first consumer outside this repository.

Problem. DataSourceArtifact.openSource() / copyTo(), DataSourceRemoteContent and DataSourceArtifactStore expose kotlinx.io.Source / Sink, but kotlinx-io-core was an implementation dependency → runtime scope in the published POM. A consumer compiling against those functions gets Cannot access class 'kotlinx.io.Source' until it declares kotlinx-io itself.

Fix. api(libs.kotlinx.io.core) in commonMain. Generated JVM POM: kotlinx-io-core-jvm runtimecompile; Ktor and coroutines stay runtime.

Verified: :skainet-data:skainet-data-source:jvmTest green.

Also confirmed while testing (no change needed): the Ktor transport does not forward an Authorization header to another authority on redirect, so a Hugging Face token does not travel to the hub's CDN host; checksum validation happens before the cache commit, so a wrong pin does not poison the cache. One ergonomic note for later: DataSourceResolver is a plain interface — as a fun interface it would be easier to stub in consumers' tests.

…public API

DataSourceArtifact.openSource()/copyTo(), DataSourceRemoteContent and DataSourceArtifactStore expose
kotlinx.io.Source and Sink, but kotlinx-io was an implementation dependency (runtime scope in the
published POM). A consumer could not call those functions without declaring kotlinx-io itself:
"Cannot access class kotlinx.io.Source". Found by the first external JVM consumer, the cartridge
blueprint materializer plugin.
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.

2 participants