Skip to content

Fix OpenFeature provider hook test isolation - #12178

Open
leoromanovsky wants to merge 1 commit into
masterfrom
leo.romanovsky/fix-provider-hook-tests
Open

Fix OpenFeature provider hook test isolation#12178
leoromanovsky wants to merge 1 commit into
masterfrom
leo.romanovsky/fix-provider-hook-tests

Conversation

@leoromanovsky

Copy link
Copy Markdown
Contributor

Motivation

Two ProviderTest cases produce false failures on master when the experimental span-enrichment gate is enabled in the test environment. The provider correctly registers an additional optional hook in that configuration, but the tests asserted that the complete hook list always contained exactly one entry. These CI Visibility failures create noise for contributors and can hide real OpenFeature regressions.

Changes

The provider-hook test now verifies the invariant it actually owns: the flag-evaluation metrics hook is registered whether span enrichment is disabled or enabled. It exercises both gate states explicitly and checks hook membership instead of relying on list size or ordering.

The shutdown test now has a name and assertion aligned with its behavior. It verifies evaluator shutdown and no longer couples lifecycle coverage to the number of optional provider hooks.

Decisions

This is intentionally a test-only change because production behavior is correct: enabling span enrichment should add a hook. The tests reuse the existing explicit gate seam to cover both configurations deterministically, while the dedicated span-enrichment tests remain responsible for the optional hook's own registration behavior. No global environment mutation or timeout adjustment is introduced.

Validation

  • ./gradlew :products:feature-flagging:feature-flagging-api:test --tests datadog.trace.api.openfeature.ProviderTest :products:feature-flagging:feature-flagging-api:spotlessCheck -Prerun.tests.feature-flagging-api -PtestJvm=11 --no-daemon --stacktrace
  • DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED=true ./gradlew :products:feature-flagging:feature-flagging-api:test --tests datadog.trace.api.openfeature.ProviderTest -Prerun.tests.feature-flagging-api -PtestJvm=11 --no-daemon --stacktrace

Assert hook behavior semantically across span-enrichment gate states and keep shutdown coverage focused on evaluator cleanup.

Environment: Datadog workspace
@leoromanovsky leoromanovsky added comp: openfeature OpenFeature type: bug fix Bug fix tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes labels Aug 10, 2026 — with ChatGPT Codex Connector
@dd-octo-sts

dd-octo-sts Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.98 s 14.07 s [-1.4%; +0.1%] (no difference)
startup:insecure-bank:tracing:Agent 12.93 s 13.03 s [-1.5%; +0.0%] (no difference)
startup:petclinic:appsec:Agent 17.61 s 17.09 s [+1.9%; +4.2%] (significantly worse)
startup:petclinic:iast:Agent 17.53 s 17.70 s [-1.6%; -0.2%] (maybe better)
startup:petclinic:profiling:Agent 17.58 s 17.33 s [+0.1%; +2.8%] (maybe worse)
startup:petclinic:sca:Agent 17.57 s 17.55 s [-0.9%; +1.1%] (no difference)
startup:petclinic:tracing:Agent 16.29 s 16.74 s [-7.1%; +1.7%] (no difference)

Commit: 56cd3f1e · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@leoromanovsky
leoromanovsky marked this pull request as ready for review August 10, 2026 17:19
@leoromanovsky
leoromanovsky requested a review from a team as a code owner August 10, 2026 17:20
@leoromanovsky
leoromanovsky requested review from pavlokhrebto and sameerank and removed request for a team August 10, 2026 17:20

@datadog-datadog-us1-prod datadog-datadog-us1-prod 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.

Datadog Autotest: PASS

More details

The revised tests remain deterministic when span enrichment is unset, enabled, or disabled. Exact hook-list validation confirmed the metrics hook is always present, enrichment appears only when explicitly enabled, and evaluator shutdown no longer depends on optional-hook count.

Was this helpful? React 👍 or 👎

📊 Validated against 10 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit 56cd3f1 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

@leoromanovsky
leoromanovsky added this pull request to the merge queue Aug 10, 2026
@dd-octo-sts

dd-octo-sts Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 10, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-10 19:57:19 UTC ℹ️ Start processing command /merge


2026-08-10 19:57:24 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2h (p90).


2026-08-10 20:41:45 UTCMergeQueue: The build pipeline contains failing jobs for this merge request

Build pipeline has failing jobs for 79acdfa:

⚠️ Do NOT retry failed jobs directly (why?).

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.
Details

Since those jobs are not marked as being allowed to fail, the pipeline will most likely fail.
Therefore, and to allow other builds to be processed, this merge request has been rejected and the pipeline got canceled.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 10, 2026
@leoromanovsky

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 11, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-11 01:54:21 UTC ℹ️ Start processing command /merge


2026-08-11 01:54:26 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2h (p90).


2026-08-11 02:31:37 UTCMergeQueue: The build pipeline contains failing jobs for this merge request

Build pipeline has failing jobs for 48dd94d:

⚠️ Do NOT retry failed jobs directly (why?).

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.
Details

Since those jobs are not marked as being allowed to fail, the pipeline will most likely fail.
Therefore, and to allow other builds to be processed, this merge request has been rejected and the pipeline got canceled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: openfeature OpenFeature tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants