Skip to content

Fix import dashboard id - #8203

Closed
gbrian wants to merge 2 commits into
apache:masterfrom
TeliaDK:fix_import_duplicate_dashboards
Closed

Fix import dashboard id#8203
gbrian wants to merge 2 commits into
apache:masterfrom
TeliaDK:fix_import_duplicate_dashboards

Conversation

@gbrian

@gbrian gbrian commented Sep 9, 2019

Copy link
Copy Markdown
Contributor

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

#8199

REVIEWERS

Comment thread superset/models/core.py
if (
"remote_id" in dash.params_dict
and dash.params_dict["remote_id"] == dashboard_to_import.id
and dash.params_dict["remote_id"] == remote_id

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to add a unit test

@gbrian gbrian Sep 9, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Looked at the tests and they seem to be testing a different approach than the one implemented but still I'm missing many parts.

This test should have cough the error: test_import_override_dashboard_2_slices but executes a different logic than the current one implemented.
Do you think we cab move on without the test? Ofc, is working on our project 😅 "Trust me I'm engineer!"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was working on this part of the codebase a while ago and this one is quite tricky and easy to introduce a bug.
In addition to that if somebody would refactor this file in the future it would be nice to provide them some guardrails. This is not a blocker but just a suggestion.

A good test case would be importing:
dash1 {id: 1, remote_id: 101}
dash2 {id:2, remote_id: 101}
and making sure that override will happen

@mistercrunch

Copy link
Copy Markdown
Member

We really need to introduce uuid as part of ImportExportMixin, some work has been started but needs to be resumed.
#7829
#7472

@gbrian

gbrian commented Sep 10, 2019

Copy link
Copy Markdown
Contributor Author

@bkyryliuk , @mistercrunch can we merge this in the meantime? Moved to other issues and the fix is so small so does not introduce more complexity and current import is not updating existing dashboards. Thanks in advance

Comment thread superset/models/core.py Outdated

# override the dashboard
existing_dashboard = None
remote_id = dashboard_to_import.params_dict.get("remote_id")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do remote_id = dashboard_to_import.params_dict.get("remote_id") or dashboard_to_import.id to be prudent here

@mistercrunch

Copy link
Copy Markdown
Member

I'd also like to see a test that fails before the fix and succeed after. Maybe it's just a matter of adding a new assertion counting the number of dashboards (?) to check if it gets added instead of updated (?)

@mistercrunch

Copy link
Copy Markdown
Member

Saw you hit a black lint error, you may want to https://github.com/apache/incubator-superset/blob/master/CONTRIBUTING.md#git-hooks

@stale

stale Bot commented Nov 10, 2019

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale Bot added the inactive Inactive for >= 30 days label Nov 10, 2019
@stale stale Bot closed this Nov 17, 2019
rusackas pushed a commit that referenced this pull request Aug 10, 2026
The sanitizer's zero-width-character strip ran before HTML-entity decoding
(entity decoding happens inside _strip_html_tags for sanitize_user_input/
sanitize_filter_value, and in an explicit unescape loop in
sanitize_sql_expression). An entity-encoded zero-width character (e.g.
"​") isn't a raw zero-width character yet at strip time, so it
survived the strip, then became the raw character once decoded -- reaching
the keyword/pattern checks intact where the raw-character form is caught.

Re-run the Unicode strip after decoding in all three functions. Also:
dedupe MCP_JWT_ISSUER before counting entries, so a list naming the same
issuer twice isn't treated as trusting two issuers; tighten the
multi-issuer error message to state the required resolver must bind the
issuer, not merely be configured; and note the new startup-refusal
behavior for multi-issuer-without-resolver configs in UPDATING.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inactive Inactive for >= 30 days size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants