Enable EVP flagevaluation system tests for PHP - #7187
Draft
leoromanovsky wants to merge 2 commits into
Draft
Conversation
|
|
Base automatically changed from
leo.romanovsky/ffe-evp-flagevaluation-contract-fix
to
main
June 22, 2026 19:40
morrisonlevi
pushed a commit
to DataDog/libdatadog
that referenced
this pull request
Aug 6, 2026
…afe sidecar delivery (#2117) ## Motivation PHP relies on libdatadog and the sidecar for server-side flag-evaluation delivery, so the shared sidecar path must preserve the same worker-facing EVP contract as the direct SDK implementations. This contribution gives PHP a reusable, backend-verifiable flagevaluation transport without adding a one-off EVP writer in the PHP extension, which keeps cross-SDK adoption smoother for SDK owners and APM review. ## Changes - Keeps the sidecar action enum bincode-compatible by appending `FfeFlagEvaluationBatch` after existing variants. - Keeps flagevaluation IPC structs bincode-safe; outbound placeholder stripping happens only in the sidecar flusher before the EVP POST. - Shares the common Agent EVP proxy endpoint/header/request path between FFE exposures and flagevaluation delivery. - Carries `context.evaluation` over IPC as a JSON-object string and re-expands it to an object for outbound EVP JSON. - Preserves valid context values such as `false`, `""`, `{}`, and `[]` in user context. - Adds the flagevaluation C ABI path without a `reason` argument. - Supports optional real `targeting_rule.key`. - Retries reliable enqueue using retained encoded bytes so reconnect retry does not consume the payload. - Coalesces PHP flagevaluation batches in the sidecar by schema-visible dimensions and folds overflow into degraded buckets. - Splits sidecar EVP POST bodies by encoded uncompressed JSON bytes under the 5 MiB EVP limit, keeping the existing 512-event chunking as a secondary guard. - Degrades an oversized full-tier row by omitting `targeting_key` and `context`; drops and logs only if the degraded row still cannot fit. ## Decisions - OpenFeature `reason` is not part of the native ABI, sidecar event, outbound EVP payload, or aggregation contract. - Bincode wire compatibility is part of the PHP product path because PHP reaches EVP through worker-to-sidecar IPC before HTTP. - FFE exposures and flagevaluation share Agent EVP proxy transport mechanics; schema-specific payload shaping remains in each flusher because exposure deduplication and flagevaluation coalescing have different contracts. - The flagevaluation sidecar flusher owns worker-facing JSON cleanup so shared wire structs remain plain enough for positional bincode serialization. - Degraded events omit targeting key and context while retaining visible flag, variant, allocation, error, runtime-default, and targeting-rule fields. - Payload splitting happens after sidecar JSON cleanup because that is where the final uncompressed POST body exists; count-based chunking alone is not sufficient for the EVP 5 MiB limit. - PHP consumes this flagevaluation endpoint through the C ABI; the companion PHP draft points its libdatadog submodule at this PR head. ```mermaid flowchart TD A[sidecar receives/coalesces batches] --> B[clean and encode event JSON] B --> C{candidate POST <= 5 MiB?} C -- yes --> D[POST through Agent EVP proxy] C -- no --> E{single full row can degrade?} E -- yes --> F[omit targeting_key and context] F --> B E -- no --> G[drop and log/count] ``` ## Validation Evidence ### Dogfooding App - Companion PHP draft: DataDog/dd-trace-php#3984 - `ffe-dogfooding` `app-php7` and `app-php8-openfeature` were run with local PHP artifacts using this libdatadog sidecar path. - Dogfooding ran with the real-backend EVP override: Agent `DD_EVP_PROXY_CONFIG_ADDITIONAL_ENDPOINTS={}`, `DD_SKIP_SSL_VALIDATION=false`, and `DD_REMOTE_CONFIGURATION_NO_TLS_VALIDATION=false`. - Sent 12 identical evaluations per targeting key for `ffe-dogfooding-string-flag`: - `libdd-php7-batch-20260623T020845Z-alpha` - `libdd-php7-batch-20260623T020845Z-bravo` - `libdd-php8of-batch-20260623T020845Z-alpha` - `libdd-php8of-batch-20260623T020845Z-bravo` - App-side responses returned `variant_2`. ### System Tests - Companion draft PR: DataDog/system-tests#7187 ### Staging End-To-End - Retriever staging query used `--datacenter us1.staging.dog --customer-auth=skip` against the `flagevaluation` track for the exact targeting keys above. - Retriever returned one backend row per targeting key, each with `flag.key=ffe-dogfooding-string-flag`, `variant.key=variant_2`, `allocation.key=allocation-override-392dd7c149f8`, and `evaluation_count=12`: - `libdd-php7-batch-20260623T020845Z-alpha`: `first_evaluation=1782180525878`, `last_evaluation=1782180525985`, `timestamp=1782180525985`, `evaluation_count=12` - `libdd-php7-batch-20260623T020845Z-bravo`: `first_evaluation=1782180525997`, `last_evaluation=1782180526103`, `timestamp=1782180526103`, `evaluation_count=12` - `libdd-php8of-batch-20260623T020845Z-alpha`: `first_evaluation=1782180526245`, `last_evaluation=1782180526344`, `timestamp=1782180526344`, `evaluation_count=12` - `libdd-php8of-batch-20260623T020845Z-bravo`: `first_evaluation=1782180526356`, `last_evaluation=1782180526451`, `timestamp=1782180526451`, `evaluation_count=12` --------- Co-authored-by: pr-shepherd-6ad11f[bot] <305617008+pr-shepherd-6ad11f[bot]@users.noreply.github.com> Co-authored-by: vickie.fridge <vickie.fridge@datadoghq.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Enable the server-side EVP
flagevaluationsystem tests for PHP after the PHP SDK PR validated the shared contract, sidecar path, and local system-test path.Changes
Final diff against
main:tests/ffe/test_flag_eval_evp.py, including the singular/api/v2/flagevaluationpath, no OpenFeaturereason, omittedtargeting_rulewhen no real rule metadata exists, evaluation-time first/last/count assertions, and degraded-bucket overflow coverage.tests/ffe/test_flag_eval_evp.pyinmanifests/php.ymlfrommissing_feature (FFL-2446)tov1.21.0-dev.Decisions
main, because the stack base only hides the shared contract file from GitHub's PR file list.Validation Evidence
git diff --check- PASS../tooling/bin/build-debug-artifact gnu-aarch64-8.0-nts /Users/leo.romanovsky/gsd-workspaces/flag-evaluations-cross-sdk/system-tests-clean-php/binariesfromdd-trace-php- PASS; produceddd-library-php-1.21.0-aarch64-linux-gnu.tar.gz.SYSTEM_TEST_BUILD_TIMEOUT=1800 ./build.sh --library php --weblog-variant apache-mod-8.0fromsystem-tests-clean-php- PASS on 2026-06-20.TEST_LIBRARY=php WEBLOG_VARIANT=apache-mod-8.0 ./run.sh +l php FEATURE_FLAGGING_AND_EXPERIMENTATION -k "test_flag_eval_evp"- PASS on 2026-06-20,8 passed, 2627 deselected in 60.08swithLibrary: php@1.21.0.payloads=30,events=10195, totalevaluation_count=12708;evp-degradation-flagemitted10001rows with totalevaluation_count=12000, including one degraded row withevaluation_count=2000and omittedtargeting_key/context.server-evp-e2e-php7-1781931066-user-server-evp-e2e-php8-openfeature-1781931066-user-