-
Notifications
You must be signed in to change notification settings - Fork 24
Description
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.djangoID→identity.keymapping 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:
flagsmith-nodejs-client/flagsmith-engine/evaluation/evaluationContext/mappers.ts
Line 131 in 3c1d200
| 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.