Skip to content

kebs 3: Scala 3.9, ValueClassLike on hearth, testkit + golden tests - #617

Open
luksow wants to merge 10 commits into
masterfrom
kebs-3/build-core
Open

luksow wants to merge 10 commits into
masterfrom
kebs-3/build-core

Conversation

@luksow

@luksow luksow commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

First PR of the kebs 3 rewrite: macros on hearth / kindlings, Scala 2.13 + 3.9, one implementation per macro. kebs 2.x continues on series/2.x (cut at v2.3.0).

What changes

  • Build: Scala 2.13.18 + 3.9.0 (LTS), CI on JDK 17 + 21, tlBaseVersion 3.0, MiMa off for 3.0.0, -Xkind-projector, -Xsource:3 on 2.13.
  • doobie 1.0.0-RC14 (organisation org.typelevel, package org.typelevel.doobie) and scala-java-time 2.11.0 (both need the new Scala 3 floor).
  • akka-http dropped — use kebs-pekko-http; docs page renamed to pekko-http.md.
  • ValueClassLike on hearth: one shared macro for 2.13 and 3 (thin per-version entry points). Values are built through the companion apply, so validating/normalising applys now apply on Scala 3 too (kebs 2 used Mirror.fromProduct there). On Scala 3, types the macro cannot build or read (private/protected constructor, private field) fall back to the Mirror, as in kebs 2 — the implicit never fails after the Mirror guard selected it.
  • kebs-testkit (test-only, unpublished cross-project) with shared models, and golden tests pinning the kebs 2.x JSON of circe (12), spray-json (12) and play-json (7). They were verified against v2.3.0 (old macros, 2.13.18 and 3.3.9) before being used to check the new code.

Verification

  • All JVM + JS tests green on 2.13.18 and 3.9.0; Native compile-checked locally (Native tests run here in CI).
  • docs/mdoc builds.
  • A fresh whole-branch review found a Scala 3 regression for private-constructor value classes; fixed in 691c9b8 with selection tests and goldens.

Behaviour changes to note in the 3.0 migration guide

  • Scala 3 floor 3.9, JDK 17+.
  • Validating companion apply is now honoured by ValueClassLike on Scala 3 (decoding values that fail it now fails instead of bypassing it).
  • doobie package relocation; akka-http module removed.

Known follow-ups (deferred review minors)

-Wconf:cat=scala3-migration:s could be :w; constructor fallback visibility (Everywhere vs AtCallSite); hearth's "not a case class" reason is not surfaced; an apply(F) returning non-T is skipped; circe/play goldens compare structurally (field order not pinned); Akka still mentioned in website/src and .scala-steward.conf; kebs-core on 2.13 brings scala-compiler via hearth (release note). The examples project was already broken before this PR and is not built in CI.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DFD5QTj91bQhcjiNo9n48K

luksow and others added 8 commits November 21, 2026 10:18
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DFD5QTj91bQhcjiNo9n48K
Also scala-java-time 2.11.0 (built with Scala 3.9) and -Xkind-projector
(-Ykind-projector is deprecated on Scala 3.9).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DFD5QTj91bQhcjiNo9n48K
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DFD5QTj91bQhcjiNo9n48K
…ons)

One shared hearth implementation for 2.13 and 3.9. Values are built through
the companion's apply, so validating/normalising apply methods now apply on
Scala 3 too (kebs 2 used Mirror.fromProduct there, which bypassed them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DFD5QTj91bQhcjiNo9n48K
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DFD5QTj91bQhcjiNo9n48K
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DFD5QTj91bQhcjiNo9n48K
A Scala 3 Mirror exists for single-field case classes with a private or
protected constructor or a private field. The macro used to abort after the
Mirror guard had selected the implicit - a hard compile error, or inside
circe's inline derivation a silent switch from flat to object JSON. It now
falls back to Mirror.fromProduct / productElement for what hearth cannot
build or read (kebs 2's Scala 3 behaviour); the companion apply is still
tried first. Scala 2 keeps aborting silently (no instance).

Adds selection tests that tell 'no instance' from 'hard error', and
private-constructor value-class goldens for circe, spray-json and play-json
(captured against v2.3.0 on 2.13.18 and 3.3.9).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DFD5QTj91bQhcjiNo9n48K
@mergify

mergify Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

This branch has not been deployed

No deployments
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