Skip to content

feat(rum): add rum_teams_ownership_mappings resource - #722

Open
michael-richey wants to merge 2 commits into
michael.richey/add-rum-replay-playlistsfrom
michael.richey/add-rum-teams-ownership-mappings
Open

michael-richey wants to merge 2 commits into
michael.richey/add-rum-replay-playlistsfrom
michael.richey/add-rum-teams-ownership-mappings

Conversation

@michael-richey

Copy link
Copy Markdown
Collaborator

Summary

RUM teams-ownership mappings — no PATCH endpoint, so update is implemented as delete-then-recreate.

Stacked on #721 (rum_replay_playlists).

Design

  • attributes.application_id is a RUM application uuid → remapped via resource_connections (rum_applications).
  • attributes.team_handle is a stable handle (teams are mapped by name:handle and the handle is preserved across orgs), so it is not remapped. The dependency on teams is soft (documented in README) rather than a resource_connection, which would mis-remap a handle as a uuid.
  • Create data has no id (server-assigned, popped); update = delete old destination mapping + POST new.
  • excluded_attributes: id + server-managed created_at/created_by/org_id.

Changes

  • datadog_sync/model/rum_teams_ownership_mappings.py (new)
  • datadog_sync/models/__init__.py — register
  • tests/unit/test_rum_teams_ownership_mappings.py (new) — 7 unit tests
  • README.md — add rum_teams_ownership_mappings (depends on rum_applications, teams)

Testing

  • pytest tests/unit/test_rum_teams_ownership_mappings.py → 7 passed
  • Full unit suite: no new failures.

Follow-up

Integration tests + VCR cassettes deferred (require sandbox-org API access).

@michael-richey michael-richey left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Nice work on this resource.

The delete-then-recreate update strategy is well documented and correctly tested, and I agree with treating team_handle as stable/non-remapped while remapping only application_id.

No blocking issues found in this PR diff.

@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from 28865fd to b8c2f84 Compare September 25, 2026 20:53
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 11b0454 to ed4224c Compare September 25, 2026 20:53
@michael-richey
michael-richey requested a balanced review from Copilot September 25, 2026 21:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The update path can become unrecoverable after deletion succeeds but recreation fails.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds synchronization support for RUM team ownership mappings, including application ID remapping and delete/recreate updates.

Changes:

  • Adds and registers the new resource model.
  • Documents dependencies and supported-resource status.
  • Adds unit coverage for CRUD and connection behavior.
File Description
datadog_sync/​model/​rum_teams_ownership_mappings.py Implements synchronization behavior.
datadog_sync/​models/​__init__.py Registers the resource model.
tests/​unit/​test_rum_teams_ownership_mappings.py Tests model operations and ID remapping.
README.md Documents support and dependencies.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


async def update_resource(self, _id: str, resource: Dict) -> Tuple[str, Dict]:
# No PATCH endpoint -- implement update as delete-then-recreate.
await self.delete_resource(_id)
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from b8c2f84 to 3b6faa3 Compare September 25, 2026 21:25
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from ed4224c to a6f1bb1 Compare September 25, 2026 21:25
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from 3b6faa3 to dc95b0a Compare September 28, 2026 14:10
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from a6f1bb1 to 6a6c262 Compare September 28, 2026 14:10
@michael-richey

Copy link
Copy Markdown
Collaborator Author

Fixed in 6a6c2621. update_resource now uses _delete_resource (the state-aware wrapper from BaseResource) instead of calling delete_resource directly. If DELETE succeeds but POST fails, the state entry is removed after the successful delete, so the next retry recovers via the create path instead of DELETEing a stale ID that 404s forever. New test verifies state is cleaned up when DELETE succeeds but POST fails.

@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from dc95b0a to 054e500 Compare October 1, 2026 15:54
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 6a6c262 to b93a496 Compare October 1, 2026 15:54
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from 054e500 to 522f1b3 Compare October 1, 2026 16:13
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from b93a496 to a20e489 Compare October 1, 2026 16:13
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from 522f1b3 to 75e0a6d Compare October 1, 2026 18:13
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from a20e489 to 8dba3ab Compare October 1, 2026 18:13
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from 75e0a6d to b6fd215 Compare October 1, 2026 18:48
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 8dba3ab to 120de49 Compare October 1, 2026 18:49
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from b6fd215 to 810563c Compare October 1, 2026 19:43
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 120de49 to f74aaf7 Compare October 1, 2026 19:43
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from 810563c to 93a11e6 Compare October 1, 2026 20:17
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from f74aaf7 to c87118c Compare October 1, 2026 20:17
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from 93a11e6 to aa90fd0 Compare October 1, 2026 20:37
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from c87118c to 9906780 Compare October 1, 2026 20:37
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from aa90fd0 to f332f2b Compare October 1, 2026 21:17
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 9906780 to 486b57c Compare October 1, 2026 21:17
RUM teams-ownership mappings have no PATCH endpoint, so update is implemented
as delete-then-recreate. attributes.application_id is a RUM application uuid
remapped via resource_connections. attributes.team_handle is a stable handle
(teams are mapped by name:handle and the handle is preserved across orgs), so
it is NOT remapped -- the dependency on teams is soft (documented) rather than
a resource_connection (which would mis-remap a handle as a uuid).

- datadog_sync/model/rum_teams_ownership_mappings.py (new)
- datadog_sync/models/__init__.py -- register
- tests/unit/test_rum_teams_ownership_mappings.py (new) -- 7 unit tests
- README.md -- add rum_teams_ownership_mappings (depends on rum_applications,
  teams)

Integration tests + VCR cassettes deferred (require sandbox-org API access).
…s update

Per review: update_resource called delete_resource directly, which left the
old destination ID in persisted state if DELETE succeeded but POST failed.
Every retry then DELETEed that stale ID, failed with 404, and never reached
POST. Now uses _delete_resource (the state-aware wrapper) which removes the
state entry after a successful delete and tolerates an already-missing
destination, so the next retry recovers via the create path. New test
verifies state is cleaned up when DELETE succeeds but POST fails.
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-replay-playlists branch from f332f2b to 3ea7963 Compare October 2, 2026 01:45
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 486b57c to 41e8074 Compare October 2, 2026 01:45
@michael-richey

Copy link
Copy Markdown
Collaborator Author

Good implementation for this API shape.

What I liked:

  • PATCH-only endpoint behavior is handled via create_or_update_resource.
  • Clear normalization of ids from <application_id>:<id> back to API id in import path.
  • Delete+recreate strategy for app-id changes is explicit and practical.

No blocking issues from my side.

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