Skip to content

clock: Inara modules that need a clock require the ClockModule - #127

Merged
rocketraman merged 1 commit into
masterfrom
rg/inara-clock-module
Nov 26, 2026
Merged

rocketraman merged 1 commit into
masterfrom
rg/inara-clock-module

Conversation

@rocketraman

Copy link
Copy Markdown
Owner

Summary

The Inara modules that need a clock now require boot-clock's ClockModule, instead of taking a clock as a builder parameter:

  • PeriodicModule (boot-periodic)
  • KubernetesLeaderElectionModule (boot-leader-k8s)
  • DbSchedulerModule (boot-scheduler-db)
  • OpenTelemetryModule and ServiceStartTracingModule (boot-telemetry-otel)

Their builders, such as periodicModule(), lose their clock parameter, and each of these projects' Inara flavor depends on boot-clock's Inara flavor (published as boot-clock-inara).

An application chooses its clock once, by composing clockModule(), and a test replaces it once, with clockModule(testClock). That matches the Koin and Metro flavors, whose modules already read one shared Clock binding.

Before, an application passed its clock to each builder, and a builder it missed silently used Clock.System. Now, leaving out the ClockModule is a compile error. Applications that compose none of these modules don't need boot-clock.

@DIModule(composed = true)
interface AppModule : ConfigModule, BootableModule, ClockModule, OpenTelemetryModule, PeriodicModule, ...

fun appModule(clockModule: ClockModule = clockModule()) = AppModule(
  clockModule = clockModule,
  openTelemetryModule = openTelemetryModule(),
  periodicModule = periodicModule(),
  ...
)

This changes the Inara builders' signatures. The Inara flavor is unreleased (3.1.0).

Other changes

  • The tests' composed Inara modules, the Inara doc snippets and the Inara example compose the ClockModule.
  • The tests that checked a given clock now pass it through clockModule(clock).
  • ClockWiringTest picks the Kodein and Inara clockModule by typed references: they have the same name and signature.
  • The Inara testing snippet's SessionsModule requires the ClockModule too, so its test sets one clock for the SDK and the sessions.
  • The Clock, Testing, Telemetry and Periodic docs pages say the Inara modules take their clock from the ClockModule.
  • The Inara ClockModule's KDoc says the Bootable modules that need a clock require it.
  • The CHANGELOG notes the change.

Test plan

  • ./gradlew build

The Inara PeriodicModule, KubernetesLeaderElectionModule,
DbSchedulerModule, OpenTelemetryModule and ServiceStartTracingModule
require boot-clock's ClockModule, and their builders lose their clock
parameter. An application chooses its clock once, with clockModule(),
and a test replaces it once, with clockModule(testClock), as the Koin
and Metro flavors already do with their shared Clock binding. A module
that needs a clock no longer falls back to Clock.System when the
application forgets to pass its clock: leaving out the ClockModule
doesn't compile.

The tests, the Inara doc snippets and the Inara example compose the
ClockModule, and the docs say where the Inara modules take their clock.
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.2
Preview removed because the pull request was closed.
2026-11-26 14:40 UTC

@rocketraman
rocketraman merged commit eacc54e into master Nov 26, 2026
3 checks passed
@rocketraman
rocketraman deleted the rg/inara-clock-module branch November 26, 2026 14:46
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