Skip to content

Conversation

@GdMacmillan
Copy link
Contributor

@GdMacmillan GdMacmillan commented Oct 15, 2025

Ready for review Powered by Pull Request Badge

Summary

Implements node js compatible crypto.randomUUID() function for Elide's Node built-in crypto module.

  • Function for generating RFC-4122 v4 compliant UUID's. This implementation uses java.util.UUID.randomUUID() to generate the uuid and follows existing patterns for Node module implementations in Elide.

Validated

  • Compiles and passes tests in Devcontainer on x86 ubuntu

Changelog

  • feat(node): implement crypto.randomUUID() for RFC-4122 v4 UUID generation
  • feat(node): Add tests for UUID format, uniqueness, lowercase, and options parameters

@GdMacmillan GdMacmillan requested a review from sgammon as a code owner October 15, 2025 21:30
@sgammon sgammon changed the title \ feat(graalvm): crypto.randomUUID Oct 15, 2025
@sgammon sgammon self-assigned this Oct 15, 2025
@sgammon sgammon added lang:javascript Issues relating to JavaScript api:node Node API and stdlib labels Oct 15, 2025
@sgammon sgammon added this to Elide Oct 15, 2025
@sgammon sgammon added this to the Release R18: Beta milestone Oct 15, 2025
@sgammon sgammon moved this to In Progress in Elide Oct 15, 2025
@sgammon sgammon changed the title feat(graalvm): crypto.randomUUID feat(node): crypto.randomUUID Oct 15, 2025
@GdMacmillan
Copy link
Contributor Author

Hello, I'm interested in using this project and crypto.randomUUID was the first Node API gap I encountered. This is my first PR here so happy to take any constructive criticism or feedback regarding the code structure, formatting, test coverage, etc...

@codecov
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.57%. Comparing base (5f3bbf4) to head (1cc2d0c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ain/kotlin/elide/runtime/node/crypto/NodeCrypto.kt 81.81% 1 Missing and 1 partial ⚠️
...tlin/elide/runtime/intrinsics/js/node/CryptoAPI.kt 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1697      +/-   ##
==========================================
+ Coverage   40.56%   40.57%   +0.01%     
==========================================
  Files         866      867       +1     
  Lines       40049    40059      +10     
  Branches     5696     5697       +1     
==========================================
+ Hits        16246    16255       +9     
+ Misses      21816    21815       -1     
- Partials     1987     1989       +2     
Flag Coverage Δ
jvm 40.57% <75.00%> (+0.01%) ⬆️
lib 40.57% <75.00%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
...tlin/elide/runtime/intrinsics/js/node/CryptoAPI.kt 0.00% <0.00%> (ø)
...ain/kotlin/elide/runtime/node/crypto/NodeCrypto.kt 88.88% <81.81%> (+11.11%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f3bbf4...1cc2d0c. Read the comment docs.

🚀 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.

@sgammon
Copy link
Member

sgammon commented Oct 15, 2025

Hey @GdMacmillan! Thanks so much for your PR 😄 fantastic work. We've rarely seen contributors nail a PR this fast. Next up:

  1. We'll review and approve
  2. You can merge
  3. Then, in the beta10 release, we'll credit you for this! 🎉

The team is all on Discord and genuinely loves hearing from people. If you are ever stuck as a user or contributor, don't hesitate to reach out there. The more we learn about use cases, the more we can guide what comes next.

@sgammon
Copy link
Member

sgammon commented Oct 15, 2025

@GdMacmillan to fix the apiCheck task:

./gradlew -Pelide.abiValidate=true apiCheck

Then, with any failing modules:

./gradlew -Pelide.abiValidate=true :packages:<module>:apiDump

Run apiCheck again, repeat until green. In this case it should just be

./gradlew -Pelide.abiValidate=true :packages:graalvm:apiDump

Then, commit the result, and it should pass (it will update the .api file in that module)

(Also, make sure to --signoff your commit so DCO passes... this constitutes agreement to our contributor stuff in .github/*.md)

\
feat(node): implment crypto.randomUUID()\
\
Adds Node.js-compatible crypto.randomUUID() implementation that returns \
RFC-4122 v4 UUID strings in lowercase format.\
\
- Add randomUUID() to CryptoAPI interface\
- Implement NodeCrypto module with ProxyExecutable exposure\
- Add tests covering changes (5 tests) for format, uniqueness and options\
- Uses java.util.UUID.randomUUID() for secure random generation

Signed-off-by: Gordon MacMillan <gmacilla@ymail.com>
Signed-off-by: Gordon MacMillan <gmacilla@ymail.com>
Signed-off-by: Gordon MacMillan <gmacilla@ymail.com>
@GdMacmillan GdMacmillan force-pushed the feat/crypto-randomuuid branch from a6547f4 to 1cc2d0c Compare October 15, 2025 23:41
@GdMacmillan
Copy link
Contributor Author

Hey @GdMacmillan! Thanks so much for your PR 😄 fantastic work. We've rarely seen contributors nail a PR this fast. Next up:

1. We'll review and approve

2. You can merge

3. Then, in the `beta10` release, we'll credit you for this! 🎉

The team is all on Discord and genuinely loves hearing from people. If you are ever stuck as a user or contributor, don't hesitate to reach out there. The more we learn about use cases, the more we can guide what comes next.

Thank you, I will join the discord to talk more about my use case!

@sgammon sgammon merged commit e2e3abc into elide-dev:main Oct 16, 2025
16 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Elide Oct 16, 2025
@sgammon sgammon mentioned this pull request Oct 30, 2025
32 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api:node Node API and stdlib lang:javascript Issues relating to JavaScript

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants