Skip to content

Align agentless mock with the UFC CDN response#7315

Merged
leoromanovsky merged 7 commits into
mainfrom
agent/ffe-agentless-cdn-response-shape
Jul 16, 2026
Merged

Align agentless mock with the UFC CDN response#7315
leoromanovsky merged 7 commits into
mainfrom
agent/ffe-agentless-cdn-response-shape

Conversation

@leoromanovsky

@leoromanovsky leoromanovsky commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Motivation

The staging UFC CDN does not return a raw UFC document. Its managed server endpoint is:

GET /api/v2/feature-flagging/config/rules-based/server?dd_env=<environment>
DD-API-KEY: <api key>

The successful body is a JSON:API envelope with data.type set to universal-flag-configuration and the existing UFC document under data.attributes:

{"data":{"id":"1","type":"universal-flag-configuration","attributes":{"createdAt":"...","environment":{"name":"Staging"},"flags":{}}}}

The agentless mock needs to reproduce that wire contract. Otherwise SDK implementations could pass system-tests against a response shape that the managed CDN never emits. This is the matching fixture change for dd-trace-java#11892.

Changes

  • Serve the canonical /api/v2/feature-flagging/config/rules-based/server path.
  • Require the DD-API-KEY header.
  • Wrap the existing UFC fixture in the managed JSON:API envelope at the HTTP boundary.
  • Assert the JSON:API resource type and UFC environment/flags in the mock self-tests.
  • Assign the FFE SDK team and system-tests core as co-owners of the mock and its self-test.
  • Let mock self-tests bind an ephemeral port so they do not collide with an active parametric fixture.

Decisions

  • Keep tests/parametric/test_ffe/flags-v1.json as raw UFC because Remote Configuration tests consume it directly; only the agentless HTTP response is wrapped.
  • Treat data.id as opaque while requiring data.type == universal-flag-configuration.
  • Keep manifest activation and tracer test-app changes out of this response-contract PR.

Validation

System-tests fixture proof:

./run.sh TEST_THE_TEST tests/test_the_test/test_mock_ffe_agentless_backend.py
3 passed in 2.32s

Matching local Java proof for dd-trace-java#11892:

./gradlew :products:feature-flagging:feature-flagging-lib:check
BUILD SUCCESSFUL

./gradlew :products:feature-flagging:feature-flagging-lib:test -PtestJvm=11
BUILD SUCCESSFUL

The Java tests cover the exact managed CDN URL, DD-API-KEY, JSON:API unwrapping, type validation, malformed-envelope rejection, last-known-good behavior, and the explicitly configured raw-UFC compatibility path.

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

.github/CODEOWNERS                                                      @DataDog/system-tests-core
tests/test_library_conf.py                                              @DataDog/system-tests-core
tests/test_the_test/test_mock_ffe_agentless_backend.py                  @DataDog/feature-flagging-and-experimentation-sdk @DataDog/system-tests-core
utils/docker_fixtures/_mock_ffe_agentless_backend.py                    @DataDog/feature-flagging-and-experimentation-sdk @DataDog/system-tests-core

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jul 15, 2026

Copy link
Copy Markdown

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

Testing the test | System Tests (java, dev) / End-to-end #1 / spring-boot-payara 1   View in Datadog   GitHub Actions

🧪 9 Tests failed

tests.test_library_conf.Test_ExtractBehavior_Default.test_multiple_tracecontexts[spring-boot-payara] from system_tests_suite   View in Datadog
TypeError: int() can&#39;t convert non-string with explicit base

self = &lt;tests.test_library_conf.Test_ExtractBehavior_Default object at 0x7f97e80e88f0&gt;

    def test_multiple_tracecontexts(self):
        interfaces.library.assert_trace_exists(self.r)
        traces = [trace for _, trace in interfaces.agent.get_traces(self.r)]
        spans = interfaces.agent.get_spans_list(self.r)
        assert len(spans) == 1, &#34;Agent received the incorrect amount of spans&#34;
        assert len(traces) &gt; 0, &#34;Agent received the incorrect amount of traces&#34;
...
tests.test_library_conf.Test_ExtractBehavior_Restart_Otel.test_multiple_tracecontexts[spring-boot-payara] from system_tests_suite   View in Datadog
TypeError: int() can&#39;t convert non-string with explicit base

self = &lt;tests.test_library_conf.Test_ExtractBehavior_Restart_Otel object at 0x7f9bf10494c0&gt;

    def test_multiple_tracecontexts(self):
        interfaces.library.assert_trace_exists(self.r)
        spans = interfaces.agent.get_spans_list(self.r)
    
        span = self._get_otel_span(spans)
        assert span.get(&#34;traceID&#34;) != &#34;1&#34;
...
View all failed tests

Testing the test | all-jobs-are-green   View in Datadog   GitHub Actions

🧪 1 Test failed in 1 job

Testing the test | main   GitHub Actions

tests.test_library_conf.Test_ExtractBehavior_Restart_Otel.test_single_tracecontext[spring-boot-openliberty] from system_tests_suite   View in Datadog
TypeError: int() can&#39;t convert non-string with explicit base

self = &lt;tests.test_library_conf.Test_ExtractBehavior_Restart_Otel object at 0x7fb4ed260650&gt;

    def test_single_tracecontext(self):
        interfaces.library.assert_trace_exists(self.r)
        spans = interfaces.agent.get_spans_list(self.r)
    
        span = self._get_otel_span(spans)
        assert span.get(&#34;traceID&#34;) != &#34;1&#34;
...

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: a0b6a73 | Docs | Datadog PR Page | Give us feedback!

@leoromanovsky
leoromanovsky marked this pull request as ready for review July 15, 2026 21:52
@leoromanovsky
leoromanovsky requested a review from a team as a code owner July 15, 2026 21:52
@leoromanovsky
leoromanovsky enabled auto-merge (squash) July 15, 2026 21:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7dfd17502d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/test_the_test/test_mock_ffe_agentless_backend.py Outdated
@leoromanovsky
leoromanovsky merged commit c821d80 into main Jul 16, 2026
846 of 871 checks passed
@leoromanovsky
leoromanovsky deleted the agent/ffe-agentless-cdn-response-shape branch July 16, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants