Repository navigation
release: v1.22.21 - #891
Merged
Merged
Conversation
Sync main into develop after v1.22.20
…follow-up) (#890) * Fix stale identity overwrite with timestamp-based protection **Server:** Add identity_updated_at column to Session table. Only update user_id/user_email when incoming timestamp is newer than stored value. Protects against delayed SDK requests overwriting fresher identity data. **SDK:** Track identity timestamps in telemetry-core. When identify() is called, capture current timestamp and send as identity_updated_at. Old SDKs without this field fall back to started_at as the identity timestamp. **Tests:** Added regression tests for: - Stale request arriving after identify() (should be rejected) - Newer identity overwriting older identity (should succeed) - Backward compat: old SDK without identity_updated_at (uses started_at) **Root cause:** RN SDK 1.3.1 sends delayed session requests ~1s after identify(), carrying previous user's ID. With new non-null-wins COALESCE logic from #887, stale requests overwrote correct user. Solution: timestamp-based ordering prevents out-of-order updates. **Versions:** - @telemetry-tracker/core: 1.5.2 → 1.5.3 - @telemetry-tracker/react-native: 1.3.1 → 1.3.2 Refs #886 * Address PR #890 review blockers 1. Drop started_at fallback: Only use strict-newer comparison when BOTH stored and incoming have timestamps. Requests without identity_updated_at use #887 behavior (new non-null wins). Old SDKs (1.3.1) remain affected until apps upgrade. 2. Migration: Remove backfill, leave identity_updated_at NULL for existing sessions. 3. Timestamp clamping: Clamp client timestamp to LEAST(client_ts, now()) and bound by started_at to prevent future timestamps and ensure logical ordering. 4. Core init() fix: Preserve identity only if set via identify-before-init (no active session). Clear stale identity from previous sessions. Supports identify-before-init pattern while preventing stale user carryover from re-init scenarios. 5. Tests updated: - QA sequence: stale init() first, then identify() - Old-SDK identify mid-session (uses #887 behavior) - Future timestamp clamping - SDK: identify-before-init preservation - SDK: re-init clears stale identity 6. CHANGELOG updated to reflect actual behavior and note that old SDKs stay affected. Root cause confirmed: init() calls startSession() which builds payload with module-level userId before clearing it. With new strict-newer logic and timestamp clamping, this is now properly handled. Refs #886 * Fix test timing: use past timestamps to avoid clamping to server time Use timestamps 1 minute in the past for QA sequence test to prevent clamping to server time when test runs close to 'now'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release v1.22.21
Fixed
Session.identity_updated_at(migration20261028120000_add_identity_updated_at, no backfill). When both stored and incoming session requests carry an identity timestamp,user_id/user_emailonly change if the incoming one is newer; client timestamps are clamped to server time and tostarted_at. Requests without the field keep v1.22.20 behavior. Old SDKs (RN 1.3.1 / core 1.5.2) stay affected until apps upgrade to core 1.5.3 / RN 1.3.2 (#890, Refs #886)Checklist