Merge "Add debug logs for mergeability check"
diff --git a/java/com/google/gerrit/extensions/client/DiffPreferencesInfo.java b/java/com/google/gerrit/extensions/client/DiffPreferencesInfo.java
index ad494cb..8de9826 100644
--- a/java/com/google/gerrit/extensions/client/DiffPreferencesInfo.java
+++ b/java/com/google/gerrit/extensions/client/DiffPreferencesInfo.java
@@ -14,6 +14,8 @@
 
 package com.google.gerrit.extensions.client;
 
+import static com.google.gerrit.extensions.client.NullableBooleanPreferencesFieldComparator.equalBooleanPreferencesFields;
+
 import com.google.common.base.MoreObjects;
 import com.google.gerrit.common.ConvertibleToProto;
 import java.util.Objects;
@@ -76,25 +78,26 @@
         && Objects.equals(this.fontSize, other.fontSize)
         && Objects.equals(this.lineLength, other.lineLength)
         && Objects.equals(this.cursorBlinkRate, other.cursorBlinkRate)
-        && Objects.equals(this.expandAllComments, other.expandAllComments)
-        && Objects.equals(this.intralineDifference, other.intralineDifference)
-        && Objects.equals(this.manualReview, other.manualReview)
-        && Objects.equals(this.showLineEndings, other.showLineEndings)
-        && Objects.equals(this.showTabs, other.showTabs)
-        && Objects.equals(this.showWhitespaceErrors, other.showWhitespaceErrors)
-        && Objects.equals(this.syntaxHighlighting, other.syntaxHighlighting)
-        && Objects.equals(this.hideTopMenu, other.hideTopMenu)
-        && Objects.equals(this.autoHideDiffTableHeader, other.autoHideDiffTableHeader)
-        && Objects.equals(this.hideLineNumbers, other.hideLineNumbers)
-        && Objects.equals(this.renderEntireFile, other.renderEntireFile)
-        && Objects.equals(this.hideEmptyPane, other.hideEmptyPane)
-        && Objects.equals(this.matchBrackets, other.matchBrackets)
-        && Objects.equals(this.lineWrapping, other.lineWrapping)
+        && equalBooleanPreferencesFields(this.expandAllComments, other.expandAllComments)
+        && equalBooleanPreferencesFields(this.intralineDifference, other.intralineDifference)
+        && equalBooleanPreferencesFields(this.manualReview, other.manualReview)
+        && equalBooleanPreferencesFields(this.showLineEndings, other.showLineEndings)
+        && equalBooleanPreferencesFields(this.showTabs, other.showTabs)
+        && equalBooleanPreferencesFields(this.showWhitespaceErrors, other.showWhitespaceErrors)
+        && equalBooleanPreferencesFields(this.syntaxHighlighting, other.syntaxHighlighting)
+        && equalBooleanPreferencesFields(this.hideTopMenu, other.hideTopMenu)
+        && equalBooleanPreferencesFields(
+            this.autoHideDiffTableHeader, other.autoHideDiffTableHeader)
+        && equalBooleanPreferencesFields(this.hideLineNumbers, other.hideLineNumbers)
+        && equalBooleanPreferencesFields(this.renderEntireFile, other.renderEntireFile)
+        && equalBooleanPreferencesFields(this.hideEmptyPane, other.hideEmptyPane)
+        && equalBooleanPreferencesFields(this.matchBrackets, other.matchBrackets)
+        && equalBooleanPreferencesFields(this.lineWrapping, other.lineWrapping)
         && Objects.equals(this.ignoreWhitespace, other.ignoreWhitespace)
-        && Objects.equals(this.retainHeader, other.retainHeader)
-        && Objects.equals(this.skipDeleted, other.skipDeleted)
-        && Objects.equals(this.skipUnchanged, other.skipUnchanged)
-        && Objects.equals(this.skipUncommented, other.skipUncommented);
+        && equalBooleanPreferencesFields(this.retainHeader, other.retainHeader)
+        && equalBooleanPreferencesFields(this.skipDeleted, other.skipDeleted)
+        && equalBooleanPreferencesFields(this.skipUnchanged, other.skipUnchanged)
+        && equalBooleanPreferencesFields(this.skipUncommented, other.skipUncommented);
   }
 
   @Override
diff --git a/java/com/google/gerrit/extensions/client/EditPreferencesInfo.java b/java/com/google/gerrit/extensions/client/EditPreferencesInfo.java
index 5da211e..6e3d097 100644
--- a/java/com/google/gerrit/extensions/client/EditPreferencesInfo.java
+++ b/java/com/google/gerrit/extensions/client/EditPreferencesInfo.java
@@ -14,6 +14,8 @@
 
 package com.google.gerrit.extensions.client;
 
+import static com.google.gerrit.extensions.client.NullableBooleanPreferencesFieldComparator.equalBooleanPreferencesFields;
+
 import com.google.common.base.MoreObjects;
 import com.google.gerrit.common.ConvertibleToProto;
 import java.util.Objects;
@@ -46,16 +48,16 @@
         && Objects.equals(this.lineLength, other.lineLength)
         && Objects.equals(this.indentUnit, other.indentUnit)
         && Objects.equals(this.cursorBlinkRate, other.cursorBlinkRate)
-        && Objects.equals(this.hideTopMenu, other.hideTopMenu)
-        && Objects.equals(this.showTabs, other.showTabs)
-        && Objects.equals(this.showWhitespaceErrors, other.showWhitespaceErrors)
-        && Objects.equals(this.syntaxHighlighting, other.syntaxHighlighting)
-        && Objects.equals(this.hideLineNumbers, other.hideLineNumbers)
-        && Objects.equals(this.matchBrackets, other.matchBrackets)
-        && Objects.equals(this.lineWrapping, other.lineWrapping)
-        && Objects.equals(this.indentWithTabs, other.indentWithTabs)
-        && Objects.equals(this.autoCloseBrackets, other.autoCloseBrackets)
-        && Objects.equals(this.showBase, other.showBase);
+        && equalBooleanPreferencesFields(this.hideTopMenu, other.hideTopMenu)
+        && equalBooleanPreferencesFields(this.showTabs, other.showTabs)
+        && equalBooleanPreferencesFields(this.showWhitespaceErrors, other.showWhitespaceErrors)
+        && equalBooleanPreferencesFields(this.syntaxHighlighting, other.syntaxHighlighting)
+        && equalBooleanPreferencesFields(this.hideLineNumbers, other.hideLineNumbers)
+        && equalBooleanPreferencesFields(this.matchBrackets, other.matchBrackets)
+        && equalBooleanPreferencesFields(this.lineWrapping, other.lineWrapping)
+        && equalBooleanPreferencesFields(this.indentWithTabs, other.indentWithTabs)
+        && equalBooleanPreferencesFields(this.autoCloseBrackets, other.autoCloseBrackets)
+        && equalBooleanPreferencesFields(this.showBase, other.showBase);
   }
 
   @Override
diff --git a/java/com/google/gerrit/extensions/client/GeneralPreferencesInfo.java b/java/com/google/gerrit/extensions/client/GeneralPreferencesInfo.java
index 44fc4d5..ffdc276 100644
--- a/java/com/google/gerrit/extensions/client/GeneralPreferencesInfo.java
+++ b/java/com/google/gerrit/extensions/client/GeneralPreferencesInfo.java
@@ -14,6 +14,8 @@
 
 package com.google.gerrit.extensions.client;
 
+import static com.google.gerrit.extensions.client.NullableBooleanPreferencesFieldComparator.equalBooleanPreferencesFields;
+
 import com.google.common.base.MoreObjects;
 import com.google.gerrit.common.ConvertibleToProto;
 import java.util.List;
@@ -121,6 +123,7 @@
 
   /** Number of changes to show in a screen. */
   public Integer changesPerPage;
+
   /** Type of download URL the user prefers to use. */
   public String downloadScheme;
 
@@ -201,26 +204,32 @@
         && Objects.equals(this.theme, other.theme)
         && Objects.equals(this.dateFormat, other.dateFormat)
         && Objects.equals(this.timeFormat, other.timeFormat)
-        && Objects.equals(this.expandInlineDiffs, other.expandInlineDiffs)
-        && Objects.equals(this.relativeDateInChangeTable, other.relativeDateInChangeTable)
+        && equalBooleanPreferencesFields(this.expandInlineDiffs, other.expandInlineDiffs)
+        && equalBooleanPreferencesFields(
+            this.relativeDateInChangeTable, other.relativeDateInChangeTable)
         && Objects.equals(this.diffView, other.diffView)
-        && Objects.equals(this.sizeBarInChangeTable, other.sizeBarInChangeTable)
-        && Objects.equals(this.legacycidInChangeTable, other.legacycidInChangeTable)
-        && Objects.equals(this.muteCommonPathPrefixes, other.muteCommonPathPrefixes)
-        && Objects.equals(this.signedOffBy, other.signedOffBy)
+        && equalBooleanPreferencesFields(this.sizeBarInChangeTable, other.sizeBarInChangeTable)
+        && equalBooleanPreferencesFields(this.legacycidInChangeTable, other.legacycidInChangeTable)
+        && equalBooleanPreferencesFields(this.muteCommonPathPrefixes, other.muteCommonPathPrefixes)
+        && equalBooleanPreferencesFields(this.signedOffBy, other.signedOffBy)
         && Objects.equals(this.emailStrategy, other.emailStrategy)
         && Objects.equals(this.emailFormat, other.emailFormat)
         && Objects.equals(this.defaultBaseForMerges, other.defaultBaseForMerges)
-        && Objects.equals(this.publishCommentsOnPush, other.publishCommentsOnPush)
-        && Objects.equals(this.disableKeyboardShortcuts, other.disableKeyboardShortcuts)
-        && Objects.equals(this.disableTokenHighlighting, other.disableTokenHighlighting)
-        && Objects.equals(this.workInProgressByDefault, other.workInProgressByDefault)
+        && equalBooleanPreferencesFields(this.publishCommentsOnPush, other.publishCommentsOnPush)
+        && equalBooleanPreferencesFields(
+            this.disableKeyboardShortcuts, other.disableKeyboardShortcuts)
+        && equalBooleanPreferencesFields(
+            this.disableTokenHighlighting, other.disableTokenHighlighting)
+        && equalBooleanPreferencesFields(
+            this.workInProgressByDefault, other.workInProgressByDefault)
         && Objects.equals(this.my, other.my)
         && Objects.equals(this.changeTable, other.changeTable)
-        && Objects.equals(this.allowBrowserNotifications, other.allowBrowserNotifications)
-        && Objects.equals(
+        && equalBooleanPreferencesFields(
+            this.allowBrowserNotifications, other.allowBrowserNotifications)
+        && equalBooleanPreferencesFields(
             this.allowSuggestCodeWhileCommenting, other.allowSuggestCodeWhileCommenting)
-        && Objects.equals(this.allowAutocompletingComments, other.allowAutocompletingComments)
+        && equalBooleanPreferencesFields(
+            this.allowAutocompletingComments, other.allowAutocompletingComments)
         && Objects.equals(this.diffPageSidebar, other.diffPageSidebar);
   }
 
diff --git a/java/com/google/gerrit/extensions/client/NullableBooleanPreferencesFieldComparator.java b/java/com/google/gerrit/extensions/client/NullableBooleanPreferencesFieldComparator.java
new file mode 100644
index 0000000..ccccceb
--- /dev/null
+++ b/java/com/google/gerrit/extensions/client/NullableBooleanPreferencesFieldComparator.java
@@ -0,0 +1,56 @@
+// Copyright (C) 2024 The Android Open Source Project
+//
+// Licensed 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 com.google.gerrit.extensions.client;
+
+import com.google.gerrit.common.Nullable;
+import java.util.Objects;
+
+/**
+ * Utility class to compare nullable {@link Boolean} preferences fields.
+ *
+ * <p>This class only meant to be used for comparing preferences fields that are potentially loaded
+ * using {@link com.google.gerrit.server.config.ConfigUtil} (such as {@link GeneralPreferencesInfo},
+ * {@link DiffPreferencesInfo} and {@link EditPreferencesInfo}).
+ */
+public class NullableBooleanPreferencesFieldComparator {
+
+  /**
+   * Compare 2 nullable {@link Boolean} preferences fields, regard to {@code null} as {@code false}.
+   *
+   * <p>{@link com.google.gerrit.server.config.ConfigUtil#loadSection} sets the following values for
+   * Boolean fields, relating to {@code null} as {@code false} the same way:
+   *
+   * <table>
+   *   <tr><th> user-def </th> <th> default </th> <th> result </th></tr>
+   *   <tr><td> true </td> <td> true </td> <td> true </td></tr>
+   *   <tr><td> true </td> <td> false </td> <td> true </td></tr>
+   *   <tr><td> true </td> <td> null </td> <td> true </td></tr>
+   *   <tr><td> false </td> <td> true </td> <td> false </td></tr>
+   *   <tr><td> false </td> <td> false </td> <td> null </td></tr>
+   *   <tr><td> false </td> <td> null </td> <td> null </td></tr>
+   *   <tr><td> null </td> <td> true </td> <td> true </td></tr>
+   *   <tr><td> null </td> <td> false </td> <td> null </td></tr>
+   *   <tr><td> null </td> <td> null </td> <td> null </td></tr>
+   * </table>
+   *
+   * When reading the values, the readers always check whether the value is {@code true},
+   * practically referring to {@code null} values as {@code false} anyway. Preferences equality
+   * methods should reflect this state.
+   */
+  public static boolean equalBooleanPreferencesFields(@Nullable Boolean a, @Nullable Boolean b) {
+    return Objects.equals(
+        Objects.requireNonNullElse(a, false), Objects.requireNonNullElse(b, false));
+  }
+}
diff --git a/java/com/google/gerrit/server/config/ConfigUtil.java b/java/com/google/gerrit/server/config/ConfigUtil.java
index e76207c..121c62e 100644
--- a/java/com/google/gerrit/server/config/ConfigUtil.java
+++ b/java/com/google/gerrit/server/config/ConfigUtil.java
@@ -371,8 +371,12 @@
         } else if (isLong(t)) {
           f.set(s, cfg.getLong(section, sub, n, (Long) d));
         } else if (isBoolean(t)) {
+          // Sets the field if:
+          // - 'cfg' value is 'true'.
+          // - the default value is 'true'.
+          // - i is set.
           boolean b = cfg.getBoolean(section, sub, n, (Boolean) d);
-          if (b || i != null) {
+          if (b || (Boolean) d || i != null) {
             f.set(s, b);
           }
         } else if (t.isEnum()) {
@@ -427,10 +431,13 @@
             requireNonNull(val, "Default cannot be null for: " + n);
           }
         }
-        if (!isBoolean(t) || (boolean) val) {
+        if (!isBoolean(t) || (boolean) val || (Boolean) f.get(defaults)) {
           // To reproduce the same behavior as in the loadSection method above, values are
           // explicitly set for all types, except the boolean type. For the boolean type, the value
-          // is set only if it is 'true' (so, the false value is omitted in the result object).
+          // is set only in the following cases:
+          // - 'cfg' value is 'true'.
+          // - the default value is 'true'.
+          // Otherwise, false values are omitted in the result object.
           f.set(s, val);
         }
       }
diff --git a/javatests/com/google/gerrit/acceptance/api/accounts/DiffPreferencesIT.java b/javatests/com/google/gerrit/acceptance/api/accounts/DiffPreferencesIT.java
index e3380c0..4f27075 100644
--- a/javatests/com/google/gerrit/acceptance/api/accounts/DiffPreferencesIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/accounts/DiffPreferencesIT.java
@@ -64,6 +64,9 @@
 
     DiffPreferencesInfo o = gApi.accounts().id(admin.id().get()).setDiffPreferences(i);
     assertPrefs(o, i);
+    // Re-getting the preferences should yield the same fields
+    o = gApi.accounts().id(admin.id().get()).getDiffPreferences();
+    assertPrefs(o, i);
 
     // Partially fill input record
     i = new DiffPreferencesInfo();
@@ -74,6 +77,38 @@
   }
 
   @Test
+  public void setDiffPreferences_booleanHandling() throws Exception {
+    DiffPreferencesInfo update = new DiffPreferencesInfo();
+    update.showLineEndings = true; // Default is 'true'
+    update.lineWrapping = true; // Default is 'false'
+    update.showTabs = false; // Default is 'true'
+    update.hideTopMenu = false; // Default is 'false'
+    update.intralineDifference = null; // Default is 'true'
+    update.retainHeader = null; // Default is 'false'
+
+    DiffPreferencesInfo o = gApi.accounts().id(admin.id().get()).setDiffPreferences(update);
+
+    // Explicitly assert configured values
+    assertThat(o.showLineEndings).isTrue();
+    assertThat(o.lineWrapping).isTrue();
+    assertThat(o.showTabs).isFalse();
+    assertThat(o.hideTopMenu).isNull(); // Both new value and default are false, omitted
+    assertThat(o.intralineDifference).isTrue();
+    assertThat(o.retainHeader).isNull(); // new value is 'null' and default is false, omitted
+
+    // assert unaffected fields
+    assertPrefs(
+        o,
+        DiffPreferencesInfo.defaults(),
+        "showLineEndings",
+        "lineWrapping",
+        "showTabs",
+        "hideTopMenu",
+        "intralineDifference",
+        "retainHeader");
+  }
+
+  @Test
   public void getDiffPreferencesWithConfiguredDefaults() throws Exception {
     DiffPreferencesInfo d = DiffPreferencesInfo.defaults();
     int newLineLength = d.lineLength + 10;
diff --git a/javatests/com/google/gerrit/server/config/CachedPreferencesTest.java b/javatests/com/google/gerrit/server/config/CachedPreferencesTest.java
index 131fb23..36f0058 100644
--- a/javatests/com/google/gerrit/server/config/CachedPreferencesTest.java
+++ b/javatests/com/google/gerrit/server/config/CachedPreferencesTest.java
@@ -50,7 +50,9 @@
     CachedPreferences pref = CachedPreferences.fromLegacyConfig(originalCfg);
     GeneralPreferencesInfo general = CachedPreferences.general(Optional.empty(), pref);
 
-    assertThat(general.changesPerPage).isEqualTo(2);
+    GeneralPreferencesInfo expected = GeneralPreferencesInfo.defaults();
+    expected.changesPerPage = 2;
+    assertThat(cleanGeneralPreferences(general)).isEqualTo(expected);
   }
 
   @Test
@@ -61,7 +63,9 @@
     CachedPreferences pref = CachedPreferences.fromLegacyConfig(originalCfg);
     DiffPreferencesInfo diff = CachedPreferences.diff(Optional.empty(), pref);
 
-    assertThat(diff.context).isEqualTo(3);
+    DiffPreferencesInfo expected = DiffPreferencesInfo.defaults();
+    expected.context = 3;
+    assertThat(diff).isEqualTo(expected);
   }
 
   @Test
@@ -72,7 +76,9 @@
     CachedPreferences pref = CachedPreferences.fromLegacyConfig(originalCfg);
     EditPreferencesInfo edit = CachedPreferences.edit(Optional.empty(), pref);
 
-    assertThat(edit.tabSize).isEqualTo(5);
+    EditPreferencesInfo expected = EditPreferencesInfo.defaults();
+    expected.tabSize = 5;
+    assertThat(edit).isEqualTo(expected);
   }
 
   @Test
@@ -100,7 +106,9 @@
     CachedPreferences pref = CachedPreferences.fromUserPreferencesProto(originalProto);
     GeneralPreferencesInfo general = CachedPreferences.general(Optional.empty(), pref);
 
-    assertThat(general.changesPerPage).isEqualTo(11);
+    GeneralPreferencesInfo expected = GeneralPreferencesInfo.defaults();
+    expected.changesPerPage = 11;
+    assertThat(cleanGeneralPreferences(general)).isEqualTo(expected);
   }
 
   @Test
@@ -113,7 +121,9 @@
     CachedPreferences pref = CachedPreferences.fromUserPreferencesProto(originalProto);
     DiffPreferencesInfo diff = CachedPreferences.diff(Optional.empty(), pref);
 
-    assertThat(diff.context).isEqualTo(13);
+    DiffPreferencesInfo expected = DiffPreferencesInfo.defaults();
+    expected.context = 13;
+    assertThat(diff).isEqualTo(expected);
   }
 
   @Test
@@ -126,7 +136,9 @@
     CachedPreferences pref = CachedPreferences.fromUserPreferencesProto(originalProto);
     EditPreferencesInfo edit = CachedPreferences.edit(Optional.empty(), pref);
 
-    assertThat(edit.tabSize).isEqualTo(17);
+    EditPreferencesInfo expected = EditPreferencesInfo.defaults();
+    expected.tabSize = 17;
+    assertThat(edit).isEqualTo(expected);
   }
 
   @Test
@@ -155,10 +167,12 @@
     UserPreferences originalProto =
         UserPreferences.newBuilder()
             .setGeneralPreferencesInfo(
-                UserPreferences.GeneralPreferencesInfo.newBuilder().setChangesPerPage(19))
+                UserPreferences.GeneralPreferencesInfo.newBuilder()
+                    .setChangesPerPage(19)
+                    .setAllowAutocompletingComments(false))
             .build();
     Config originalCfg = new Config();
-    originalCfg.fromText("[general]\n\tchangesPerPage = 19");
+    originalCfg.fromText("[general]\n\tchangesPerPage = 19\n\tallowAutocompletingComments = false");
 
     CachedPreferences protoPref = CachedPreferences.fromUserPreferencesProto(originalProto);
     GeneralPreferencesInfo protoGeneral = CachedPreferences.general(Optional.empty(), protoPref);
@@ -172,10 +186,13 @@
   public void bothPreferencesTypes_getDiffPreferencesAreEqual() throws Exception {
     UserPreferences originalProto =
         UserPreferences.newBuilder()
-            .setDiffPreferencesInfo(UserPreferences.DiffPreferencesInfo.newBuilder().setContext(23))
+            .setDiffPreferencesInfo(
+                UserPreferences.DiffPreferencesInfo.newBuilder()
+                    .setContext(23)
+                    .setHideTopMenu(false))
             .build();
     Config originalCfg = new Config();
-    originalCfg.fromText("[diff]\n\tcontext = 23");
+    originalCfg.fromText("[diff]\n\tcontext = 23\n\thideTopMenu = false");
 
     CachedPreferences protoPref = CachedPreferences.fromUserPreferencesProto(originalProto);
     DiffPreferencesInfo protoDiff = CachedPreferences.diff(Optional.empty(), protoPref);
@@ -189,10 +206,13 @@
   public void bothPreferencesTypes_getEditPreferencesAreEqual() throws Exception {
     UserPreferences originalProto =
         UserPreferences.newBuilder()
-            .setEditPreferencesInfo(UserPreferences.EditPreferencesInfo.newBuilder().setTabSize(27))
+            .setEditPreferencesInfo(
+                UserPreferences.EditPreferencesInfo.newBuilder()
+                    .setTabSize(27)
+                    .setAutoCloseBrackets(true))
             .build();
     Config originalCfg = new Config();
-    originalCfg.fromText("[edit]\n\ttabSize = 27");
+    originalCfg.fromText("[edit]\n\ttabSize = 27\n\tautoCloseBrackets = true");
 
     CachedPreferences protoPref = CachedPreferences.fromUserPreferencesProto(originalProto);
     EditPreferencesInfo protoEdit = CachedPreferences.edit(Optional.empty(), protoPref);
@@ -231,4 +251,15 @@
         StorageException.class,
         () -> CachedPreferences.edit(Optional.of(defaults), userPreferences));
   }
+
+  /**
+   * {@link PreferencesParserUtil#parseGeneralPreferences} sets explicit values to {@link
+   * GeneralPreferencesInfo#my} and {@link GeneralPreferencesInfo#changeTable} in case of null
+   * defaults. Set these back to {@code null} for comparing with the defaults.
+   */
+  private static GeneralPreferencesInfo cleanGeneralPreferences(GeneralPreferencesInfo pref) {
+    pref.my = null;
+    pref.changeTable = null;
+    return pref;
+  }
 }
diff --git a/javatests/com/google/gerrit/server/config/ConfigUtilTest.java b/javatests/com/google/gerrit/server/config/ConfigUtilTest.java
index 035878c..f8c04a9 100644
--- a/javatests/com/google/gerrit/server/config/ConfigUtilTest.java
+++ b/javatests/com/google/gerrit/server/config/ConfigUtilTest.java
@@ -107,7 +107,7 @@
     assertThat(out.ld).isEqualTo(d.ld);
     assertThat(out.b).isEqualTo(in.b);
     assertThat(out.bb).isEqualTo(in.bb);
-    assertThat(out.bd).isNull();
+    assertThat(out.bd).isFalse();
     assertThat(out.s).isEqualTo(in.s);
     assertThat(out.sd).isEqualTo(d.sd);
     assertThat(out.nd).isNull();
diff --git a/polygerrit-ui/app/elements/diff/gr-apply-fix-dialog/gr-apply-fix-dialog.ts b/polygerrit-ui/app/elements/diff/gr-apply-fix-dialog/gr-apply-fix-dialog.ts
index 5319c90..3bb89d4 100644
--- a/polygerrit-ui/app/elements/diff/gr-apply-fix-dialog/gr-apply-fix-dialog.ts
+++ b/polygerrit-ui/app/elements/diff/gr-apply-fix-dialog/gr-apply-fix-dialog.ts
@@ -441,6 +441,8 @@
       fileExtension: getFileExtension(
         this.fixSuggestions?.[0].replacements?.[0].path ?? ''
       ),
+      success: res.ok,
+      status: res.status,
     });
   }
 }
diff --git a/polygerrit-ui/app/elements/shared/gr-suggestion-diff-preview/gr-suggestion-diff-preview.ts b/polygerrit-ui/app/elements/shared/gr-suggestion-diff-preview/gr-suggestion-diff-preview.ts
index 93f17c8..813ee29 100644
--- a/polygerrit-ui/app/elements/shared/gr-suggestion-diff-preview/gr-suggestion-diff-preview.ts
+++ b/polygerrit-ui/app/elements/shared/gr-suggestion-diff-preview/gr-suggestion-diff-preview.ts
@@ -280,6 +280,8 @@
         fixSuggestion?.replacements?.[0].path ?? ''
       ),
       commentId: this.commentId ?? '',
+      success: res.ok,
+      status: res.status,
     });
     if (res?.ok) {
       this.getNavigation().setUrl(