Skip to content

Use crypto.randomUUID instead of uuid.v4#4271

Merged
imnasnainaec merged 2 commits intomasterfrom
nix-uuid
Apr 30, 2026
Merged

Use crypto.randomUUID instead of uuid.v4#4271
imnasnainaec merged 2 commits intomasterfrom
nix-uuid

Conversation

@imnasnainaec
Copy link
Copy Markdown
Collaborator

@imnasnainaec imnasnainaec commented Apr 24, 2026

Replacement for #4268

Devin review: https://app.devin.ai/review/sillsdev/TheCombine/pull/4271

Browsers block the crypto package on http:// (non-https) sites, but both our NUC and laptop installs host The Combine at an https:// page, so that's not a problem.


This change is Reviewable

Summary by CodeRabbit

  • Chores
    • Removed the uuid package dependency and updated the application to use platform-native UUID generation.

@imnasnainaec imnasnainaec self-assigned this Apr 24, 2026
@imnasnainaec imnasnainaec added the 🟩Low Low-priority PR label Apr 24, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation frontend test goal: MergeDup component: DataEntry component: TreeView goal dependencies Pull requests that update a dependency file labels Apr 24, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Warning

Rate limit exceeded

@imnasnainaec has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 57 minutes and 17 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 42677118-969f-441d-8d5a-44b5eb4f1bbe

📥 Commits

Reviewing files that changed from the base of the PR and between f129687 and 6c1ce26.

📒 Files selected for processing (1)
  • src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/index.tsx
📝 Walkthrough

Walkthrough

This PR removes the uuid package dependency and replaces all uuid.v4() calls with the native crypto.randomUUID() function across the codebase. Changes span 12 files including package configuration, type definitions, components, Redux reducers, and tests.

Changes

Cohort / File(s) Summary
Dependency Manifest Updates
package.json, docs/user_guide/assets/licenses/frontend_licenses.txt
Removes uuid package and updates license manifest to remove uuid entry and update Babel packages to newer versions.
UUID Generation Migration
src/backend/sessionStorage.ts, src/types/goals.ts, src/types/semanticDomain.ts, src/types/word.ts, src/components/DataEntry/DataEntryTable/index.tsx, src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/index.tsx, src/goals/MergeDuplicates/MergeDupsTreeTypes.ts, src/goals/MergeDuplicates/Redux/MergeDupsReducer.ts
Replaces uuid.v4() calls with crypto.randomUUID() and removes corresponding imports across backend, type definitions, and component files.
Test Updates
src/components/DataEntry/DataEntryTable/tests/index.test.tsx, src/goals/MergeDuplicates/Redux/tests/MergeDupsReducer.test.ts
Updates test mocks to spy on crypto.randomUUID() instead of uuid.v4(), with deterministic UUID generator implementation added to MergeDupsReducer tests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

dependencies, javascript, frontend, backend, test, 🟨Medium

Suggested reviewers

  • jasonleenaylor

Poem

🐰 A rabbit hops through code so bright,
Goodbye uuid, native crypto's right!
RandomUUID now takes the stage,
Twelve files turn a cleaner page!
Dependencies trimmed, the garden's neat! 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the primary change: replacing uuid.v4 with crypto.randomUUID throughout the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nix-uuid

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 57 minutes and 17 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.94%. Comparing base (a7bf167) to head (6c1ce26).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4271   +/-   ##
=======================================
  Coverage   75.94%   75.94%           
=======================================
  Files         303      303           
  Lines       11352    11352           
  Branches     1403     1403           
=======================================
  Hits         8621     8621           
  Misses       2330     2330           
  Partials      401      401           
Flag Coverage Δ
backend 87.23% <ø> (ø)
frontend 66.79% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

coderabbitai[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@jasonleenaylor reviewed 13 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on imnasnainaec).

@imnasnainaec imnasnainaec marked this pull request as draft April 27, 2026 18:56
@imnasnainaec

This comment was marked as resolved.

@imnasnainaec imnasnainaec marked this pull request as ready for review April 30, 2026 19:19
@imnasnainaec imnasnainaec merged commit 6d00401 into master Apr 30, 2026
20 checks passed
@imnasnainaec imnasnainaec deleted the nix-uuid branch April 30, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: DataEntry component: TreeView dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation frontend goal: MergeDup goal 🟩Low Low-priority PR test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants