test: isolate malformed flags during UFC ingestion - #26
Merged
Conversation
# Conflicts: # README.md # ufc-config.json
leoromanovsky
marked this pull request as ready for review
August 11, 2026 01:12
leoromanovsky
requested review from
pavlokhrebto and
vjfridge
and removed request for
a team
August 11, 2026 01:12
dd-oleksii
approved these changes
Aug 11, 2026
This was referenced Aug 11, 2026
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/libdatadog
that referenced
this pull request
Aug 13, 2026
## Motivation Malformed per-flag UFC configuration is already isolated during ingestion: libdatadog stores a rejection error for that key while compiling valid neighboring flags normally. The FFI translation incorrectly exposed that rejection as a normal DEFAULT result with no error code, hiding a configuration bug from callers. This implements the contract merged in [DataDog/ffe-system-test-data#26](DataDog/ffe-system-test-data#26): evaluating a rejected key returns the caller default with ERROR / PARSE_ERROR, while valid neighboring flags remain usable. ## Changes - Map FlagConfigurationInvalid to the FFI ERROR reason and PARSE_ERROR error code. - Add regression coverage proving an invalid regex flag does not poison a valid neighboring flag. - Bump the canonical fixture submodule to the revision merged in [DataDog/ffe-system-test-data#26](DataDog/ffe-system-test-data#26). - Update the canonical adapter to expect PARSE_ERROR for rejected keys. - Compare semantic versions by precedence so build metadata does not change equality or ordering. - Correct the regex-ingestion documentation to match the parser behavior. ## Decisions - Keep validation in libdatadog so the same Rust regex and UFC parsers used for evaluation own rejection decisions. - Retain only the per-key rejection error in the compiled configuration, not the malformed flag object. - Preserve FLAG_NOT_FOUND for keys absent from the configuration. - Use SemVer precedence comparisons, which ignore build metadata as required by the specification. ## Validation - [x] cargo test -p libdd-ffe - [x] cargo test -p libdd-ffe-ffi rejected_flag_is_exposed_as_parse_error - [x] cargo test -p libdd-ffe-test-suite --test canonical_fixtures - [x] git diff --check Co-authored-by: leo.romanovsky <leo.romanovsky@datadoghq.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
This PR adds regression coverage for bugs in malformed-flag handling. A single invalid flag can currently poison an otherwise usable UFC, fall through to a catch-all allocation, or be misreported as a normal default or missing flag. These behaviors hide configuration errors and unnecessarily break valid neighboring flags.
The corrected contract isolates each malformed flag during ingestion, keeps the rest of the UFC usable, and reports the rejected key accurately as ERROR / PARSE_ERROR.
Changes
Decisions
Validation