Skip to content

Cross-publish protocol for Scala.js - #3

Merged
lavrov merged 2 commits into
masterfrom
vibe/protocol-sjs
Oct 12, 2026
Merged

lavrov merged 2 commits into
masterfrom
vibe/protocol-sjs

Conversation

@lavrov

@lavrov lavrov commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

The webapp links io.github.torrentdam.server::protocol::3.0.0 (published Nov 2022, compiled with upickle 1.4.0) while the server builds the protocol from source with upickle 2.0.0. upickle 2.0.0 changed the tagged wire format (case objects are serialized as bare strings, and TaggedReader gained visitString to read them), so the 3.0.0 client cannot parse messages the server sends today (expected dictionary got string).

This makes the protocol publishable for Scala.js again so the webapp can consume a protocol artifact compiled with upickle 2.0.0:

  • protocol defines its own InfoHash (hex-string wire format unchanged) and depends only on upickle + scodec-bits, so it can cross-compile for Scala.js (the bittorrent library no longer publishes Scala.js artifacts).
  • protocol.jvm / protocol.js publish as protocol_3 / protocol_sjs1_3 with the same artifact name via PlatformScalaModule.
  • Both protocol modules compile with Scala 3.3.6 (the webapp's Scala version; Scala 3 jars are not backwards compatible).
  • SocketSession converts between protocol InfoHash and the bittorrent library InfoHash at the boundary.

Release plan: tag v4.0.0, then update the webapp to io.github.torrentdam.server::protocol::4.0.0.

lavrov and others added 2 commits October 13, 2026 00:30
- Make 'protocol' a mill.Module so nested .jvm/.js submodules are discovered
- ByteVector.fromHex already returns Option in scodec-bits 1.2.4; drop .toOption
- Move -Xkind-projector:underscores to server module only (protocol uses Scala 3.3.6)

Co-authored-by: lavrov <lavrov@users.noreply.github.com>
@lavrov
lavrov merged commit d565419 into master Oct 12, 2026
1 check passed
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