Skip to content

fix(@angular-devkit/core): use crypto.randomUUID instead of Date.now for unique string in tmp file names #30737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025

Conversation

josephperrott
Copy link
Member

@josephperrott josephperrott commented Jul 17, 2025

Use crypto.randomUUID instead of Date.now for unique string in the tmpdir path name for a TempScopedNodeJsSyncHost to prevent naming conflicts. When performaning tests on a fast enough machine which rely on this class, two instances can be instantiated within one second and can cause failures because the path already exists that is attempted to be used. Using crypto.randomUUID should not run into this issue.

@josephperrott josephperrott requested a review from clydin July 17, 2025 18:20
@josephperrott josephperrott added area: @angular-devkit/core target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Jul 17, 2025
@josephperrott josephperrott force-pushed the use-performance branch 3 times, most recently from 1c6f210 to 0cce7f4 Compare July 17, 2025 19:50
@josephperrott josephperrott changed the title fix(@angular-devkit/core): use performance.now instead of Date.now for timestamp in tmp file names fix(@angular-devkit/core): use crypto.randomUUID instead of Date.now for unique string in tmp file names Jul 17, 2025
@clydin clydin added action: merge The PR is ready for merge by the caretaker and removed action: merge The PR is ready for merge by the caretaker labels Jul 18, 2025
@ngbot

This comment was marked as outdated.

…for unique string in tmp file names

Use crypto.randomUUID instead of Date.now for unique string in the tmpdir path name for a TempScopedNodeJsSyncHost to prevent naming conflicts.
When performaning tests on a fast enough machine which rely on this class, two instances can be instantiated within one second and can
cause failures because the path already exists that is attempted to be used. Using crypto.randomUUID should not run into this issue.
@jkrems jkrems merged commit 7595e1f into angular:main Jul 18, 2025
30 checks passed
@jkrems
Copy link
Contributor

jkrems commented Jul 18, 2025

The changes were merged into the following branches: main, 20.1.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: @angular-devkit/core target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants