From 52f5c9fcf1d66a64bad46f8af1ae29011357cf5e Mon Sep 17 00:00:00 2001 From: Pierre Ricadat Date: Thu, 21 May 2026 11:15:11 +0900 Subject: [PATCH 1/2] Drop Scala 2 cross-build, target Scala 3 only - Remove scala212/scala213 from build matrix; keep scala3 = 3.3.7 - Drop crossScalaVersions and Scala 2 scalacOptions branches - Switch scalafmt dialect to scala3 (drop scala-3 fileOverride) - Update CI matrix to scala 3.3.7 / adoptium:21; bump publish JVM to 21 Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 6 +++--- .scalafmt.conf | 8 +------ build.sbt | 46 ++++++---------------------------------- 3 files changed, 11 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb7bc03c..f3f42419 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,8 +32,8 @@ jobs: strategy: fail-fast: false matrix: - java: ['adoptium:17'] - scala: ['2.12.21', '2.13.18', '3.3.7'] + java: ['adoptium:21'] + scala: ['3.3.7'] steps: - name: Checkout current branch uses: actions/checkout@v6 @@ -61,7 +61,7 @@ jobs: - name: Setup Scala and Java uses: coursier/setup-action@v3 with: - jvm: adoptium:17 + jvm: adoptium:21 apps: sbt - name: Cache scala dependencies uses: coursier/cache-action@v8 diff --git a/.scalafmt.conf b/.scalafmt.conf index 8bfd2c77..201abc09 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,6 +1,6 @@ version = "3.1.2" -runner.dialect = scala213 +runner.dialect = scala3 maxColumn = 120 align.preset = most continuationIndent.defnSite = 2 @@ -16,9 +16,3 @@ spaces { optIn.annotationNewlines = true rewrite.rules = [SortImports, RedundantBraces] - -fileOverride { - "glob:**/scala-3/**" { - runner.dialect = scala3 - } -} \ No newline at end of file diff --git a/build.sbt b/build.sbt index 15c95d2a..30a9ba78 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,4 @@ -val scala212 = "2.12.21" -val scala213 = "2.13.18" -val scala3 = "3.3.7" -val allScala = Seq(scala212, scala213, scala3) +val scala3 = "3.3.7" val zioVersion = "2.1.24" val zioGrpcVersion = "0.6.3" @@ -21,9 +18,8 @@ val scalaCompatVersion = "2.13.0" inThisBuild( List( - scalaVersion := scala213, - crossScalaVersions := allScala, - organization := "com.devsisters", + scalaVersion := scala3, + organization := "com.devsisters", homepage := Some(url("https://devsisters.github.io/shardcake/")), licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")), scmInfo := Some( @@ -50,7 +46,6 @@ addCommandAlias("check", "all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck" lazy val root = project .in(file(".")) .settings(publish / skip := true) - .settings(crossScalaVersions := Nil) .aggregate( core, manager, @@ -228,35 +223,8 @@ lazy val commonSettings = Def.settings( "-language:existentials", "-unchecked", "-Xfatal-warnings", - "-language:postfixOps" - ) ++ (CrossVersion.partialVersion(scalaVersion.value) match { - case Some((2, 12)) => - Seq( - "-Xsource:2.13", - "-Yno-adapted-args", - "-Ypartial-unification", - "-Ywarn-extra-implicit", - "-Ywarn-inaccessible", - "-Ywarn-infer-any", - "-Ywarn-unused:-nowarn", - "-Ywarn-nullary-override", - "-Ywarn-nullary-unit", - "-opt-inline-from:", - "-opt-warnings", - "-opt:l:inline", - "-explaintypes" - ) - case Some((2, 13)) => - Seq( - "-Xlint:-byname-implicit", - "-explaintypes" - ) - - case Some((3, _)) => - Seq( - "-explain-types", - "-Ykind-projector" - ) - case _ => Nil - }) + "-language:postfixOps", + "-explain-types", + "-Ykind-projector" + ) ) From f57ec9bc905c8056dbe9f1415ff189fc318619c0 Mon Sep 17 00:00:00 2001 From: Pierre Ricadat Date: Thu, 21 May 2026 11:17:34 +0900 Subject: [PATCH 2/2] Apply scalafmt under scala3 dialect build.sbt alignment cleanup + ShardManager reformatting that the scala3 dialect picks up but the old scala213 dialect tolerated. Co-Authored-By: Claude Opus 4.7 (1M context) --- build.sbt | 8 ++++---- .../scala/com/devsisters/shardcake/ShardManager.scala | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index 30a9ba78..a4e5dc0c 100644 --- a/build.sbt +++ b/build.sbt @@ -20,15 +20,15 @@ inThisBuild( List( scalaVersion := scala3, organization := "com.devsisters", - homepage := Some(url("https://devsisters.github.io/shardcake/")), - licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")), - scmInfo := Some( + homepage := Some(url("https://devsisters.github.io/shardcake/")), + licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")), + scmInfo := Some( ScmInfo( url("https://github.com/devsisters/shardcake"), "scm:git:git@github.com:devsisters/shardcake.git" ) ), - developers := List( + developers := List( Developer( "ghostdogpr", "Pierre Ricadat", diff --git a/manager/src/main/scala/com/devsisters/shardcake/ShardManager.scala b/manager/src/main/scala/com/devsisters/shardcake/ShardManager.scala index 0e0c68e9..0a36957a 100644 --- a/manager/src/main/scala/com/devsisters/shardcake/ShardManager.scala +++ b/manager/src/main/scala/com/devsisters/shardcake/ShardManager.scala @@ -499,15 +499,13 @@ object ShardManager { case Some((podAddress, shards)) => val oldPodAddress = state.shards.get(shard).flatten // if old pod is same as new pod, don't change anything - if (oldPodAddress.contains(podAddress)) - (shardsPerPod, assignments) + if (oldPodAddress.contains(podAddress)) (shardsPerPod, assignments) // if the new pod has more, as much, or only 1 less shard than the old pod, don't change anything else if ( shardsPerPod.get(podAddress).fold(0)(_.size) + 1 >= oldPodAddress.fold(Int.MaxValue)( shardsPerPod.getOrElse(_, Nil).size ) - ) - (shardsPerPod, assignments) + ) (shardsPerPod, assignments) // otherwise, create a new assignment else { val unassigned =