Skip to content

feat(ffe): support dependent flag evaluations - #4421

Merged
hhan2024 merged 4 commits into
masterfrom
helen/dependent-flags-php-sdk
Dec 4, 2026
Merged

hhan2024 merged 4 commits into
masterfrom
helen/dependent-flags-php-sdk

Conversation

@hhan2024

@hhan2024 hhan2024 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Enables variant-key prerequisite flag evaluation for the native PHP client and
OpenFeature provider. Agent Remote Configuration advertises dependent-flags
support through capability bit 50. Agentless polling does not send a
capabilities header.

Records each reached prerequisite evaluation once, including prerequisites from
rejected rules and failed dependency graphs. Results retain errors,
configuration-snapshot consent, and EVALUATION-destination split features.
Prerequisite evaluation records are submitted even when the enclosing
OpenFeature evaluation later fails; the root observation reflects the final
OpenFeature outcome. The native recordMetric option controls the requested
flag's metric; reached prerequisites retain their own metric reporting.

Eligible exposures come from the successful evaluation path and respect each
allocation's own doLog. Native clients record them during evaluation.
OpenFeature collects prerequisite candidates separately from its existing root
exposure decision, and finalizes exposures after application hooks succeed.
Failed evaluations discard deferred exposures while retaining prerequisite
evaluation records. ExposureHook reports only the explicitly evaluated root;
eligible prerequisite exposures are delivered to Datadog. Allocation, variant,
serial identity, split features, and sidecar deduplication are preserved.

A single Rust evaluator entry point returns an owned evaluation snapshot with
borrowed result and feature views. C copies those views into PHP values after
Rust returns, and releases the snapshot on both completion and Zend bailout.
Collecting deferred candidates performs no exposure JSON encoding. Immediate
exposures share one lazily encoded attribute snapshot per evaluation.

Uses the released libdatadog v51.0.0 (7e6e78abf) inherited from master. The
native dependency pin is unchanged. The canonical ffe-system-test-data
fixture snapshot is updated to d7821bb99. All 16 dependent-flag cases run
through the PHP evaluator, including 11 cases with exact
exposure/evaluation-submission expectations. Matchers enforce _count,
applicability, and noUnmatchedEvents.

Testing

Validation for 85f8fda06:

  • Rebuilt the PHP 8.3 extension and regenerated the Rust/C declarations.
  • make test_featureflags: 72 tests, 167 assertions passed.
  • Focused native and OpenFeature PHPTs: 11 passed, no skips. Cover canonical
    dependencies, requested-flag exposure controls, failed hooks, nested calls,
    fibers, split-feature ownership, and the root-only customer ExposureHook.
  • All 35 Rust tests passed and strict Clippy passed. Include retained
    snapshot lifetimes and bit-50 selection with FFE enabled and disabled.
  • The RC lifecycle test passed against a local request replayer, including
    bit 50 in the actual request payload and configuration load/remove/recovery.
  • A PHP 8.3 embed memory-pressure reproduction confirmed that the Rust snapshot
    is released exactly once before a Zend bailout propagates, with no Rust
    evaluation frames on the failing conversion stack.
  • Debugger checks confirmed zero attribute/feature JSON encodings while
    collecting deferred candidates, and one shared attribute encoding for two
    immediate prerequisite exposures plus the root.
  • PHP syntax, stub/arginfo consistency, and whitespace checks passed.

Risks

Changes PHP's internal Rust/C evaluation ABI and OpenFeature exposure
finalization. Borrowed views must remain within the snapshot's lifetime;
regression coverage exercises ownership, errors, nested calls, and fibers.
Supported-platform builds and benchmark validation remain with CI for this
revision. The companion
system-tests activation PR
remains open and targets this SDK branch.

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 80.95% (+0.04%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 775da0a | Docs | View more details | Give us feedback!

@pr-commenter

pr-commenter Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Benchmarks [ tracer ]

Benchmark execution time: 2026-12-01 23:45:50

Comparing candidate commit 775da0a in PR branch helen/dependent-flags-php-sdk with baseline commit 5b474f8 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 218 metrics, 0 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

@hhan2024
hhan2024 marked this pull request as ready for review November 4, 2026 04:38
@hhan2024
hhan2024 requested review from a team as code owners November 4, 2026 04:38
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T04:41:44.725791Z 2e2499e Draft marked ready
🔒 Security Review ✅ Completed 2026-11-04T04:42:50.200403Z 2e2499e Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Bits Code Review: PASS

More details

Confidence in prerequisite evaluation behavior is limited by the uninspected libdatadog evaluator pin and unavailable native execution.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 2e2499e

@aarsilv aarsilv added the crucible: reviewing A Crucible review has started; this PR has reviewer attention. label Nov 4, 2026
Comment thread components-rs/tracer_runtime/ffe.rs Resolved
Comment thread tests/ext/ffe/dependent_flags.json Resolved
Comment thread tracer/ddtrace_arginfo.h Resolved

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

Bits Code Review: PASS

More details

Native evaluator behavior remains unverified because its submodule is uninitialized and the ddtrace extension is unavailable. Replacing the temporary native pin and confirming backend capability gating remain explicit merge prerequisites.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit ebf7251

@aarsilv

aarsilv commented Nov 9, 2026

Copy link
Copy Markdown

🤖 Comment from Claude working with Aaron Silverman:

Re-checked our four open threads at af70fce:

  • [P1] System-tests activation still applies. [php@helen/dependent-flags-php-sdk] [FFL-1694] test(php): activate dependent flag coverage system-tests#8231 still targets typo/dependent-flags-returned-batch (2ce8e5b, unchanged). System-tests main still marks test_ffe_dependent_flags as missing_feature for PHP. So CI does not enforce that test for this PR.
  • [P2] Shared dependent-flags cases still applies. tests/FeatureFlags/ffe-system-test-data is still at 0c46747. No test reads evaluation-suites/.
  • [P3] Arginfo order is partly done. The regenerated headers now put ddog_FfeDependencyCallback in components-rs/common.h. The stub order is still reversed: ddtrace.stub.php declares providerState first, and ddtrace_arginfo.h declares dependencyEvaluations first. ddtrace_arginfo.h also conflicts with master, so please regenerate it from the stub when you resolve the conflict.
  • Heads up: libdatadog pin: the concern about master losing commits is resolved. The pin cb3bfba contains master's 0be9d86. But the pin is still a commit on an unmerged feature branch. It is the parent of the head of feat(ffe): evaluate dependent flags with prerequisite telemetry libdatadog#2748 (e9c5d82, "evaluate dependent flags with a heap-backed stack"), so it lacks that change. The PR also conflicts with master in 5 files: Cargo.toml, components-rs/datadog.h, components-rs/tracer_runtime/sidecar.rs, libdatadog and tracer/ddtrace_arginfo.h.

Comment thread Cargo.toml Resolved

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

Bits Code Review: FAIL

The PR adds dependent-flag evaluation and prerequisite telemetry; this update defers exposures until the final OpenFeature outcome and aligns stub property order. One issue remains: the remote-config lifecycle snapshot omits exposureCandidates, causing that test to fail in its development environment; native integration remains unverified.

Open Bits AI session

🤖 Bits Code Review · Commit d11abb6

@hhan2024
hhan2024 force-pushed the helen/dependent-flags-php-sdk branch from a476f40 to ba8905d Compare November 19, 2026 17:50

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

Bits Code Review: PASS

More details

Full native and OpenFeature integration remains unverified because required submodules and dependencies are absent. Available validation includes PHP syntax checks and in-memory success/failure probes.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit ba8905d

@hhan2024

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-20 17:58:28 UTC ℹ️ Start processing command /merge


2026-11-20 18:00:00 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

2026-11-20 22:03:10 UTC ⚠️ MergeQueue: This merge request was unqueued

devflow unqueued this merge request: It did not become mergeable within the expected time

@hhan2024

Copy link
Copy Markdown
Contributor Author

/code blockers

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-20 18:51:51 UTC ℹ️ Start processing command /code blockers


2026-11-20 18:52:12 UTC

No merge blockers detected.

⚪ Unknown

  • Could not evaluate required_checks in time
    The rule did not answer within 20s.
    Hint: This usually means a slow dependency (GitHub, MergeGate, ...); retry in a minute.

hhan2024 and others added 2 commits November 30, 2026 17:49
Carry prerequisite evaluation observations and successful-path exposure
candidates through the native bridge. Commit OpenFeature exposures only
after application hooks succeed, preserving the current runtime lifecycle.

Environment: Datadog workspace

Co-Authored-By: Codex GPT-6 <noreply@localhost>
Use a PHPUnit-compatible exposure log sink and include deferred exposure
candidates in the RC lifecycle snapshot. Update the canonical fixtures and
exercise dependent-flag results plus exact native telemetry submissions,
including rejected paths, prerequisite errors and matcher counts.

Environment: Datadog workspace

Co-Authored-By: Codex GPT-6 <noreply@localhost>
@hhan2024
hhan2024 force-pushed the helen/dependent-flags-php-sdk branch from ba8905d to d165174 Compare November 30, 2026 17:55
@hhan2024

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-30 17:58:12 UTC ℹ️ Start processing command /merge


2026-11-30 17:58:20 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

2026-11-30 22:13:20 UTC ⚠️ MergeQueue: This merge request was unqueued

devflow unqueued this merge request: It did not become mergeable within the expected time

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

Bits Code Review: PASS

More details

The static review found no actionable defect in prerequisite observations or deferred exposure handling. Native and OpenFeature runtime behavior remains unverified locally because the built extension, submodules, and test dependencies are unavailable.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit d165174

@hhan2024

Copy link
Copy Markdown
Contributor Author

/code blockers

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-30 19:29:39 UTC ℹ️ Start processing command /code blockers


2026-11-30 19:30:01 UTC

No merge blockers detected.

⚪ Unknown

  • Could not evaluate required_checks in time
    The rule did not answer within 20s.
    Hint: This usually means a slow dependency (GitHub, MergeGate, ...); retry in a minute.

Comment thread tracer/functions.c Resolved
Comment thread tracer/functions.c Resolved
Comment thread components-rs/tracer_runtime/ffe.rs Resolved
Comment thread components-rs/tracer_runtime/ffe.rs Resolved
hhan2024 and others added 2 commits December 1, 2026 17:05
Return Rust-owned evaluation snapshots and consume borrowed views in C with
bailout-safe cleanup. Separate root exposure control from prerequisite
deferral, and lazily encode shared attributes only for immediate exposure
recording.

Document requested-flag metric control and the root-only ExposureHook
contract. Cover retained snapshots, native deferral controls, customer hook
behavior, and actual dependent-flag RC capability selection and delivery.

Environment: Datadog workspace

Co-Authored-By: Codex GPT-6 <noreply@localhost>
@hhan2024
hhan2024 requested a review from Leiyks December 4, 2026 15:42
@hhan2024
hhan2024 merged commit 3450356 into master Dec 4, 2026
2091 checks passed
@hhan2024
hhan2024 deleted the helen/dependent-flags-php-sdk branch December 4, 2026 19:36
@github-actions github-actions Bot added this to the 2.1.0 milestone Dec 4, 2026
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.

5 participants