You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by di...@apache.org on 2026/07/27 17:55:41 UTC

(polaris-tools) branch main updated: Synchronizer: Add consolidated sync report and --fail-on-error flag (#258)

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

dimas-b pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new e5fea02  Synchronizer: Add consolidated sync report and --fail-on-error flag (#258)
e5fea02 is described below

commit e5fea020aedcb1834f306d9a13de7fccbfff1943
Author: Sai dixith chetelli <44...@users.noreply.github.com>
AuthorDate: Mon Jul 27 23:25:36 2026 +0530

    Synchronizer: Add consolidated sync report and --fail-on-error flag (#258)
    
    * Synchronizer: Add consolidated sync report and --fail-on-error flag
    
    Prints a consolidated per-entity-type synchronization report at the end of every run, and adds --fail-on-error to exit non-zero when the report contains failures. Entities that were already in sync (skipped) are now tallied separately in the report so idempotent re-runs don't render an empty report.
    
    * fix: resolve merge conflict in PolarisSynchronizer constructor
    
    The merge of main into this branch incorrectly combined the
    SynchronizationReport and skipIcebergContent constructor parameter
    additions from two separately-developed features, leaving a malformed
    duplicated parameter list that failed to compile. Merge the two
    parameters into a single correct signature and update all call sites.
---
 polaris-synchronizer/README.md                     |  22 +++
 .../tools/sync/polaris/PolarisSynchronizer.java    | 169 ++++++++++++++++-----
 .../sync/polaris/planning/plan/EntityType.java     |  32 ++++
 .../sync/polaris/planning/plan/SyncOutcome.java    |  28 ++++
 .../planning/plan/SynchronizationReport.java       | 140 +++++++++++++++++
 .../PolarisSynchronizerSkipIcebergContentTest.java |   4 +
 .../planning/plan/SynchronizationReportTest.java   | 112 ++++++++++++++
 .../tools/sync/polaris/SyncPolarisCommand.java     |  15 +-
 8 files changed, 486 insertions(+), 36 deletions(-)

diff --git a/polaris-synchronizer/README.md b/polaris-synchronizer/README.md
index c7e754a..99b1da0 100644
--- a/polaris-synchronizer/README.md
+++ b/polaris-synchronizer/README.md
@@ -184,3 +184,25 @@ java -jar cli/build/libs/polaris-synchronizer-cli.jar sync-polaris \
 > nor remove or modify them or their assignments to principals/principal-roles on the target. This is to accommodate that 
 > the tool itself will be running with the permission levels for these principals and roles, and we do not want to modify 
 > the tool's permissions at runtime.
+
+At the end of every run, `sync-polaris` prints a consolidated synchronization report summarizing how
+many entities of each type were created, overwritten, removed, skipped (already in sync), or failed,
+along with a list of any failures encountered:
+
+```
+=== Synchronization Report ===
+Principal:               3 created, 0 overwritten, 0 removed, 0 skipped, 1 failed
+Catalog:                  2 created, 1 overwritten, 0 removed, 5 skipped, 0 failed
+Table:                   20 created, 0 overwritten, 0 removed, 40 skipped, 2 failed
+
+Failures:
+  - Principal 'alice': <exception message>
+  - Table 'db.orders': <exception message>
+===============================
+```
+
+By default, `sync-polaris` exits with status `0` regardless of whether individual entities failed to
+synchronize (matching the pre-existing behavior, where failures are logged and the run continues).
+Pass `--fail-on-error` to make the command exit with a non-zero status if the report contains any
+failures. This is distinct from `--halt-on-failure`, which aborts the run as soon as the first failure
+occurs; `--fail-on-error` lets the run finish synchronizing everything it can, then fails afterward.
diff --git a/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/PolarisSynchronizer.java b/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/PolarisSynchronizer.java
index e4312bf..f7f96f8 100644
--- a/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/PolarisSynchronizer.java
+++ b/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/PolarisSynchronizer.java
@@ -36,7 +36,10 @@ import org.apache.polaris.tools.sync.polaris.catalog.BaseTableWithETag;
 import org.apache.polaris.tools.sync.polaris.catalog.ETagManager;
 import org.apache.polaris.tools.sync.polaris.catalog.MetadataNotModifiedException;
 import org.apache.polaris.tools.sync.polaris.planning.SynchronizationPlanner;
+import org.apache.polaris.tools.sync.polaris.planning.plan.EntityType;
+import org.apache.polaris.tools.sync.polaris.planning.plan.SyncOutcome;
 import org.apache.polaris.tools.sync.polaris.planning.plan.SynchronizationPlan;
+import org.apache.polaris.tools.sync.polaris.planning.plan.SynchronizationReport;
 import org.apache.polaris.tools.sync.polaris.service.IcebergCatalogService;
 import org.apache.polaris.tools.sync.polaris.service.PolarisService;
 import org.apache.polaris.tools.sync.polaris.service.impl.PolarisIcebergCatalogService;
@@ -63,6 +66,7 @@ public class PolarisSynchronizer {
 
   private final boolean diffOnly;
 
+  private final SynchronizationReport report;
   private final boolean skipIcebergContent;
 
   public PolarisSynchronizer(
@@ -73,6 +77,7 @@ public class PolarisSynchronizer {
       PolarisService target,
       ETagManager etagManager,
       boolean diffOnly,
+      SynchronizationReport report,
       boolean skipIcebergContent) {
     this.clientLogger =
         clientLogger == null ? LoggerFactory.getLogger(PolarisSynchronizer.class) : clientLogger;
@@ -82,6 +87,7 @@ public class PolarisSynchronizer {
     this.target = target;
     this.etagManager = etagManager;
     this.diffOnly = diffOnly;
+    this.report = report;
     this.skipIcebergContent = skipIcebergContent;
   }
 
@@ -127,16 +133,20 @@ public class PolarisSynchronizer {
     principalSyncPlan
             .entitiesToSkipAndSkipChildren()
             .forEach(
-                    principal ->
-                            clientLogger.info("Skipping principal {}.", principal.getName()));
+                    principal -> {
+                            clientLogger.info("Skipping principal {}.", principal.getName());
+                            report.recordSuccess(EntityType.PRINCIPAL, SyncOutcome.SKIPPED);
+                    });
 
     principalSyncPlan
             .entitiesNotModified()
             .forEach(
-                    principal ->
+                    principal -> {
                             clientLogger.info(
                                     "No change detected for principal {}, skipping.",
-                                    principal.getName()));
+                                    principal.getName());
+                            report.recordSuccess(EntityType.PRINCIPAL, SyncOutcome.SKIPPED);
+                    });
 
     int syncsCompleted = 0;
     final int totalSyncsToComplete = totalSyncsToComplete(principalSyncPlan);
@@ -151,10 +161,12 @@ public class PolarisSynchronizer {
                 ++syncsCompleted,
                 totalSyncsToComplete
         );
+        report.recordSuccess(EntityType.PRINCIPAL, SyncOutcome.CREATED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error("Failed to create principal {} on target. - {}/{}",
                 principal.getName(), ++syncsCompleted, totalSyncsToComplete, e);
+        report.recordFailure(EntityType.PRINCIPAL, principal.getName(), e);
       }
     }
 
@@ -169,10 +181,12 @@ public class PolarisSynchronizer {
                 ++syncsCompleted,
                 totalSyncsToComplete
         );
+        report.recordSuccess(EntityType.PRINCIPAL, SyncOutcome.OVERWRITTEN);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error("Failed to overwrite principal {} on target. - {}/{}",
                 principal.getName(), ++syncsCompleted, totalSyncsToComplete, e);
+        report.recordFailure(EntityType.PRINCIPAL, principal.getName(), e);
       }
     }
 
@@ -181,10 +195,12 @@ public class PolarisSynchronizer {
         target.dropPrincipal(principal.getName());
         clientLogger.info("Removed principal {} on target. - {}/{}",
                 principal.getName(), ++syncsCompleted, totalSyncsToComplete);
+        report.recordSuccess(EntityType.PRINCIPAL, SyncOutcome.REMOVED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error("Failed to remove principal {} ont target. - {}/{}",
                 principal.getName(), ++syncsCompleted, totalSyncsToComplete, e);
+        report.recordFailure(EntityType.PRINCIPAL, principal.getName(), e);
       }
     }
 
@@ -229,17 +245,21 @@ public class PolarisSynchronizer {
     assignedPrincipalRoleSyncPlan
             .entitiesToSkip()
             .forEach(
-                    principalRole ->
+                    principalRole -> {
                             clientLogger.info("Skipping assignment of principal-role {} to principal {}.",
-                                    principalName, principalRole.getName()));
+                                    principalName, principalRole.getName());
+                            report.recordSuccess(EntityType.PRINCIPAL_ROLE_ASSIGNMENT, SyncOutcome.SKIPPED);
+                    });
 
     assignedPrincipalRoleSyncPlan
             .entitiesNotModified()
             .forEach(
-                    principalRole ->
+                    principalRole -> {
                             clientLogger.info(
                                     "Principal {} is already assigned to principal-role {}, skipping.",
-                                    principalName, principalRole.getName()));
+                                    principalName, principalRole.getName());
+                            report.recordSuccess(EntityType.PRINCIPAL_ROLE_ASSIGNMENT, SyncOutcome.SKIPPED);
+                    });
 
     int syncsCompleted = 0;
     final int totalSyncsToComplete = totalSyncsToComplete(assignedPrincipalRoleSyncPlan);
@@ -249,10 +269,12 @@ public class PolarisSynchronizer {
         target.assignPrincipalRole(principalName, principalRole.getName());
         clientLogger.info("Assigned principal-role {} to principal {}. - {}/{}",
                 principalRole.getName(), principalName, ++syncsCompleted, totalSyncsToComplete);
+        report.recordSuccess(EntityType.PRINCIPAL_ROLE_ASSIGNMENT, SyncOutcome.CREATED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error("Failed to assign principal-role {} to principal {}. - {}/{}",
                 principalRole.getName(), principalName, ++syncsCompleted, totalSyncsToComplete);
+        report.recordFailure(EntityType.PRINCIPAL_ROLE_ASSIGNMENT, principalRole.getName(), e);
       }
     }
 
@@ -261,10 +283,12 @@ public class PolarisSynchronizer {
         target.assignPrincipalRole(principalName, principalRole.getName());
         clientLogger.info("Assigned principal-role {} to principal {}. - {}/{}",
                 principalRole.getName(), principalName, ++syncsCompleted, totalSyncsToComplete);
+        report.recordSuccess(EntityType.PRINCIPAL_ROLE_ASSIGNMENT, SyncOutcome.OVERWRITTEN);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error("Failed to assign principal-role {} to principal {}. - {}/{}",
                 principalRole.getName(), principalName, ++syncsCompleted, totalSyncsToComplete);
+        report.recordFailure(EntityType.PRINCIPAL_ROLE_ASSIGNMENT, principalRole.getName(), e);
       }
     }
 
@@ -273,10 +297,12 @@ public class PolarisSynchronizer {
         target.revokePrincipalRole(principalName, principalRole.getName());
         clientLogger.info("Revoked principal-role {} from principal {}. - {}/{}",
                 principalRole.getName(), principalName, ++syncsCompleted, totalSyncsToComplete);
+        report.recordSuccess(EntityType.PRINCIPAL_ROLE_ASSIGNMENT, SyncOutcome.REMOVED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error("Failed to revoke principal-role {} to principal {}. - {}/{}",
                 principalRole.getName(), principalName, ++syncsCompleted, totalSyncsToComplete);
+        report.recordFailure(EntityType.PRINCIPAL_ROLE_ASSIGNMENT, principalRole.getName(), e);
       }
     }
   }
@@ -311,16 +337,20 @@ public class PolarisSynchronizer {
     principalRoleSyncPlan
         .entitiesToSkip()
         .forEach(
-            principalRole ->
-                clientLogger.info("Skipping principal-role {}.", principalRole.getName()));
+            principalRole -> {
+                clientLogger.info("Skipping principal-role {}.", principalRole.getName());
+                report.recordSuccess(EntityType.PRINCIPAL_ROLE, SyncOutcome.SKIPPED);
+            });
 
     principalRoleSyncPlan
         .entitiesNotModified()
         .forEach(
-            principalRole ->
+            principalRole -> {
                 clientLogger.info(
                     "No change detected for principal-role {}, skipping.",
-                    principalRole.getName()));
+                    principalRole.getName());
+                report.recordSuccess(EntityType.PRINCIPAL_ROLE, SyncOutcome.SKIPPED);
+            });
 
     int syncsCompleted = 0;
     final int totalSyncsToComplete = totalSyncsToComplete(principalRoleSyncPlan);
@@ -333,6 +363,7 @@ public class PolarisSynchronizer {
             principalRole.getName(),
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.PRINCIPAL_ROLE, SyncOutcome.CREATED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -341,6 +372,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.PRINCIPAL_ROLE, principalRole.getName(), e);
       }
     }
 
@@ -353,6 +385,7 @@ public class PolarisSynchronizer {
             principalRole.getName(),
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.PRINCIPAL_ROLE, SyncOutcome.OVERWRITTEN);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -361,6 +394,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.PRINCIPAL_ROLE, principalRole.getName(), e);
       }
     }
 
@@ -372,6 +406,7 @@ public class PolarisSynchronizer {
             principalRole.getName(),
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.PRINCIPAL_ROLE, SyncOutcome.REMOVED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -380,6 +415,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.PRINCIPAL_ROLE, principalRole.getName(), e);
       }
     }
   }
@@ -438,22 +474,26 @@ public class PolarisSynchronizer {
     assignedPrincipalRoleSyncPlan
         .entitiesToSkip()
         .forEach(
-            principalRole ->
+            principalRole -> {
                 clientLogger.info(
                     "Skipping assignment of principal-role {} to catalog-role {} in catalog {}.",
                     principalRole.getName(),
                     catalogRoleName,
-                    catalogName));
+                    catalogName);
+                report.recordSuccess(EntityType.CATALOG_ROLE_ASSIGNMENT, SyncOutcome.SKIPPED);
+            });
 
     assignedPrincipalRoleSyncPlan
         .entitiesNotModified()
         .forEach(
-            principalRole ->
+            principalRole -> {
                 clientLogger.info(
                     "Principal-role {} is already assigned to catalog-role {} in catalog {}. Skipping.",
                     principalRole.getName(),
                     catalogRoleName,
-                    catalogName));
+                    catalogName);
+                report.recordSuccess(EntityType.CATALOG_ROLE_ASSIGNMENT, SyncOutcome.SKIPPED);
+            });
 
     int syncsCompleted = 0;
     int totalSyncsToComplete = totalSyncsToComplete(assignedPrincipalRoleSyncPlan);
@@ -469,6 +509,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.CATALOG_ROLE_ASSIGNMENT, SyncOutcome.CREATED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -479,6 +520,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.CATALOG_ROLE_ASSIGNMENT, principalRole.getName(), e);
       }
     }
 
@@ -493,6 +535,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.CATALOG_ROLE_ASSIGNMENT, SyncOutcome.OVERWRITTEN);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -503,6 +546,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.CATALOG_ROLE_ASSIGNMENT, principalRole.getName(), e);
       }
     }
 
@@ -517,6 +561,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.CATALOG_ROLE_ASSIGNMENT, SyncOutcome.REMOVED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -527,6 +572,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.CATALOG_ROLE_ASSIGNMENT, principalRole.getName(), e);
       }
     }
   }
@@ -560,21 +606,28 @@ public class PolarisSynchronizer {
 
     catalogSyncPlan
         .entitiesToSkip()
-        .forEach(catalog -> clientLogger.info("Skipping catalog {}.", catalog.getName()));
+        .forEach(catalog -> {
+            clientLogger.info("Skipping catalog {}.", catalog.getName());
+            report.recordSuccess(EntityType.CATALOG, SyncOutcome.SKIPPED);
+        });
 
     catalogSyncPlan
         .entitiesToSkipAndSkipChildren()
         .forEach(
-            catalog ->
+            catalog -> {
                 clientLogger.info(
-                    "Skipping catalog {} and all child entities.", catalog.getName()));
+                    "Skipping catalog {} and all child entities.", catalog.getName());
+                report.recordSuccess(EntityType.CATALOG, SyncOutcome.SKIPPED);
+            });
 
     catalogSyncPlan
         .entitiesNotModified()
         .forEach(
-            catalog ->
+            catalog -> {
                 clientLogger.info(
-                    "No change detected in catalog {}. Skipping.", catalog.getName()));
+                    "No change detected in catalog {}. Skipping.", catalog.getName());
+                report.recordSuccess(EntityType.CATALOG, SyncOutcome.SKIPPED);
+            });
 
     int syncsCompleted = 0;
     int totalSyncsToComplete = totalSyncsToComplete(catalogSyncPlan);
@@ -587,6 +640,7 @@ public class PolarisSynchronizer {
             catalog.getName(),
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.CATALOG, SyncOutcome.CREATED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -595,6 +649,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.CATALOG, catalog.getName(), e);
       }
     }
 
@@ -607,6 +662,7 @@ public class PolarisSynchronizer {
             catalog.getName(),
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.CATALOG, SyncOutcome.OVERWRITTEN);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -615,6 +671,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.CATALOG, catalog.getName(), e);
       }
     }
 
@@ -626,6 +683,7 @@ public class PolarisSynchronizer {
             catalog.getName(),
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.CATALOG, SyncOutcome.REMOVED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -634,6 +692,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.CATALOG, catalog.getName(), e);
       }
     }
 
@@ -717,27 +776,33 @@ public class PolarisSynchronizer {
     catalogRoleSyncPlan
         .entitiesToSkip()
         .forEach(
-            catalogRole ->
+            catalogRole -> {
                 clientLogger.info(
-                    "Skipping catalog-role {} in catalog {}.", catalogRole.getName(), catalogName));
+                    "Skipping catalog-role {} in catalog {}.", catalogRole.getName(), catalogName);
+                report.recordSuccess(EntityType.CATALOG_ROLE, SyncOutcome.SKIPPED);
+            });
 
     catalogRoleSyncPlan
         .entitiesToSkipAndSkipChildren()
         .forEach(
-            catalogRole ->
+            catalogRole -> {
                 clientLogger.info(
                     "Skipping catalog-role {} in catalog {} and all child entities.",
                     catalogRole.getName(),
-                    catalogName));
+                    catalogName);
+                report.recordSuccess(EntityType.CATALOG_ROLE, SyncOutcome.SKIPPED);
+            });
 
     catalogRoleSyncPlan
         .entitiesNotModified()
         .forEach(
-            catalogRole ->
+            catalogRole -> {
                 clientLogger.info(
                     "No change detected in catalog-role {} in catalog {}. Skipping.",
                     catalogRole.getName(),
-                    catalogName));
+                    catalogName);
+                report.recordSuccess(EntityType.CATALOG_ROLE, SyncOutcome.SKIPPED);
+            });
 
     int syncsCompleted = 0;
     int totalSyncsToComplete = totalSyncsToComplete(catalogRoleSyncPlan);
@@ -751,6 +816,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.CATALOG_ROLE, SyncOutcome.CREATED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -760,6 +826,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.CATALOG_ROLE, catalogRole.getName(), e);
       }
     }
 
@@ -773,6 +840,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.CATALOG_ROLE, SyncOutcome.OVERWRITTEN);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -782,6 +850,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.CATALOG_ROLE, catalogRole.getName(), e);
       }
     }
 
@@ -794,6 +863,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.CATALOG_ROLE, SyncOutcome.REMOVED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -803,6 +873,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.CATALOG_ROLE, catalogRole.getName(), e);
       }
     }
 
@@ -863,22 +934,26 @@ public class PolarisSynchronizer {
     grantSyncPlan
         .entitiesToSkip()
         .forEach(
-            grant ->
+            grant -> {
                 clientLogger.info(
                     "Skipping addition of grant {} to catalog-role {} in catalog {}.",
                     grant.getType(),
                     catalogRoleName,
-                    catalogName));
+                    catalogName);
+                report.recordSuccess(EntityType.GRANT, SyncOutcome.SKIPPED);
+            });
 
     grantSyncPlan
         .entitiesNotModified()
         .forEach(
-            grant ->
+            grant -> {
                 clientLogger.info(
                     "Grant {} was already added to catalog-role {} in catalog {}. Skipping.",
                     grant.getType(),
                     catalogRoleName,
-                    catalogName));
+                    catalogName);
+                report.recordSuccess(EntityType.GRANT, SyncOutcome.SKIPPED);
+            });
 
     int syncsCompleted = 0;
     int totalSyncsToComplete = totalSyncsToComplete(grantSyncPlan);
@@ -893,6 +968,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.GRANT, SyncOutcome.CREATED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -903,6 +979,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.GRANT, grant.getType().toString(), e);
       }
     }
 
@@ -916,6 +993,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.GRANT, SyncOutcome.OVERWRITTEN);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -926,6 +1004,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.GRANT, grant.getType().toString(), e);
       }
     }
 
@@ -939,6 +1018,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.GRANT, SyncOutcome.REMOVED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -949,6 +1029,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.GRANT, grant.getType().toString(), e);
       }
     }
   }
@@ -1014,12 +1095,14 @@ public class PolarisSynchronizer {
     namespaceSynchronizationPlan
         .entitiesNotModified()
         .forEach(
-            namespace ->
+            namespace -> {
                 clientLogger.info(
                     "No change detected for namespace {} in namespace {} for catalog {}, skipping.",
                     namespace,
                     parentNamespace,
-                    catalogName));
+                    catalogName);
+                report.recordSuccess(EntityType.NAMESPACE, SyncOutcome.SKIPPED);
+            });
 
     for (Namespace namespace : namespaceSynchronizationPlan.entitiesToCreate()) {
       try {
@@ -1032,6 +1115,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.NAMESPACE, SyncOutcome.CREATED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -1042,6 +1126,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.NAMESPACE, namespace.toString(), e);
       }
     }
 
@@ -1066,6 +1151,7 @@ public class PolarisSynchronizer {
                     catalogName,
                     ++syncsCompleted,
                     totalSyncsToComplete);
+            report.recordSuccess(EntityType.NAMESPACE, SyncOutcome.SKIPPED);
             continue;
           }
         }
@@ -1079,6 +1165,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.NAMESPACE, SyncOutcome.OVERWRITTEN);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -1089,6 +1176,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.NAMESPACE, namespace.toString(), e);
       }
     }
 
@@ -1102,6 +1190,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.NAMESPACE, SyncOutcome.REMOVED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -1112,6 +1201,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.NAMESPACE, namespace.toString(), e);
       }
     }
 
@@ -1178,12 +1268,14 @@ public class PolarisSynchronizer {
     tableSyncPlan
         .entitiesToSkip()
         .forEach(
-            tableId ->
+            tableId -> {
                 clientLogger.info(
                     "Skipping table {} in namespace {} in catalog {}.",
                     tableId,
                     namespace,
-                    catalogName));
+                    catalogName);
+                report.recordSuccess(EntityType.TABLE, SyncOutcome.SKIPPED);
+            });
 
     int syncsCompleted = 0;
     int totalSyncsToComplete = totalSyncsToComplete(tableSyncPlan);
@@ -1210,6 +1302,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.TABLE, SyncOutcome.CREATED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -1220,6 +1313,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.TABLE, tableId.toString(), e);
       }
     }
 
@@ -1253,6 +1347,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.TABLE, SyncOutcome.OVERWRITTEN);
       } catch (MetadataNotModifiedException e) {
         clientLogger.info(
             "Table {} in namespace {} in catalog {} with was not modified, not overwriting in target catalog. - {}/{}",
@@ -1261,6 +1356,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.TABLE, SyncOutcome.SKIPPED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.error(
@@ -1271,6 +1367,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.TABLE, tableId.toString(), e);
       }
     }
 
@@ -1284,6 +1381,7 @@ public class PolarisSynchronizer {
             catalogName,
             ++syncsCompleted,
             totalSyncsToComplete);
+        report.recordSuccess(EntityType.TABLE, SyncOutcome.REMOVED);
       } catch (Exception e) {
         if (haltOnFailure) throw e;
         clientLogger.info(
@@ -1294,6 +1392,7 @@ public class PolarisSynchronizer {
             ++syncsCompleted,
             totalSyncsToComplete,
             e);
+        report.recordFailure(EntityType.TABLE, table.toString(), e);
       }
     }
   }
diff --git a/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/planning/plan/EntityType.java b/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/planning/plan/EntityType.java
new file mode 100644
index 0000000..e040d6f
--- /dev/null
+++ b/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/planning/plan/EntityType.java
@@ -0,0 +1,32 @@
+/*
+ * 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.tools.sync.polaris.planning.plan;
+
+/** The category of entity a {@link SynchronizationReport} outcome is recorded against. */
+public enum EntityType {
+  PRINCIPAL,
+  PRINCIPAL_ROLE,
+  PRINCIPAL_ROLE_ASSIGNMENT,
+  CATALOG,
+  CATALOG_ROLE,
+  CATALOG_ROLE_ASSIGNMENT,
+  GRANT,
+  NAMESPACE,
+  TABLE
+}
diff --git a/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/planning/plan/SyncOutcome.java b/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/planning/plan/SyncOutcome.java
new file mode 100644
index 0000000..8437c94
--- /dev/null
+++ b/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/planning/plan/SyncOutcome.java
@@ -0,0 +1,28 @@
+/*
+ * 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.tools.sync.polaris.planning.plan;
+
+/** The outcome of an individual entity sync attempt, recorded in a {@link SynchronizationReport}. */
+public enum SyncOutcome {
+  CREATED,
+  OVERWRITTEN,
+  REMOVED,
+  SKIPPED,
+  FAILED
+}
diff --git a/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/planning/plan/SynchronizationReport.java b/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/planning/plan/SynchronizationReport.java
new file mode 100644
index 0000000..1bbf0b3
--- /dev/null
+++ b/polaris-synchronizer/api/src/main/java/org/apache/polaris/tools/sync/polaris/planning/plan/SynchronizationReport.java
@@ -0,0 +1,140 @@
+/*
+ * 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.tools.sync.polaris.planning.plan;
+
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Accumulates the outcome of every individual entity sync attempt performed during a run, so that
+ * a single consolidated summary can be printed at the end instead of relying on interleaved logs.
+ */
+public class SynchronizationReport {
+
+  private record Failure(EntityType type, String identifier, String message) {}
+
+  private final Map<EntityType, Map<SyncOutcome, Integer>> counts;
+
+  private final List<Failure> failures;
+
+  public SynchronizationReport() {
+    this.counts = new EnumMap<>(EntityType.class);
+    for (EntityType type : EntityType.values()) {
+      Map<SyncOutcome, Integer> outcomeCounts = new EnumMap<>(SyncOutcome.class);
+      for (SyncOutcome outcome : SyncOutcome.values()) {
+        outcomeCounts.put(outcome, 0);
+      }
+      this.counts.put(type, outcomeCounts);
+    }
+    this.failures = new ArrayList<>();
+  }
+
+  /**
+   * Records that an entity was successfully synced.
+   *
+   * @param type the category of entity that was synced
+   * @param outcome the outcome of the sync; must not be {@link SyncOutcome#FAILED} - use {@link
+   *     #recordFailure(EntityType, String, Exception)} for failures
+   */
+  public void recordSuccess(EntityType type, SyncOutcome outcome) {
+    if (outcome == SyncOutcome.FAILED) {
+      throw new IllegalArgumentException("Use recordFailure() to record a failed sync.");
+    }
+    Map<SyncOutcome, Integer> outcomeCounts = counts.get(type);
+    outcomeCounts.put(outcome, outcomeCounts.get(outcome) + 1);
+  }
+
+  /**
+   * Records that an entity failed to sync.
+   *
+   * @param type the category of entity that failed to sync
+   * @param identifier a human-readable identifier for the entity, e.g. its name
+   * @param cause the exception that caused the failure
+   */
+  public void recordFailure(EntityType type, String identifier, Exception cause) {
+    Map<SyncOutcome, Integer> outcomeCounts = counts.get(type);
+    outcomeCounts.put(SyncOutcome.FAILED, outcomeCounts.get(SyncOutcome.FAILED) + 1);
+    failures.add(new Failure(type, identifier, cause.getMessage()));
+  }
+
+  /** Returns true if any entity failed to sync. */
+  public boolean hasFailures() {
+    return !failures.isEmpty();
+  }
+
+  private static String displayName(EntityType type) {
+    return switch (type) {
+      case PRINCIPAL -> "Principal";
+      case PRINCIPAL_ROLE -> "PrincipalRole";
+      case PRINCIPAL_ROLE_ASSIGNMENT -> "PrincipalRoleAssignment";
+      case CATALOG -> "Catalog";
+      case CATALOG_ROLE -> "CatalogRole";
+      case CATALOG_ROLE_ASSIGNMENT -> "CatalogRoleAssignment";
+      case GRANT -> "Grant";
+      case NAMESPACE -> "Namespace";
+      case TABLE -> "Table";
+    };
+  }
+
+  /** Renders the accumulated counts and failures as a human-readable text block. */
+  public String render() {
+    StringBuilder sb = new StringBuilder();
+    sb.append("=== Synchronization Report ===\n");
+
+    for (EntityType type : EntityType.values()) {
+      Map<SyncOutcome, Integer> outcomeCounts = counts.get(type);
+      int total =
+          outcomeCounts.get(SyncOutcome.CREATED)
+              + outcomeCounts.get(SyncOutcome.OVERWRITTEN)
+              + outcomeCounts.get(SyncOutcome.REMOVED)
+              + outcomeCounts.get(SyncOutcome.SKIPPED)
+              + outcomeCounts.get(SyncOutcome.FAILED);
+
+      if (total == 0) {
+        continue;
+      }
+
+      sb.append(
+          String.format(
+              "%-24s%d created, %d overwritten, %d removed, %d skipped, %d failed%n",
+              displayName(type) + ":",
+              outcomeCounts.get(SyncOutcome.CREATED),
+              outcomeCounts.get(SyncOutcome.OVERWRITTEN),
+              outcomeCounts.get(SyncOutcome.REMOVED),
+              outcomeCounts.get(SyncOutcome.SKIPPED),
+              outcomeCounts.get(SyncOutcome.FAILED)));
+    }
+
+    if (hasFailures()) {
+      sb.append("\nFailures:\n");
+      for (Failure failure : failures) {
+        sb.append(
+            String.format(
+                "  - %s '%s': %s%n",
+                displayName(failure.type()), failure.identifier(), failure.message()));
+      }
+    }
+
+    sb.append("===============================");
+
+    return sb.toString();
+  }
+}
diff --git a/polaris-synchronizer/api/src/test/java/org/apache/polaris/tools/sync/polaris/PolarisSynchronizerSkipIcebergContentTest.java b/polaris-synchronizer/api/src/test/java/org/apache/polaris/tools/sync/polaris/PolarisSynchronizerSkipIcebergContentTest.java
index e9e0a2c..34cc354 100644
--- a/polaris-synchronizer/api/src/test/java/org/apache/polaris/tools/sync/polaris/PolarisSynchronizerSkipIcebergContentTest.java
+++ b/polaris-synchronizer/api/src/test/java/org/apache/polaris/tools/sync/polaris/PolarisSynchronizerSkipIcebergContentTest.java
@@ -37,6 +37,7 @@ import org.apache.polaris.core.admin.model.StorageConfigInfo;
 import org.apache.polaris.tools.sync.polaris.catalog.NoOpETagManager;
 import org.apache.polaris.tools.sync.polaris.planning.NoOpSyncPlanner;
 import org.apache.polaris.tools.sync.polaris.planning.plan.SynchronizationPlan;
+import org.apache.polaris.tools.sync.polaris.planning.plan.SynchronizationReport;
 import org.apache.polaris.tools.sync.polaris.service.IcebergCatalogService;
 import org.apache.polaris.tools.sync.polaris.service.PolarisService;
 import org.junit.jupiter.api.Assertions;
@@ -299,6 +300,7 @@ public class PolarisSynchronizerSkipIcebergContentTest {
             target,
             new NoOpETagManager(),
             false,
+            new SynchronizationReport(),
             true);
 
     synchronizer.syncCatalogs();
@@ -323,6 +325,7 @@ public class PolarisSynchronizerSkipIcebergContentTest {
             target,
             new NoOpETagManager(),
             false,
+            new SynchronizationReport(),
             false);
 
     synchronizer.syncCatalogs();
@@ -354,6 +357,7 @@ public class PolarisSynchronizerSkipIcebergContentTest {
             target,
             new NoOpETagManager(),
             false,
+            new SynchronizationReport(),
             true);
 
     synchronizer.syncCatalogs();
diff --git a/polaris-synchronizer/api/src/test/java/org/apache/polaris/tools/sync/polaris/planning/plan/SynchronizationReportTest.java b/polaris-synchronizer/api/src/test/java/org/apache/polaris/tools/sync/polaris/planning/plan/SynchronizationReportTest.java
new file mode 100644
index 0000000..2053321
--- /dev/null
+++ b/polaris-synchronizer/api/src/test/java/org/apache/polaris/tools/sync/polaris/planning/plan/SynchronizationReportTest.java
@@ -0,0 +1,112 @@
+/*
+ * 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.tools.sync.polaris.planning.plan;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class SynchronizationReportTest {
+
+  @Test
+  public void recordSuccessIncrementsOnlyTargetedCell() {
+    SynchronizationReport report = new SynchronizationReport();
+
+    report.recordSuccess(EntityType.PRINCIPAL, SyncOutcome.CREATED);
+
+    String rendered = report.render();
+
+    Assertions.assertTrue(rendered.contains("Principal:"));
+    Assertions.assertTrue(rendered.contains("1 created, 0 overwritten, 0 removed, 0 skipped, 0 failed"));
+    Assertions.assertFalse(rendered.contains("Catalog:"));
+  }
+
+  @Test
+  public void recordFailureIncrementsFailedCountAndCapturesIdentifierAndMessage() {
+    SynchronizationReport report = new SynchronizationReport();
+
+    report.recordFailure(EntityType.TABLE, "db.orders", new RuntimeException("connection refused"));
+
+    String rendered = report.render();
+
+    Assertions.assertTrue(rendered.contains("Table:"));
+    Assertions.assertTrue(rendered.contains("0 created, 0 overwritten, 0 removed, 0 skipped, 1 failed"));
+    Assertions.assertTrue(rendered.contains("Table 'db.orders': connection refused"));
+  }
+
+  @Test
+  public void hasFailuresIsFalseForAnAllSuccessReport() {
+    SynchronizationReport report = new SynchronizationReport();
+
+    report.recordSuccess(EntityType.CATALOG, SyncOutcome.CREATED);
+    report.recordSuccess(EntityType.NAMESPACE, SyncOutcome.REMOVED);
+
+    Assertions.assertFalse(report.hasFailures());
+  }
+
+  @Test
+  public void hasFailuresIsTrueOnceAnyFailureIsRecorded() {
+    SynchronizationReport report = new SynchronizationReport();
+
+    report.recordSuccess(EntityType.CATALOG, SyncOutcome.CREATED);
+    report.recordFailure(EntityType.GRANT, "TABLE", new RuntimeException("boom"));
+
+    Assertions.assertTrue(report.hasFailures());
+  }
+
+  @Test
+  public void renderOmitsAllZeroEntityTypesAndFailuresSectionWhenEmpty() {
+    SynchronizationReport report = new SynchronizationReport();
+
+    report.recordSuccess(EntityType.PRINCIPAL_ROLE, SyncOutcome.CREATED);
+
+    String rendered = report.render();
+
+    Assertions.assertTrue(rendered.contains("PrincipalRole:"));
+    Assertions.assertFalse(rendered.contains("Grant:"));
+    Assertions.assertFalse(rendered.contains("Namespace:"));
+    Assertions.assertFalse(rendered.contains("Failures:"));
+  }
+
+  @Test
+  public void renderIncludesEachFailureWhenMultipleFailuresExist() {
+    SynchronizationReport report = new SynchronizationReport();
+
+    report.recordFailure(EntityType.PRINCIPAL, "alice", new RuntimeException("timeout"));
+    report.recordFailure(EntityType.TABLE, "db.returns", new RuntimeException("not found"));
+
+    String rendered = report.render();
+
+    Assertions.assertTrue(rendered.contains("Failures:"));
+    Assertions.assertTrue(rendered.contains("Principal 'alice': timeout"));
+    Assertions.assertTrue(rendered.contains("Table 'db.returns': not found"));
+  }
+
+  @Test
+  public void recordSuccessWithSkippedIncrementsSkippedCountAndDoesNotCountAsFailure() {
+    SynchronizationReport report = new SynchronizationReport();
+
+    report.recordSuccess(EntityType.NAMESPACE, SyncOutcome.SKIPPED);
+
+    String rendered = report.render();
+
+    Assertions.assertTrue(rendered.contains("Namespace:"));
+    Assertions.assertTrue(rendered.contains("0 created, 0 overwritten, 0 removed, 1 skipped, 0 failed"));
+    Assertions.assertFalse(report.hasFailures());
+  }
+}
diff --git a/polaris-synchronizer/cli/src/main/java/org/apache/polaris/tools/sync/polaris/SyncPolarisCommand.java b/polaris-synchronizer/cli/src/main/java/org/apache/polaris/tools/sync/polaris/SyncPolarisCommand.java
index 3fdd7df..e761a86 100644
--- a/polaris-synchronizer/cli/src/main/java/org/apache/polaris/tools/sync/polaris/SyncPolarisCommand.java
+++ b/polaris-synchronizer/cli/src/main/java/org/apache/polaris/tools/sync/polaris/SyncPolarisCommand.java
@@ -26,6 +26,7 @@ import org.apache.polaris.tools.sync.polaris.planning.CatalogNameFilterPlanner;
 import org.apache.polaris.tools.sync.polaris.planning.ModificationAwarePlanner;
 import org.apache.polaris.tools.sync.polaris.planning.BaseStrategyPlanner;
 import org.apache.polaris.tools.sync.polaris.planning.SynchronizationPlanner;
+import org.apache.polaris.tools.sync.polaris.planning.plan.SynchronizationReport;
 import org.apache.polaris.tools.sync.polaris.service.PolarisService;
 import org.apache.polaris.tools.sync.polaris.service.impl.PolarisApiService;
 import org.slf4j.Logger;
@@ -125,6 +126,13 @@ public class SyncPolarisCommand implements Callable<Integer> {
   )
   private BaseStrategyPlanner.Strategy strategy;
 
+  @CommandLine.Option(
+          names = {"--fail-on-error"},
+          description = "Exit with a non-zero status if any entity failed to synchronize, checked after the " +
+                  "synchronization run completes. Unlike --halt-on-failure, this does not stop the run early."
+  )
+  private boolean failOnError;
+
   @Override
   public Integer call() throws Exception {
     SynchronizationPlanner planner = SynchronizationPlanner.builder(new BaseStrategyPlanner(strategy))
@@ -133,6 +141,8 @@ public class SyncPolarisCommand implements Callable<Integer> {
             .wrapBy(AccessControlAwarePlanner::new)
             .build();
 
+    SynchronizationReport report = new SynchronizationReport();
+
     // auto generate omnipotent principals with write access on the target, read only access on source
     sourceProperties.put(PolarisApiService.ICEBERG_WRITE_ACCESS_PROPERTY, Boolean.toString(false));
     targetProperties.put(PolarisApiService.ICEBERG_WRITE_ACCESS_PROPERTY, Boolean.toString(true));
@@ -153,6 +163,7 @@ public class SyncPolarisCommand implements Callable<Integer> {
                       target,
                       etagManager,
                       diffOnly,
+                      report,
                       skipIcebergContent);
       synchronizer.syncPrincipalRoles();
       if (shouldSyncPrincipals) {
@@ -163,6 +174,8 @@ public class SyncPolarisCommand implements Callable<Integer> {
       synchronizer.syncCatalogs();
     }
 
-    return 0;
+    consoleLog.info(report.render());
+
+    return (failOnError && report.hasFailures()) ? 1 : 0;
   }
 }