feat: migrate uuid v4 to v7 for chronologically sortable ids (#10378)#10935
Open
sh1vam31 wants to merge 6 commits intomedic:masterfrom
Open
feat: migrate uuid v4 to v7 for chronologically sortable ids (#10378)#10935sh1vam31 wants to merge 6 commits intomedic:masterfrom
sh1vam31 wants to merge 6 commits intomedic:masterfrom
Conversation
Contributor
Author
|
Hi @dianabarsan, I have completed the migration from UUID v4 to UUID v7 across the codebase to enable chronologically sortable IDs for improved CouchDB performance. Replaced uuid.v4 with uuid.v7 across the entire project (Source + Tests). Kindly review this PR. |
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.
Description
Fixes: #10378
This PR implements a project-wide migration from UUID v4 to UUID v7 as requested in issue #10378. Moving to v7 ensures that all generated IDs (contacts, reports, tasks, etc.) are time-prefixed and chronologically sortable, which will significantly improve B-tree indexing performance in CouchDB.
Changes:
Source Code Migration: Updated all instances of uuid.v4() to uuid.v7() (aliased as uuidv7() for clarity) in webapp, api, sentinel, and shared-libs.
API Enhancements: Modified api/src/routing.js to use UUID v7 for request IDs and increased shortUuid entropy from 12 to 16 characters to prevent collisions within the same millisecond.
Test Suite Updates: Performed a bulk update of all rosie factories and unit tests to align with the new UUID format.
Dependency Management: Standardized the use of the uuid package (v10+) and added @types/uuid to resolve TypeScript resolution issues in the webapp.
IDE & Linting: Fixed 100+ linting errors and shadowed variable issues introduced during the migration.
Verification Performed:
Verified chronological sortability of 100 generated IDs using a custom script.
Verified that all document IDs are explicitly assigned, maintaining compatibility with PouchDB's internal ID management.
Ran npm run lint project-wide (zero errors).
Verified core unit tests for api and webapp services.
Code review checklist
can_view_old_navigationpermission to see the old design. Test it has appropriate design for RTL languages.License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.