This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/main/pr-9599-95e2748b97e0cdd29069971fe74349ac5f28134b
in repository https://gitbox.apache.org/repos/asf/texera.git

commit cd5e257ba5f4cc9363a60cb5a99e82d0174fd9d6
Author: Xinyuan Lin <[email protected]>
AuthorDate: Mon Nov 23 12:35:08 2026 +0000

    test(service): remove unused spec mixins and test defaults (#9599)
    
    ### What changes were proposed in this PR?
    
    Remove unused ScalaTest mixin traits and unused private test-helper
    defaults across 7 test files in `access-control-service`,
    `file-service`, and `workflow-compiling-service` without changing
    production code or test assertions:
    
    - **Unused `BeforeAndAfterEach` mixin (`access-control-service`,
    `file-service`):** Remove the unused `BeforeAndAfterEach` trait and
    import in `AccessControlResourceSpec`, `ModelApiForUiSpec`,
    `ModelDownloadResourceSpec`, `ModelResourceSpec`, and
    `ModelUploadResourceSpec`, which define no per-test hooks.
    - **Unused `OptionValues` mixin (`file-service`):** Remove the unused
    `OptionValues` trait and import in `ModelHubApiSpec`.
    - **Unused defaults and dead helper (`workflow-compiling-service`):** In
    test utility `ConfigGenerator`, remove 12 unused default parameter
    values on private helper methods, the 3 unused field defaults on the
    private `FillContext` case class (both of its constructor calls pass
    every field), the scaladoc `FillContext` had copied from
    `requiredUnder`, and the unreferenced private `noSiblings` helper.
    
    ### Any related issues, documentation, discussions?
    
    Closes #9598.
    
    ### How was this PR tested?
    
    Ran on `906cd73fd1` (JDK 17.0.14, `sbt 1.12.9`,
    `STORAGE_ICEBERG_CATALOG_TYPE=hadoop`, Docker running for `FileService`
    `MockLakeFS` specs):
    
    ```bash
    sbt --batch \
      "AccessControlService/scalafmtCheckAll" \
      "FileService/scalafmtCheckAll" \
      "WorkflowCompilingService/scalafmtCheckAll" \
      "AccessControlService/scalafixAll --check" \
      "FileService/scalafixAll --check" \
      "WorkflowCompilingService/scalafixAll --check" \
      "AccessControlService/testOnly 
org.apache.texera.AccessControlResourceSpec" \
      "FileService/testOnly 
org.apache.texera.service.resource.ModelApiForUiSpec 
org.apache.texera.service.resource.ModelDownloadResourceSpec 
org.apache.texera.service.resource.ModelHubApiSpec 
org.apache.texera.service.resource.ModelResourceSpec 
org.apache.texera.service.resource.ModelUploadResourceSpec" \
      "WorkflowCompilingService/testOnly 
org.apache.texera.amber.translator.verify.ConfigGeneratorSpec 
org.apache.texera.amber.translator.verify.CanonicalFixtureSpec 
org.apache.texera.service.resource.WorkflowCompilationResourceSpec"
    ```
    
    - `scalafmtCheckAll` and `scalafixAll --check` across
    `AccessControlService`, `FileService`, and `WorkflowCompilingService`:
    passed.
    - `AccessControlService`: `1` suite, `44` passed (`0` failed, `0`
    skipped).
    - `FileService`: `5` suites, `117` passed (`0` failed, `0` skipped).
    - `WorkflowCompilingService`: `3` suites, `52` passed (`0` failed, `0`
    skipped).
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    Generated-by: Antigravity (Gemini 4 Neon), Claude Code (Claude Opus 5.5)
---
 .../apache/texera/AccessControlResourceSpec.scala  |  3 +-
 .../service/resource/ModelApiForUiSpec.scala       |  3 +-
 .../resource/ModelDownloadResourceSpec.scala       |  3 +-
 .../texera/service/resource/ModelHubApiSpec.scala  |  3 +-
 .../service/resource/ModelResourceSpec.scala       |  5 ++-
 .../service/resource/ModelUploadResourceSpec.scala |  3 +-
 .../amber/translator/verify/ConfigGenerator.scala  | 40 ++++++++--------------
 7 files changed, 22 insertions(+), 38 deletions(-)

diff --git 
a/access-control-service/src/test/scala/org/apache/texera/AccessControlResourceSpec.scala
 
b/access-control-service/src/test/scala/org/apache/texera/AccessControlResourceSpec.scala
index 2892a6026a..6c19ae6bf7 100644
--- 
a/access-control-service/src/test/scala/org/apache/texera/AccessControlResourceSpec.scala
+++ 
b/access-control-service/src/test/scala/org/apache/texera/AccessControlResourceSpec.scala
@@ -42,7 +42,7 @@ import 
org.apache.texera.service.resource.AccessControlResource
 import org.mockito.Mockito._
 import org.scalatest.flatspec.AnyFlatSpec
 import org.scalatest.matchers.should.Matchers
-import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
+import org.scalatest.BeforeAndAfterAll
 
 import java.net.{URI, URLEncoder}
 import java.nio.charset.StandardCharsets
@@ -52,7 +52,6 @@ class AccessControlResourceSpec
     extends AnyFlatSpec
     with Matchers
     with BeforeAndAfterAll
-    with BeforeAndAfterEach
     with MockTexeraDB {
 
   private val testURI: String = "http://localhost:8080/";
diff --git 
a/file-service/src/test/scala/org/apache/texera/service/resource/ModelApiForUiSpec.scala
 
b/file-service/src/test/scala/org/apache/texera/service/resource/ModelApiForUiSpec.scala
index 13742b0014..b3821bfbe3 100644
--- 
a/file-service/src/test/scala/org/apache/texera/service/resource/ModelApiForUiSpec.scala
+++ 
b/file-service/src/test/scala/org/apache/texera/service/resource/ModelApiForUiSpec.scala
@@ -30,7 +30,7 @@ import org.apache.texera.service.MockLakeFS
 import org.apache.texera.service.`type`.{ExistingUploadFile, 
ExistingUploadFilesRequest}
 import org.scalatest.flatspec.AnyFlatSpec
 import org.scalatest.matchers.should.Matchers
-import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
+import org.scalatest.BeforeAndAfterAll
 
 import java.io.ByteArrayInputStream
 import scala.jdk.CollectionConverters._
@@ -45,7 +45,6 @@ class ModelApiForUiSpec
     with MockTexeraDB
     with MockLakeFS
     with BeforeAndAfterAll
-    with BeforeAndAfterEach
     with ResourceTestHelpers {
 
   private def mkUser(name: String): User = {
diff --git 
a/file-service/src/test/scala/org/apache/texera/service/resource/ModelDownloadResourceSpec.scala
 
b/file-service/src/test/scala/org/apache/texera/service/resource/ModelDownloadResourceSpec.scala
index 758c54306f..a8d9238a5a 100644
--- 
a/file-service/src/test/scala/org/apache/texera/service/resource/ModelDownloadResourceSpec.scala
+++ 
b/file-service/src/test/scala/org/apache/texera/service/resource/ModelDownloadResourceSpec.scala
@@ -29,7 +29,7 @@ import org.apache.texera.dao.jooq.generated.tables.pojos.User
 import org.apache.texera.service.MockLakeFS
 import org.scalatest.flatspec.AnyFlatSpec
 import org.scalatest.matchers.should.Matchers
-import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
+import org.scalatest.BeforeAndAfterAll
 
 import java.io.{ByteArrayInputStream, ByteArrayOutputStream}
 import java.util.zip.ZipInputStream
@@ -42,7 +42,6 @@ class ModelDownloadResourceSpec
     with MockTexeraDB
     with MockLakeFS
     with BeforeAndAfterAll
-    with BeforeAndAfterEach
     with ResourceTestHelpers {
 
   private def mkUser(name: String): User = {
diff --git 
a/file-service/src/test/scala/org/apache/texera/service/resource/ModelHubApiSpec.scala
 
b/file-service/src/test/scala/org/apache/texera/service/resource/ModelHubApiSpec.scala
index 8e999f045f..f08f5339f6 100644
--- 
a/file-service/src/test/scala/org/apache/texera/service/resource/ModelHubApiSpec.scala
+++ 
b/file-service/src/test/scala/org/apache/texera/service/resource/ModelHubApiSpec.scala
@@ -30,7 +30,7 @@ import org.apache.texera.service.MockLakeFS
 import org.apache.texera.service.util.CoverImageUtils
 import org.scalatest.flatspec.AnyFlatSpec
 import org.scalatest.matchers.should.Matchers
-import org.scalatest.{BeforeAndAfterAll, OptionValues}
+import org.scalatest.BeforeAndAfterAll
 
 import java.io.ByteArrayInputStream
 import java.util.Optional
@@ -40,7 +40,6 @@ import java.util.Optional
 class ModelHubApiSpec
     extends AnyFlatSpec
     with Matchers
-    with OptionValues
     with MockTexeraDB
     with MockLakeFS
     with BeforeAndAfterAll
diff --git 
a/file-service/src/test/scala/org/apache/texera/service/resource/ModelResourceSpec.scala
 
b/file-service/src/test/scala/org/apache/texera/service/resource/ModelResourceSpec.scala
index 01147f234e..eaa6b2395c 100644
--- 
a/file-service/src/test/scala/org/apache/texera/service/resource/ModelResourceSpec.scala
+++ 
b/file-service/src/test/scala/org/apache/texera/service/resource/ModelResourceSpec.scala
@@ -28,15 +28,14 @@ import 
org.apache.texera.dao.jooq.generated.tables.pojos.{Model, User}
 import org.apache.texera.service.MockLakeFS
 import org.scalatest.flatspec.AnyFlatSpec
 import org.scalatest.matchers.should.Matchers
-import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
+import org.scalatest.BeforeAndAfterAll
 
 class ModelResourceSpec
     extends AnyFlatSpec
     with Matchers
     with MockTexeraDB
     with MockLakeFS
-    with BeforeAndAfterAll
-    with BeforeAndAfterEach {
+    with BeforeAndAfterAll {
 
   private val ownerUser: User = {
     val user = new User
diff --git 
a/file-service/src/test/scala/org/apache/texera/service/resource/ModelUploadResourceSpec.scala
 
b/file-service/src/test/scala/org/apache/texera/service/resource/ModelUploadResourceSpec.scala
index 70bfc0d0d3..be8b97d190 100644
--- 
a/file-service/src/test/scala/org/apache/texera/service/resource/ModelUploadResourceSpec.scala
+++ 
b/file-service/src/test/scala/org/apache/texera/service/resource/ModelUploadResourceSpec.scala
@@ -30,7 +30,7 @@ import org.apache.texera.service.MockLakeFS
 import org.apache.texera.service.`type`.LakeFSFileNode
 import org.scalatest.flatspec.AnyFlatSpec
 import org.scalatest.matchers.should.Matchers
-import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
+import org.scalatest.BeforeAndAfterAll
 
 import java.io.ByteArrayInputStream
 import java.nio.charset.StandardCharsets
@@ -42,7 +42,6 @@ class ModelUploadResourceSpec
     with MockTexeraDB
     with MockLakeFS
     with BeforeAndAfterAll
-    with BeforeAndAfterEach
     with ResourceTestHelpers {
 
   private val ownerUser: User = {
diff --git 
a/workflow-compiling-service/src/test/scala/org/apache/texera/amber/translator/verify/ConfigGenerator.scala
 
b/workflow-compiling-service/src/test/scala/org/apache/texera/amber/translator/verify/ConfigGenerator.scala
index fe9ca6fae3..327aabbf70 100644
--- 
a/workflow-compiling-service/src/test/scala/org/apache/texera/amber/translator/verify/ConfigGenerator.scala
+++ 
b/workflow-compiling-service/src/test/scala/org/apache/texera/amber/translator/verify/ConfigGenerator.scala
@@ -255,7 +255,7 @@ object ConfigGenerator {
       schemas: Map[Int, Schema],
       used: mutable.Set[(Int, String)],
       rowCount: Int,
-      switches: Map[String, JsonNode] = Map.empty
+      switches: Map[String, JsonNode]
   ): Seq[Variant] =
     Seq(
       merged(
@@ -1082,8 +1082,8 @@ object ConfigGenerator {
   private def enumVariants(
       opClass: Class[_ <: LogicalOp],
       baseNode: ObjectNode,
-      pinned: Set[String] = Set.empty,
-      fill: FillContext = FillContext()
+      pinned: Set[String],
+      fill: FillContext
   ): Seq[Variant] =
     enumSites(opClass, baseNode, "", Map.empty, SchemaScope.of(opClass), fill)
       .filterNot(site => pinned.contains(site.pointer.stripPrefix("/")))
@@ -1417,9 +1417,9 @@ object ConfigGenerator {
       schemas: Map[Int, Schema],
       used: mutable.Set[(Int, String)],
       rowCount: Int,
-      siblings: JsonNode = noSiblings,
-      bindings: TypeBindings = Map.empty,
-      scope: SchemaScope = SchemaScope.empty
+      siblings: JsonNode,
+      bindings: TypeBindings,
+      scope: SchemaScope
   ): Decision = {
     val jp = Option(f.getAnnotation(classOf[JsonProperty]))
     val jsonName = jp.map(_.value).filter(_.nonEmpty).getOrElse(f.getName)
@@ -1469,9 +1469,9 @@ object ConfigGenerator {
       schemas: Map[Int, Schema],
       used: mutable.Set[(Int, String)],
       rowCount: Int,
-      siblings: JsonNode = noSiblings,
-      bindings: TypeBindings = Map.empty,
-      scope: SchemaScope = SchemaScope.empty
+      siblings: JsonNode,
+      bindings: TypeBindings,
+      scope: SchemaScope
   ): Either[String, JsonNode] = {
     val ruled = schemaValueRule(f, scope, siblings).flatMap(ruleFill)
     val nested = scope.descend(jsonNameOf(f))
@@ -1566,8 +1566,8 @@ object ConfigGenerator {
       schemas: Map[Int, Schema],
       used: mutable.Set[(Int, String)],
       rowCount: Int,
-      bindings: TypeBindings = Map.empty,
-      scope: SchemaScope = SchemaScope.empty
+      bindings: TypeBindings,
+      scope: SchemaScope
   ): Either[String, JsonNode] =
     scalarNode(clazz, None, schemas, used, NumHint(Bounds(None, None), 
rowCount), bindings, scope)
 
@@ -1954,7 +1954,7 @@ object ConfigGenerator {
       schemas: Map[Int, Schema],
       port: Int,
       used: mutable.Set[(Int, String)],
-      siblings: JsonNode = noSiblings
+      siblings: JsonNode
   ): Either[String, String] = {
     def take(col: String): String = { used += ((port, col)); col }
     Option(f.getAnnotation(classOf[SampleColumn])).map(_.value) match {
@@ -2079,11 +2079,6 @@ object ConfigGenerator {
       permitted.elements().asScala.exists(_.asText == 
siblings.path(clause.getKey).asText)
     }
 
-  /** The empty object, for a caller with no sibling context: only the 
unconditional
-    * part of a rule can bind.
-    */
-  private def noSiblings: JsonNode = objectMapper.getNodeFactory.objectNode()
-
   /** Where a field's constraints are read from when its own annotation cannot 
carry
     * them: the operator's finished JSON schema, and the node within it 
describing the
     * object currently being built.
@@ -2130,15 +2125,10 @@ object ConfigGenerator {
       ).toOption.map(s => SchemaScope(s, s)).getOrElse(empty)
   }
 
-  /** The fields an object's conditional `allOf` requires of `row` as it 
stands. The
-    * condition is JSON Schema's own `properties`/`const`, not the `valEnum` 
form a
-    * Texera rule uses, because this one is read by the validator rather than 
by the
-    * form.
-    */
   private final case class FillContext(
-      schemas: Map[Int, Schema] = Map.empty,
-      used: mutable.Set[(Int, String)] = mutable.Set.empty,
-      rowCount: Int = DefaultRowCount
+      schemas: Map[Int, Schema],
+      used: mutable.Set[(Int, String)],
+      rowCount: Int
   )
 
   /** Whether a config holds nothing at this key: absent, null, the empty 
string a

Reply via email to