Skip to content

test: expect GENERAL for roots of failed dependencies - #72

Merged
aarsilv merged 2 commits into
mainfrom
aarsilv/dependent-flags-root-general-error
Nov 12, 2026
Merged

aarsilv merged 2 commits into
mainfrom
aarsilv/dependent-flags-root-general-error

Conversation

@aarsilv

@aarsilv aarsilv commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

The dependent-flags suite leaves the root error code unspecified for missing prerequisites, depth-limit failures and cycles. dependent-atomic-error-root, dependent-depth-three-root and dependent-cycle-a check reason ERROR and the caller's default value, but not the error code. Implementations differ: some copy the prerequisite's code to the root (FLAG_NOT_FOUND when the prerequisite is missing), and others return GENERAL.

GENERAL is the better root code. The root flag exists, so FLAG_NOT_FOUND on the root reports a flag-not-found error for a flag that is configured. dependent-no-assignment-root already expects GENERAL for the root and for the failed parent.

Changes

  • Add "errorCode": "GENERAL" to the results of dependent-atomic-error-root, dependent-depth-three-root and dependent-cycle-a.
  • Assert the evaluation events of dependent-atomic-error-root: dependent-leaf-on with no error, dependent-missing-prerequisite with FLAG_NOT_FOUND, and the requested root with GENERAL, with no exposures and noUnmatchedEvents: true.
  • Add dependent-transitive-error-root, where a configured parent (dependent-transitive-error-parent) depends on the missing dependent-missing-prerequisite. The case expects FLAG_NOT_FOUND for the missing prerequisite, GENERAL for the parent and the requested root, and no exposures. The two new flags are in ufc-config.json.
  • Document the rule in the README: a specific error code applies only to the flag where the failure originates, and every configured flag that fails because of a failed prerequisite, including intermediate prerequisites and the requested root, reports GENERAL.

The suite now has 15 cases. Downstream runners that assert the case count need to update it when they repin.

Native implementations checked

Implementation Revision Result
JS core DataDog/openfeature-js-client#453 at 12fe487 Shared-suite runner: 15 of 16 tests pass (15 cases plus one matcher test). dependent-transitive-error-root fails, because the intermediate parent reports FLAG_NOT_FOUND. Controls: expecting FLAG_NOT_FOUND on the atomic root, or GENERAL on the missing prerequisite, fails the atomic case.
libdatadog (used by Python, Ruby and PHP) DataDog/libdatadog#2748 at 983b4b0, with the dependent-flags suite runner proposed in its review (case count updated to 15) All 15 cases pass. Controls: expecting FLAG_NOT_FOUND on the atomic root or on the transitive parent fails, and expecting GENERAL on the missing prerequisite fails.
Go DataDog/dd-trace-go#5799 at ed55d61 A root with a missing prerequisite returns GENERAL (probe). No shared-suite runner yet.
Java DataDog/dd-trace-java#13166 at f1976f6 The root returns GENERAL for prerequisite failures (module tests).
.NET DataDog/dd-trace-dotnet#9589 at 3ed5311 Returns FLAG_NOT_FOUND for the atomic root (probe), so it needs a change.

JS and libdatadog were run against the modified fixtures. The Go, Java and .NET results come from earlier probes and native tests; those implementations were not rerun against this change, and their event codes for intermediate prerequisites were not checked. The Go and Java native tests also cover depth-limit and cycle errors, and a .NET depth-limit probe returned GENERAL.

#62 at ff462c0 already expects GENERAL for the failed root and configured parent, and FLAG_NOT_FOUND for the missing prerequisite, in its precomputed dependent-flags fixture.

Testing

  • python3 ci/validate-fixtures.py: 2 evaluation suites, 382 evaluation cases across 48 files.
  • python3 -m unittest ci/test_validate_fixtures.py: OK.

🤖 Generated with Claude Code

Pin errorCode GENERAL on the roots of the atomic missing-prerequisite,
depth-limit and cycle cases in the dependent-flags suite, and document
the rule: the root of a failed dependency returns the caller default
with ERROR/GENERAL, while the failed prerequisite's own evaluation event
keeps its specific error code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aarsilv
aarsilv requested a review from a team as a code owner November 6, 2026 04:24
@aarsilv
aarsilv requested review from hhan2024 and typotter November 6, 2026 04:24
@hhan2024

hhan2024 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

I wonder if our public documentation will need to surface this for how error codes work with dependent flags

Comment thread README.md Resolved
Assert the atomic failure's evaluation events: the successful leaf, the
missing prerequisite with FLAG_NOT_FOUND, and the requested root with
GENERAL, with no exposures and no unmatched events.

Add a transitive case where a configured parent depends on a missing
prerequisite. The missing prerequisite reports FLAG_NOT_FOUND, and the
configured parent and the requested root report GENERAL.

State in the README that a specific error code applies only to the flag
where the failure originates, and that every configured flag that fails
because of a failed prerequisite reports GENERAL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aarsilv

aarsilv commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Response from AI: Probably yes, once dependent flags are in the public documentation. The customer-facing rule is short: when a flag's prerequisite fails, evaluating the flag returns the default value with reason ERROR and error code GENERAL. The specific cause, such as FLAG_NOT_FOUND for a missing prerequisite, appears only on the prerequisite's own evaluation. The README section in this PR states the rule, so the documentation can use it as the reference.

@aarsilv
aarsilv merged commit 29ba6bf into main Nov 12, 2026
10 of 11 checks passed
@aarsilv
aarsilv deleted the aarsilv/dependent-flags-root-general-error branch November 12, 2026 16:42
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.

3 participants