You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/08/09 23:47:00 UTC

(superset) 01/01: fix(export): derive chart_hashes and zip from a single chart list

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

rusackas pushed a commit to branch fix/followup-36339-follow-up-from-36339-feat-added-determin
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 6827326001a5923a7f6f43678ef035b03756e76a
Author: rusackas <ev...@rusackas.com>
AuthorDate: Sun Aug 9 16:46:37 2026 -0700

    fix(export): derive chart_hashes and zip from a single chart list
    
    append_charts() iterated the charts set twice: once to build
    chart_hashes and again a few lines later to zip chart_hashes with
    charts for position metadata. Since set iteration order isn't
    guaranteed to be identical across separate iterations, the two passes
    could theoretically desynchronize. Materialize charts into a list once
    and derive both chart_hashes and the zip from it so they always stay
    in lockstep.
    
    Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
---
 superset/commands/dashboard/export.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/superset/commands/dashboard/export.py b/superset/commands/dashboard/export.py
index 30d7b60eeb7..fe39b3262db 100644
--- a/superset/commands/dashboard/export.py
+++ b/superset/commands/dashboard/export.py
@@ -63,7 +63,10 @@ def get_default_position(title: str) -> dict[str, Any]:
 
 
 def append_charts(position: dict[str, Any], charts: set[Slice]) -> dict[str, Any]:
-    chart_hashes = [f"CHART-{str(chart.uuid)}" for chart in charts]
+    # Materialize the set into a list once so chart_hashes and the zip below
+    # iterate the exact same ordering and can never desynchronize.
+    chart_list = list(charts)
+    chart_hashes = [f"CHART-{str(chart.uuid)}" for chart in chart_list]
 
     # if we have ROOT_ID/GRID_ID, append orphan charts to a new row inside the grid
     row_hash = None
@@ -78,7 +81,7 @@ def append_charts(position: dict[str, Any], charts: set[Slice]) -> dict[str, Any
             "parents": ["ROOT_ID", "GRID_ID"],
         }
 
-    for chart_hash, chart in zip(chart_hashes, charts, strict=False):
+    for chart_hash, chart in zip(chart_hashes, chart_list, strict=False):
         position[chart_hash] = {
             "children": [],
             "id": chart_hash,