Skip to content

Conversation

@beaussan
Copy link
Contributor

Summary

Fixes a race condition when running the same plugin for multiple projects in parallel (e.g., via Nx targets).

Problem

When two processes started within the same millisecond, the timestamp-based directory naming in createRunnerFiles would collide:

node_modules/.code-pushup/{pluginSlug}/{timestamp}/

This caused one process to delete the output directory (in executeRunnerConfig) while another was still using it, leading to failures.

Solution

Added process.pid and a random suffix to the directory name to ensure uniqueness:

const uniqueId = `${Date.now()}-${process.pid}-${Math.random().toString(36).slice(2, 8)}`;

This ensures that even when multiple processes run simultaneously, each gets its own unique working directory.

When running the same plugin for multiple projects in parallel (e.g., via
Nx targets), the timestamp-based directory naming could collide if two
processes started within the same millisecond.

This caused one process to delete the output directory while another was
still using it, leading to failures.

The fix adds process.pid and a random suffix to the directory name,
ensuring uniqueness even when multiple processes run simultaneously.
@nx-cloud
Copy link

nx-cloud bot commented Jan 19, 2026

View your CI Pipeline Execution ↗ for commit 49d8341

Command Status Duration Result
nx run ci:code-pushup -- merge-diffs --files=/h... ✅ Succeeded 6s View ↗
nx run-many --targets=code-pushup --parallel=fa... ✅ Succeeded 1m 21s View ↗
nx run-many -t unit-test,int-test ✅ Succeeded <1s View ↗
nx run-many --targets=code-pushup --parallel=fa... ✅ Succeeded 1m 22s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-20 12:27:36 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 19, 2026

Open in StackBlitz

@code-pushup/ci

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/ci@1222

@code-pushup/cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1222

@code-pushup/core

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/core@1222

@code-pushup/create-cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/create-cli@1222

@code-pushup/models

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1222

@code-pushup/nx-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/nx-plugin@1222

@code-pushup/axe-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/axe-plugin@1222

@code-pushup/eslint-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/eslint-plugin@1222

@code-pushup/coverage-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/coverage-plugin@1222

@code-pushup/js-packages-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/js-packages-plugin@1222

@code-pushup/jsdocs-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/jsdocs-plugin@1222

@code-pushup/lighthouse-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/lighthouse-plugin@1222

@code-pushup/typescript-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/typescript-plugin@1222

@code-pushup/utils

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1222

commit: 49d8341

@beaussan beaussan marked this pull request as ready for review January 19, 2026 21:18
@github-actions
Copy link
Contributor

github-actions bot commented Jan 19, 2026

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit 1d7ffda with previous commit 1d7ffda.

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Performance 🔴 40 🔴 32 ↓ −7.3
Bug prevention 🟡 75 🟡 75
Code style 🟢 100 🟢 100
Code coverage 🟢 92 🟢 92
Security 🟡 51 🟡 51
Updates 🟡 78 🟡 78
Type Safety 🟡 67 🟡 67
Miscellaneous 🟡 67 🟡 67
Documentation 🔴 42 🔴 42
Accessibility 🟢 92 🟢 92
Best Practices 🟢 100 🟢 100
SEO 🟢 92 🟢 92
Axe Accessibility 🟡 88 🟡 88
👎 1 group regressed, 👍 1 audit improved, 👎 4 audits regressed, 13 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Lighthouse Performance 🔴 40 🔴 32 ↓ −7.3

33 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse Initial server response time was short 🟥 Root document took 630 ms 🟩 Root document took 580 ms ↓ −8.6 %
Lighthouse Speed Index 🟥 6.0 s 🟥 7.5 s ↑ +26.1 %
Lighthouse Total Blocking Time 🟥 1,280 ms 🟥 3,120 ms ↑ +143.3 %
Lighthouse Time to Interactive 🟥 12.1 s 🟥 14.7 s ↑ +21.3 %
Lighthouse First Contentful Paint 🟥 3.1 s 🟥 3.3 s ↑ +5 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 2,112 KiB 🟩 Total size was 2,100 KiB ↓ −0.6 %
Lighthouse Minimizes main-thread work 🟥 7.0 s 🟥 13.1 s ↑ +87.1 %
Lighthouse JavaScript execution time 🟥 3.2 s 🟥 6.2 s ↑ +90.9 %
Lighthouse Metrics 🟩 100% 🟩 100% ↑ +21.3 %
Lighthouse Largest Contentful Paint 🟥 10.4 s 🟥 12.2 s ↑ +17.4 %
Lighthouse Max Potential First Input Delay 🟥 830 ms 🟥 1,690 ms ↑ +104.4 %
Lighthouse Server Backend Latencies 🟩 1,000 ms 🟩 520 ms ↓ −48.3 %
Lighthouse Reduce unused CSS 🟥 Potential savings of 95 KiB 🟥 Potential savings of 95 KiB ↓ −33.3 %
Lighthouse Remove duplicate modules in JavaScript bundles 🟥 Potential savings of 82 KiB 🟥 Potential savings of 88 KiB ↓ −50 %
Lighthouse Reduce unused JavaScript 🟥 Potential savings of 226 KiB 🟥 Potential savings of 226 KiB ↓ −13.3 %
Lighthouse Uses efficient cache policy on static assets 🟨 31 resources found 🟨 31 resources found ↑ +0.1 %
Lighthouse Network Round Trip Times 🟩 70 ms 🟩 60 ms ↓ −13.8 %
Lighthouse Cumulative Layout Shift 🟩 0.003 🟩 0 ↓ −100 %

661 other audits are unchanged.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 19, 2026

Code PushUp

😐 Code PushUp report is unchanged – compared current commit 1d7ffda with previous commit 1d7ffda.


All of 14 projects are unchanged.

Copy link
Collaborator

@BioPhoton BioPhoton left a comment

Choose a reason for hiding this comment

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

added a suggestion

@BioPhoton BioPhoton merged commit 90f7adc into code-pushup:main Jan 20, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants