SEPURI-SAI-KRISHNA commented on code in PR #45301:
URL: https://github.com/apache/superset/pull/45301#discussion_r4278387343


##########
superset/commands/dashboard/importers/v1/utils.py:
##########
@@ -110,8 +112,9 @@ def update_id_refs(  # pylint: disable=too-many-locals  # 
noqa: C901
 
     if "expanded_slices" in metadata:
         metadata["expanded_slices"] = {
-            str(id_map[int(old_id)]): value
+            str(new_id): value
             for old_id, value in metadata["expanded_slices"].items()
+            if (new_id := _remap_legacy_chart_id(old_id, id_map)) is not None
         }
 
     if "default_filters" in metadata:

Review Comment:
   Done. Both keys go through `_remap_legacy_chart_id` now, and so do the 
`immune` lists inside `filter_scopes`.
   
   The `immune` half was not crashing, but it was the last bare subscript left 
in the function, and it dropped a resolvable string ID rather than remapping it:
   
   ```
   immune: ["102", 999]    before -> []     both dropped
                            after -> [2]    "102" resolved, 999 dropped
   ```
   
   The exporter already routes all three of these through its own `remap_id`, 
so this is the import side catching up rather than new behaviour. For what it 
is worth the frontend types `immune` three different ways, `string[]` in 
`serializeFilterScopes.ts`, `number[]` in `FilterScopeSelector.tsx` and `number 
| string` in `getFilterScopeFromNodesTree.ts`, so a string is permitted there, 
but I could not point at a producer so I would not claim it as a live shape.
   
   `test_update_id_refs_filter_scopes_and_default_filters_unresolvable` covers 
the three key kinds and the `immune` remap. It fails on the previous head with 
`ValueError: invalid literal for int() with base 10: 'abc'`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to