Skip to content

fix(synthetics_tests): remap mobile test principals under options.bindings - #658

Merged
michael-richey merged 1 commit into
mainfrom
michael.richey/fix-synthetics-tests-options-bindings
Aug 5, 2026
Merged

fix(synthetics_tests): remap mobile test principals under options.bindings#658
michael-richey merged 1 commit into
mainfrom
michael.richey/fix-synthetics-tests-options-bindings

Conversation

@michael-richey

@michael-richey michael-richey commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Mobile synthetic tests store access-control bindings under options.bindings.
  • Principal discovery and remapping previously read restriction_policy.bindings, so organization, user, role, and team principals were not resolved before destination requests.
  • Update all affected call sites to use options.bindings, alongside the existing options.restricted_roles handling.

Test plan

  • Updated existing unit tests to use documented mobile-test fixtures.
  • Added regression coverage for options.bindings and options.restricted_roles coexisting without a top-level restriction_policy key.
  • pytest tests/unit/test_synthetics_tests.py -- 37 passed.
  • tox -e py311 -- tests/unit -q -- 1103 passed, 8 skipped.
  • Black and Ruff pass on the changed files.

@michael-richey
michael-richey marked this pull request as ready for review August 5, 2026 15:22
@michael-richey
michael-richey requested a review from a team as a code owner August 5, 2026 15:22
@michael-richey
michael-richey requested a review from Copilot August 5, 2026 15:33

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.

Pull request overview

This PR fixes principal remapping for synthetics_tests by updating the access-control path from a non-existent top-level restriction_policy.bindings to the correct options.bindings shape used by real Synthetics Test resources, preventing stale source-org principals from causing destination API rejections.

Changes:

  • Update synthetics_tests principal-connection/remapping logic to read/write options.bindings.principals instead of restriction_policy.bindings.principals.
  • Adjust pre_apply_hook policy detection to trigger org-principal fetching based on presence of options.bindings.
  • Update and extend unit tests to reflect the real resource shape (no restriction_policy, options.restricted_roles and options.bindings coexisting).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
datadog_sync/model/synthetics_tests.py Switches all principal binding paths and policy detection to options.bindings for correct remapping and drop-aware connection behavior.
tests/unit/test_synthetics_tests.py Updates fixtures/assertions to options.bindings and adds regressions for real-world shapes without restriction_policy.
Suppressed comments (1)

tests/unit/test_synthetics_tests.py:337

  • These test docstrings still refer to restriction_policy, but pre_apply_hook now keys off options.bindings. Updating the description will keep the tests aligned with the real synthetics_tests shape.
    def test_pre_apply_hook_sets_org_principal_on_success(self):
        """Source carries a restriction_policy → GET fires → org_principal set."""

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Mobile synthetic tests store access-control bindings under options.bindings. Update principal discovery and remapping to use that documented shape so organization, user, role, and team principals resolve before the destination request.
@michael-richey
michael-richey force-pushed the michael.richey/fix-synthetics-tests-options-bindings branch from 12d69b2 to 53c0404 Compare August 5, 2026 15:41
@michael-richey michael-richey changed the title fix(synthetics_tests): remap principals under options.bindings, not restriction_policy fix(synthetics_tests): remap mobile test principals under options.bindings Aug 5, 2026
@michael-richey
michael-richey marked this pull request as draft August 5, 2026 15:41
@michael-richey
michael-richey marked this pull request as ready for review August 5, 2026 15:44
@michael-richey
michael-richey merged commit cc6732b into main Aug 5, 2026
20 checks passed
@michael-richey
michael-richey deleted the michael.richey/fix-synthetics-tests-options-bindings branch August 5, 2026 16:01
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.

3 participants