feat: support custom installationId; fallback when crypto.randomUUID is missing#220
Merged
cameronapak merged 4 commits intomainfrom May 1, 2026
Merged
feat: support custom installationId; fallback when crypto.randomUUID is missing#220cameronapak merged 4 commits intomainfrom
cameronapak merged 4 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: e5efed9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
bmanquen
reviewed
May 1, 2026
…missing - core: YouVersionPlatformConfiguration falls back to a timestamp+random id when crypto.randomUUID is unavailable (e.g. Expo DOM components). - hooks: YouVersionProvider accepts an optional installationId prop. Synced to YouVersionPlatformConfiguration synchronously during render and used directly when constructing the context value, avoiding any race with useEffect. - Tests + changeset (minor across all 3 packages). Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019de441-0a5a-774c-826b-8adf0406c7d7
Keep installation id override as an explicit power-user escape hatch via core config/API client; changeset now reflects only the core crypto.randomUUID fallback. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
cameronapak
commented
May 1, 2026
Collaborator
Author
|
@greptile, please re-review this because the PR and description got updated. |
bmanquen
approved these changes
May 1, 2026
Collaborator
bmanquen
left a comment
There was a problem hiding this comment.
Just fix the changeset per Greptile and it is good to merge.
bmanquen
requested changes
May 1, 2026
Collaborator
bmanquen
left a comment
There was a problem hiding this comment.
Just need to fix the changeset so that all packages bump together
Collaborator
Author
it turns out they do bump all together! So we can specify which packages actally have the change but all bump together. I saw it happen in another PR: #218 |
bmanquen
approved these changes
May 1, 2026
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.
Summary
Fixes crashes in runtimes without
crypto.randomUUID(e.g. Expo DOM components) by falling back to a non-secure installation id.Changes
YouVersionPlatformConfigurationnow usescrypto.randomUUID()when available, otherwise falls back toyvp-<utc-iso-timestamp>-<random>.installationIdprop onYouVersionProviderwas intentionally dropped.patchfor the runtime fallback.Why no
installationIdpropConsumers can already override the install identifier deliberately via:
YouVersionPlatformConfiguration.installationId = '...'new ApiClient({ installationId: '...' })Making it a prominent
YouVersionProviderprop is an easy footgun (passinguserId, a constant, or a fresh random per render breaks per-install metrics/observability).Verification
pnpm --filter @youversion/platform-core testpnpm --filter @youversion/platform-react-hooks testGreptile Summary
This PR fixes a crash in runtimes that lack
crypto.randomUUID(e.g. Expo DOM components) by falling back to ayvp-<iso-timestamp>-<random>installation ID, and tidiesYouVersionProviderby extracting the duplicatedcontextValueobject into a single declaration.Confidence Score: 5/5
Safe to merge; only P2 findings remain after previous review threads addressed the substantive concerns
No P0 or P1 findings. The one new finding (missing test coverage for the fallback path) is P2. All higher-severity issues were flagged in prior review rounds.
packages/core/src/YouVersionPlatformConfiguration.ts — fallback branch needs a dedicated test
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[getOrSetInstallationId] --> B{window defined?} B -- No --> C[return empty string] B -- Yes --> D{localStorage has x-yvp-installation-id?} D -- Yes --> E[return existing ID] D -- No --> F{crypto defined AND crypto.randomUUID is a function?} F -- Yes --> G[crypto.randomUUID] F -- No --> H[yvp-ISO timestamp-Math.random base36] G --> I[localStorage.setItem] H --> I I --> J[return newId]Prompt To Fix All With AI
Reviews (5): Last reviewed commit: "fix(core): use UTC timestamp in installa..." | Re-trigger Greptile