Skip to content

Support explicitly known-absent properties in local evaluation and /flags #88947

Description

@marandaneto

Problem

SDK local evaluation needs to distinguish between:

  1. a property key that is omitted because the caller supplied an incomplete property map, and
  2. a property key that the caller explicitly knows is absent.

Today, omission can only be treated as unknown. For an is_set condition this means:

  • a present key, including one whose value is null, evaluates as set;
  • a missing key makes local evaluation inconclusive and leaves remote evaluation eligible;
  • known absence cannot be represented.

Treating every missing key as unset would be unsafe because an incomplete property map could then produce an incorrect local result.

Context: PostHog/sdk-specs#49 (comment)

Required API changes

SDK evaluation APIs

Add an optional, backward-compatible way for callers to identify keys known to be absent, for example:

personPropertyKeysKnownAbsent
groupPropertyKeysKnownAbsent

/flags API

When local evaluation is inconclusive and falls back to remote evaluation, the SDK must be able to send the same known-absence information. Otherwise the server may use stored property values and return a result inconsistent with local evaluation.

Possible optional request fields:

{
  "person_property_keys_known_absent": ["plan"],
  "group_property_keys_known_absent": {
    "organization": ["subscription"]
  }
}

Expected outcome

  • Callers can explicitly represent known-absent person and group properties.
  • Local and remote evaluation apply the same absence semantics.
  • Existing clients that do not send the new fields retain current behavior.
  • The behavior and request schema are documented so SDKs can implement it consistently.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions