EPMRPP-117362 || Replace uniqid and uuid with built-in crypto.randomUUID#269
Conversation
Consolidates internal id generation onto Node's built-in crypto.randomUUID(), removing both the uniqid and uuid dependencies. Addresses reportportal/agent-js-playwright#210 (outdated uuid@9). - lib/report-portal-client.js, statistics/client-id.js: use crypto.randomUUID() - __tests__/client-id.spec.js: updated to match - package.json: drop uniqid + uuid; bump engines.node to >=14.17.0 - CHANGELOG: note the change Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
WalkthroughThis PR replaces the ChangesUUID generation migration
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Summary
Addresses reportportal/agent-js-playwright#210 — the client shipped an outdated
uuid@9.The client previously depended on two id-generation libraries:
uniqid— used inlib/report-portal-client.js(getUniqId()) for internaltempIdsuuid— used instatistics/client-id.jsfor the anonymous analyticsclient_idThis consolidates id generation onto Node's built-in
crypto.randomUUID(), removing both external packages.crypto.randomUUID()returns an RFC-4122 v4 UUID (the same thinguuid'sv4()produces — modernuuiddelegates to it internally on Node ≥18), so there is no functional change to the values produced.Why not just bump
uuidto v14?uuid@14is ESM-first (ships anexportsmap + modern.d.ts). While Node'srequire()resolves its CJS build fine at runtime, this repo's dev toolchain does not:Unexpected token 'export'..d.ts(TS1383).import/no-unresolved) can't follow itsexportsmap.Keeping
uuidwould require a Jest shim,tsconfigskipLibCheck, and an ESLint rule change. Using the built-in avoids all of that and removes a dependency instead of adding config.Changes
uniqidanduuidfromdependencies.lib/report-portal-client.js+statistics/client-id.js: usecrypto.randomUUID().__tests__/client-id.spec.jsaccordingly.engines.nodeto>=14.17.0(whencrypto.randomUUIDlanded).Breaking change
Minimum Node.js is now 14.17.0 (was
>=14.x, which allowed 14.0–14.16 that lackcrypto.randomUUID). The internaltempIdformat changes from auniqidhex string to a UUID v4 string;tempIdis an opaque, client-internal correlation handle (never sent to the server as-is), so this is not observable to servers.Verification
npm run lint,npm run build, andnpm testall pass locally (9 suites, 175 tests).🤖 Generated with Claude Code via the ai-workflow pipeline.
Summary by CodeRabbit
Bug Fixes
Chores