Skip to content

Remove django_id mapping to identity.key in context evaluation #227

@emyller

Description

@emyller

Node.js SDK maps identity.djangoID to identity.key in evaluation contexts, causing inconsistent evaluation results across SDKs.
Other SDKs (PHP, Python, Go, Rust, Java) omit identity key during context mapping, relying on engine enrichment to generate composite keys.

Acceptance criteria

  • Remove identity.djangoIDidentity.key mapping in context mappers
  • Rely on engine enrichment to generate composite key ${environment.key}_${identifier}
  • Evaluation results match other SDK implementations for identical environment documents

Context

Evaluation context schema made identity.key optional in 7b4f3b2. Engine enrichment added in 93c261e generates composite keys when missing.

Node.js SDK backfills identity.key from django_id during context mapping:

identityContext.key = identity.djangoID.toString();

This causes different hash inputs for percentage-based operations:

  • Node.js: Hash uses ["segment_key", "12345"] (django_id)
  • Other SDKs: Hash uses ["segment_key", "prod_user@example.com"] (composite key)

Impact

Identical identities evaluate to different segment memberships and multivariate variants across SDK implementations. Percentage split operators and multivariate feature distributions produce inconsistent results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions