Skip to content

feat: make local source IDs deterministic for stable deep links#2080

Draft
pulpdrew wants to merge 2 commits intomainfrom
cursor/deterministic-local-source-ids-628d
Draft

feat: make local source IDs deterministic for stable deep links#2080
pulpdrew wants to merge 2 commits intomainfrom
cursor/deterministic-local-source-ids-628d

Conversation

@pulpdrew
Copy link
Copy Markdown
Contributor

@pulpdrew pulpdrew commented Apr 9, 2026

Summary

When IS_LOCAL_MODE sources are created (e.g. via "Connect to Demo Server" in the onboarding modal), IDs are now derived from a stable hash of the item content instead of Math.random(). This ensures every user who connects to the same demo server gets the same source IDs, making deep links with ?source=<id> work across different users and sessions.

Previously, localStore.create() generated IDs via hashCode(Math.random().toString()), producing different IDs on every invocation. Now it uses hashCode(stableStringify(item)) where stableStringify is a key-order-independent JSON serializer, so the same source configuration always produces the same ID regardless of property insertion order.

How to test locally or on Vercel

  1. Open the play/demo environment in two separate browser profiles (or incognito windows) so each has fresh localStorage
  2. In both, click "Connect to Demo Server"
  3. Verify that the source IDs in the URL bar (e.g. ?source=...) are identical in both browsers
  4. Share a deep link from one browser to the other — the source should persist and load correctly

References

  • Linear Issue: HDX-3974
  • Related PRs: none

Linear Issue: HDX-3974

Open in Web Open in Cursor 

When IS_LOCAL_MODE sources are created (e.g. via 'Connect to Demo Server'),
IDs are now derived from a stable hash of the item content instead of
Math.random(). This ensures every user who connects to the same demo
server gets the same source IDs, making deep links with ?source=<id>
work across different users/sessions.

Uses key-order-independent JSON serialization (stableStringify) so that
properties supplied in different insertion order still produce the same ID.

Closes HDX-3974

Co-authored-by: Drew Davis <pulpdrew@gmail.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 9, 2026

⚠️ No Changeset found

Latest commit: 683262c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment Apr 9, 2026 4:09pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

E2E Test Results

All tests passed • 130 passed • 3 skipped • 1069s

Status Count
✅ Passed 130
❌ Failed 0
⚠️ Flaky 3
⏭️ Skipped 3

Tests ran across 4 shards in parallel.

View full report →

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants