You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by yu...@apache.org on 2026/06/29 17:25:43 UTC

(polaris) branch main updated: Add readiness check for reflection-free serializers (#4913)

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

flyrain pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new 13e3178638 Add readiness check for reflection-free serializers (#4913)
13e3178638 is described below

commit 13e3178638a41c16a68bf21a04d36ccb2d610bc4
Author: Yufei Gu <yu...@apache.org>
AuthorDate: Mon Jun 29 10:25:38 2026 -0700

    Add readiness check for reflection-free serializers (#4913)
---
 .../service/config/ProductionReadinessChecks.java  | 15 ++++
 .../config/ProductionReadinessChecksTest.java      | 84 ++++++++++++++++++++++
 2 files changed, 99 insertions(+)

diff --git a/runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java b/runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java
index 694f6bda06..9febb6a317 100644
--- a/runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java
+++ b/runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java
@@ -58,6 +58,9 @@ public class ProductionReadinessChecks {
 
   private static final Logger LOGGER = LoggerFactory.getLogger(ProductionReadinessChecks.class);
 
+  private static final String REFLECTION_FREE_SERIALIZERS_PROPERTY =
+      "quarkus.rest.jackson.optimization.enable-reflection-free-serializers";
+
   /**
    * A warning sign ⚠ {@code 26A0} with variant selector {@code FE0F}. The sign is preceded by a
    * null character {@code 0000} to ensure that the warning sign is displayed correctly regardless
@@ -221,6 +224,18 @@ public class ProductionReadinessChecks {
     return ProductionReadinessCheck.OK;
   }
 
+  @Produces
+  public ProductionReadinessCheck checkReflectionFreeSerializers(Config config) {
+    ConfigValue configValue = config.getConfigValue(REFLECTION_FREE_SERIALIZERS_PROPERTY);
+    if (Boolean.parseBoolean(configValue.getValue())) {
+      return ProductionReadinessCheck.of(
+          Error.ofSevere(
+              "Quarkus REST Jackson reflection-free serializers must be disabled because Polaris REST JSON handling relies on registered ObjectMapper customizations for Iceberg request and response models.",
+              REFLECTION_FREE_SERIALIZERS_PROPERTY));
+    }
+    return ProductionReadinessCheck.OK;
+  }
+
   private static String authRealmSegment(String realm) {
     return realm.equals(AuthenticationConfiguration.DEFAULT_REALM_KEY) ? "" : realm + ".";
   }
diff --git a/runtime/service/src/test/java/org/apache/polaris/service/config/ProductionReadinessChecksTest.java b/runtime/service/src/test/java/org/apache/polaris/service/config/ProductionReadinessChecksTest.java
new file mode 100644
index 0000000000..f542e86c8f
--- /dev/null
+++ b/runtime/service/src/test/java/org/apache/polaris/service/config/ProductionReadinessChecksTest.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.config;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.polaris.core.config.ProductionReadinessCheck;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigValue;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+@ExtendWith(MockitoExtension.class)
+class ProductionReadinessChecksTest {
+
+  private static final String REFLECTION_FREE_SERIALIZERS_PROPERTY =
+      "quarkus.rest.jackson.optimization.enable-reflection-free-serializers";
+
+  private ProductionReadinessChecks checks;
+
+  @BeforeEach
+  void setUp() {
+    checks = new ProductionReadinessChecks();
+  }
+
+  @Test
+  void reflectionFreeSerializersDisabledReturnsOk() {
+    ProductionReadinessCheck result =
+        checks.checkReflectionFreeSerializers(configWithReflectionFreeSerializers("false"));
+
+    assertThat(result.ready()).isTrue();
+  }
+
+  @Test
+  void reflectionFreeSerializersUnsetReturnsOk() {
+    ProductionReadinessCheck result =
+        checks.checkReflectionFreeSerializers(configWithReflectionFreeSerializers(null));
+
+    assertThat(result.ready()).isTrue();
+  }
+
+  @Test
+  void reflectionFreeSerializersEnabledReturnsSevereError() {
+    ProductionReadinessCheck result =
+        checks.checkReflectionFreeSerializers(configWithReflectionFreeSerializers("true"));
+
+    assertThat(result.ready()).isFalse();
+    assertThat(result.getErrors())
+        .singleElement()
+        .satisfies(
+            error -> {
+              assertThat(error.offendingProperty()).isEqualTo(REFLECTION_FREE_SERIALIZERS_PROPERTY);
+              assertThat(error.severe()).isTrue();
+            });
+  }
+
+  private static Config configWithReflectionFreeSerializers(String value) {
+    Config config = mock(Config.class);
+    ConfigValue configValue = mock(ConfigValue.class);
+    when(config.getConfigValue(REFLECTION_FREE_SERIALIZERS_PROPERTY)).thenReturn(configValue);
+    when(configValue.getValue()).thenReturn(value);
+    return config;
+  }
+}