Skip to content

Conversation

toddbaert
Copy link
Member

Demo only.

);
});

it.each([true, false])('returns default if value is null', async (defaultValue) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test runs with 2 different defaults, and gets the default value both times since we send back a nullish value in OFREP

Comment on lines +125 to +131
const reason = key.includes('null-value')
? StandardResolutionReasons.DEFAULT
: requestBody.context?.targetingKey
? StandardResolutionReasons.TARGETING_MATCH
: StandardResolutionReasons.STATIC;

const value = key.includes('null-value') ? null : true;
Copy link
Member Author

@toddbaert toddbaert Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Send back a value=null, variant=null and reason=DEFAULT, this is my preferred proposal for implementing a "defer to code default" evaluation in flagd. I think this would be non-breaking for other implementations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we need to send a variant at all?

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
@toddbaert toddbaert force-pushed the demo-null-value-ofrep branch from 6d39f15 to 2578068 Compare July 16, 2025 20:32
@toddbaert toddbaert marked this pull request as draft July 16, 2025 21:48
Copy link
Member

@lukas-reining lukas-reining left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly how I imagined it :)

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

Labels

None yet

3 participants