From ec2106c699a01c216ac7f979edc91cb0d3e3545d Mon Sep 17 00:00:00 2001 From: phdoerfler Date: Sat, 11 Jul 2026 14:43:39 +0200 Subject: [PATCH 1/2] Pin forked test JVMs to UTC Datetime tests in the MSSQL suite (MovieSuite's `moviesShownBetween` and computed-field cases) fail on a developer machine in a non-UTC time zone, though they pass in CI. The MSSQL test codec encodes an OffsetDateTime argument via a zone-naive `java.sql.Timestamp`, and mssql-jdbc binds it into a DATETIMEOFFSET parameter using the ambient JVM time zone. On a UTC+2 host the filter bound shifts by two hours, admitting an extra row. Postgres is immune (native `Meta[OffsetDateTime]`); Oracle uses the same codec but ojdbc binds it without the shift; CI runs in UTC so it never surfaces there. --- build.sbt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build.sbt b/build.sbt index 98c3ef22..e6c423df 100644 --- a/build.sbt +++ b/build.sbt @@ -171,6 +171,13 @@ lazy val nativeSettings = Seq( ) ) +// Pin the forked test JVM to UTC: mssql-jdbc binds a zone-naive java.sql.Timestamp using the +// ambient JVM zone, so MSSQL datetime tests fail off-UTC unless pinned. Only meaningful where +// Test / fork := true. +lazy val utcTestSettings = Seq( + Test / javaOptions += "-Duser.timezone=UTC" +) + lazy val modules: List[CompositeProject] = List( core, circe, @@ -272,6 +279,7 @@ lazy val doobiecore = project .disablePlugins(RevolverPlugin) .dependsOn(sqlcore.jvm % "test->test;compile->compile", circe.jvm) .settings(commonSettings) + .settings(utcTestSettings) .settings( name := "grackle-doobie-core", Test / fork := true, @@ -291,6 +299,7 @@ lazy val doobiepg = project doobiecore % "test->test;compile->compile", sqlpg.jvm % "test->test;compile->compile") .settings(commonSettings) + .settings(utcTestSettings) .settings( name := "grackle-doobie-pg", Test / fork := true, @@ -310,6 +319,7 @@ lazy val doobieoracle = project .disablePlugins(RevolverPlugin) .dependsOn(doobiecore % "test->test;compile->compile") .settings(commonSettings) + .settings(utcTestSettings) .settings( name := "grackle-doobie-oracle", Test / fork := true, @@ -327,6 +337,7 @@ lazy val doobiemssql = project .disablePlugins(RevolverPlugin) .dependsOn(doobiecore % "test->test;compile->compile") .settings(commonSettings) + .settings(utcTestSettings) .settings( name := "grackle-doobie-mssql", Test / fork := true, @@ -354,6 +365,7 @@ lazy val skunk = crossProject(JVMPlatform, JSPlatform, NativePlatform) "org.typelevel" %% "log4cats-core" % log4catsVersion ) ) + .jvmSettings(utcTestSettings) .jvmSettings( Test / fork := true, Test / testOptions += Tests.Setup(_ => From 3e1806880ef7a64c5dd87c35079bb378bb4502f0 Mon Sep 17 00:00:00 2001 From: phdoerfler Date: Wed, 29 Jul 2026 01:15:52 +0200 Subject: [PATCH 2/2] Scope UTC test-JVM pin to doobie-mssql only Postgres and Oracle aren't affected by the zone-naive Timestamp binding this works around (Postgres uses a native OffsetDateTime codec; Oracle's driver doesn't shift), so pinning their forked test JVMs to UTC was unnecessary. Restrict the setting to doobiemssql, per review feedback, and inline it now that it has a single call site. --- build.sbt | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/build.sbt b/build.sbt index e6c423df..74678ed9 100644 --- a/build.sbt +++ b/build.sbt @@ -171,13 +171,6 @@ lazy val nativeSettings = Seq( ) ) -// Pin the forked test JVM to UTC: mssql-jdbc binds a zone-naive java.sql.Timestamp using the -// ambient JVM zone, so MSSQL datetime tests fail off-UTC unless pinned. Only meaningful where -// Test / fork := true. -lazy val utcTestSettings = Seq( - Test / javaOptions += "-Duser.timezone=UTC" -) - lazy val modules: List[CompositeProject] = List( core, circe, @@ -279,7 +272,6 @@ lazy val doobiecore = project .disablePlugins(RevolverPlugin) .dependsOn(sqlcore.jvm % "test->test;compile->compile", circe.jvm) .settings(commonSettings) - .settings(utcTestSettings) .settings( name := "grackle-doobie-core", Test / fork := true, @@ -299,7 +291,6 @@ lazy val doobiepg = project doobiecore % "test->test;compile->compile", sqlpg.jvm % "test->test;compile->compile") .settings(commonSettings) - .settings(utcTestSettings) .settings( name := "grackle-doobie-pg", Test / fork := true, @@ -319,7 +310,6 @@ lazy val doobieoracle = project .disablePlugins(RevolverPlugin) .dependsOn(doobiecore % "test->test;compile->compile") .settings(commonSettings) - .settings(utcTestSettings) .settings( name := "grackle-doobie-oracle", Test / fork := true, @@ -337,11 +327,13 @@ lazy val doobiemssql = project .disablePlugins(RevolverPlugin) .dependsOn(doobiecore % "test->test;compile->compile") .settings(commonSettings) - .settings(utcTestSettings) .settings( name := "grackle-doobie-mssql", Test / fork := true, Test / parallelExecution := false, + // mssql-jdbc binds a zone-naive java.sql.Timestamp using the ambient JVM zone, so MSSQL + // datetime tests fail off-UTC unless pinned. + Test / javaOptions += "-Duser.timezone=UTC", Test / testOptions += Tests .Setup(_ => runDocker("docker compose up -d --wait --quiet-pull mssql")), libraryDependencies ++= Seq( @@ -365,7 +357,6 @@ lazy val skunk = crossProject(JVMPlatform, JSPlatform, NativePlatform) "org.typelevel" %% "log4cats-core" % log4catsVersion ) ) - .jvmSettings(utcTestSettings) .jvmSettings( Test / fork := true, Test / testOptions += Tests.Setup(_ =>