Skip to content

refactor(jvm)!: move session contracts into the engine-neutral runtime - #335

Merged
oglassdev merged 2 commits into
feat/session-primitivesfrom
feat/neutral-session-contracts
Oct 6, 2026
Merged

oglassdev merged 2 commits into
feat/session-primitivesfrom
feat/neutral-session-contracts

Conversation

@oglassdev

Copy link
Copy Markdown
Contributor

Stacked on #334.

Summary

Generated code and the Gradle plugin no longer target any engine types, so the session, method and component machinery works for any host, not just multistom.

  • Contracts in jvm/runtime (com.chunkzero.chunk.runtime): SessionProvider<S>, ConfiguredSessionProvider<C, S>, SessionCreation<C>, SessionMethodBinding<S, A, R>, SessionMethodProvider, ComponentBinding, ComponentProvider.
  • Engine-neutral registries: SessionRegistry (loads providers, decodes configs), SessionMethodRegistry and ComponentRegistry. An app on upstream Minestom can use them from its own SessionHandler.
  • @Component.Supplied: hosts mark the types they hand to session-scoped component factories. The plugin reads the marker from bytecode instead of hard-coding multistom's SessionScope; BackendSession stays built in.
  • multistom uses the runtime contracts, supplies SessionScope and BackendSession, and fails a session's creation if its provider doesn't create a multistom Session.
  • Codegen: configured provider interfaces are generic over the session type. Apps write implements ArenaSessionProviders.Koth<ArenaSession>, and plain providers implement SessionProvider<LobbySession>. Session method adapters are typed (new SessionMethodBinding<>(REF, ArenaSession.class, (session, args) -> session.status(args))).
  • Release analysis and check-consumers.py read the com.chunkzero.chunk.runtime.* service files.

Breaking changes

  • Providers declare their session type: SessionProvider<S> / XSessionProviders.Y<S>.
  • Contract imports move from com.chunkzero.chunk.multistom to com.chunkzero.chunk.runtime.
  • Apps must be rebuilt with the matching chunk CLI and Gradle plugin, since the service file names changed.

Notes

  • The plugin no longer checks at build time that a session is a multistom Session. multistom checks it when creating each session.
  • The plugin still adds multistom; the next PR in the stack reworks that.

Validation

  • ./gradlew :jvm:runtime:test :jvm:multistom:test :jvm:multistom-kotlin:test :jvm:minestom:test
  • jvm/gradle-plugin tests
  • cargo test -p chunk-build (codegen, release)
  • examples/{local,arena,load} testClasses with a rebuilt CLI, plus CoinCommandTest
  • just fmt-check

🤖 Generated with Claude Code

SessionProvider<S>, ConfiguredSessionProvider<C, S>, SessionCreation,
SessionMethodBinding<S, A, R>, the component bindings and the session, method
and component registries now live in com.chunkzero.chunk.runtime, so generated
code and the Gradle plugin target no engine types. Hosts mark the types they
hand to session components with @Component.Supplied; multistom supplies
SessionScope and requires its sessions to be multistom Sessions.
@oglassdev
oglassdev added this pull request to stack #338 October 6, 2026 03:54
@oglassdev
oglassdev merged commit e33c8b2 into main Oct 6, 2026
13 checks passed
@oglassdev
oglassdev deleted the feat/neutral-session-contracts branch October 12, 2026 23:25
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