rusackas opened a new pull request, #40588:
URL: https://github.com/apache/superset/pull/40588

   ### SUMMARY
   
   TDD-style regression test for #32972.
   
   Issue #32972 reports that dashboard exports include env-local integer 
`chartId` values in `position_json` under each chart's `meta` object. These IDs 
are auto-increment integers specific to the source environment's database — 
they change on import and produce non-deterministic exports.
   
   This PR adds a regression test that:
   1. Exports a dashboard from a "source environment" where a chart has 
`id=392` — the export contains `chartId: 392` in `position_json`
   2. Simulates re-import into a "destination environment" (where 
`update_id_refs` remaps the same chart to `id=1001`) and re-exports
   3. Asserts the two exports agree on the `chartId` value — they don't, 
proving env-local integers leak
   
   The test also asserts that `meta.uuid` is present and stable across both 
exports — UUID is the correct cross-environment identifier that should replace 
or supplement `chartId`.
   
   Related: issue #32987 notes that `CHART-<random_suffix>` keys are also 
generated fresh per export (non-deterministic), but this test focuses on the 
`meta.chartId` field which is the primary leakage described in #32972.
   
   ### How to interpret CI
   
   - **CI green** → the export format already uses stable identifiers; merging 
closes #32972 and locks in the contract.
   - **CI red** → env-local chartIds are still leaking. Fix target: 
`superset/commands/dashboard/export.py` — strip or replace integer IDs with 
UUIDs during export serialization (the `append_charts` function writes 
`"chartId": chart.id` and `_file_content` passes through whatever is in 
`position_json`).
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   pytest 
tests/unit_tests/commands/dashboard/export_test.py::test_position_json_chart_id_leaks_env_local_integers
 -xvs
   ```
   
   Expected (current/broken): `AssertionError: chartId=392 != chartId=1001`
   Expected (after fix): test passes
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: closes #32972
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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