Skip to content

fix(dashboards): clone on read-only PUT conflict; skip unmodified suggested presets#621

Merged
riyazsh merged 1 commit into
mainfrom
riyaz/HAMR-392-dashboards-readonly-clone
Jul 10, 2026
Merged

fix(dashboards): clone on read-only PUT conflict; skip unmodified suggested presets#621
riyazsh merged 1 commit into
mainfrom
riyaz/HAMR-392-dashboards-readonly-clone

Conversation

@riyazsh

@riyazsh riyazsh commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

On dashboard update, a 403 Forbidden with either
"This dashboard is read-only" or
"user does not have permission" means the destination copy cannot be
edited in place by the sync identity. Previously the 403 propagated and
the source content was lost.

  • On the read-only class of 403, fall back to POST so source content
    lands on destination as a new dashboard.
  • If the destination is an unmodified Datadog-suggested preset
    (description contains [[suggested_dashboards]]) and the
    sync-relevant fields match the source byte-for-byte, SkipResource
    is raised instead — no-op. If any field diverges (customer forked
    the preset), fall through to clone so those edits are preserved.
  • Unrelated 403s and any non-403 status propagate unchanged.

Test plan

  • 7 new unit tests in tests/unit/test_dashboards.py:
    clone on either 403 body shape, unrelated 403 re-raised, suggested-preset
    match skipped, suggested-preset divergence cloned, missing destination
    state still clones, non-403 propagates.
  • Full tests/unit/ suite: passes (0 regressions from this change).

@riyazsh riyazsh requested a review from a team as a code owner July 9, 2026 19:57
@riyazsh riyazsh force-pushed the riyaz/HAMR-392-dashboards-readonly-clone branch from 0d2c1af to 738e426 Compare July 9, 2026 20:06
…gested presets

On a 403 with body containing "This dashboard is read-only" or
"user does not have permission", fall back to POST so source content
still lands on destination as a new dashboard. Unrelated 403s and other
statuses propagate unchanged.

Exception: when the destination is an unmodified Datadog-suggested preset
(description contains "[[suggested_dashboards]]") and the sync-relevant
fields match the source byte-for-byte, SkipResource is raised instead of
cloning — no-op, and cloning would duplicate the preset. Divergent source
still clones so customer edits are preserved.
@riyazsh riyazsh force-pushed the riyaz/HAMR-392-dashboards-readonly-clone branch from 738e426 to 6127d9b Compare July 9, 2026 20:28
@riyazsh riyazsh merged commit 303d619 into main Jul 10, 2026
11 checks passed
@riyazsh riyazsh deleted the riyaz/HAMR-392-dashboards-readonly-clone branch July 10, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants