Skip to content

Conversation

@BioPhoton
Copy link
Collaborator

@BioPhoton BioPhoton commented Jan 27, 2026

@github-actions github-actions bot added 📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🧩 utils labels Jan 27, 2026
@nx-cloud
Copy link

nx-cloud bot commented Jan 27, 2026

View your CI Pipeline Execution ↗ for commit e03a7ac

Command Status Duration Result
nx run-many --targets=code-pushup --parallel=fa... ❌ Failed 13m 47s View ↗
nx run-many -t unit-test,int-test ❌ Failed 19s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-01 04:32:47 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 27, 2026

Open in StackBlitz

@code-pushup/ci

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

@code-pushup/cli

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

@code-pushup/core

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

@code-pushup/create-cli

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

@code-pushup/models

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

@code-pushup/nx-plugin

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

@code-pushup/axe-plugin

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

@code-pushup/coverage-plugin

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

@code-pushup/eslint-plugin

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

@code-pushup/js-packages-plugin

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

@code-pushup/jsdocs-plugin

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

@code-pushup/lighthouse-plugin

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

@code-pushup/typescript-plugin

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

@code-pushup/utils

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

commit: e03a7ac

# Conflicts:
#	packages/utils/docs/profiler.md
#	packages/utils/src/lib/profiler/constants.ts
#	packages/utils/src/lib/profiler/profiler.int.test.ts
#	packages/utils/src/lib/profiler/profiler.ts
#	packages/utils/src/lib/profiler/profiler.unit.test.ts
@github-actions
Copy link
Contributor

github-actions bot commented Jan 31, 2026

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit f4bebc5 with previous commit 7b6e72c.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Type Safety 🟡 67 🟡 56 ↓ −11.1
Bug prevention 🟡 75 🟡 67 ↓ −8.3
Security 🔴 47 🔴 45 ↓ −2.5
Performance 🔴 33 🔴 32 ↓ −1.5
Documentation 🟡 53 🟡 53 ↑ +0.3
Code coverage 🟢 93 🟢 93 ↓ −0.1
Axe Accessibility 🟡 88 🟡 88 ↓ −0.1
Code style 🟢 100 🟢 100
Updates 🟡 78 🟡 78
Miscellaneous 🟡 67 🟡 67
Accessibility 🟢 92 🟢 92
Best Practices 🟢 100 🟢 100
SEO 🟢 92 🟢 92
👍 1 group improved, 👎 4 groups regressed, 👍 5 audits improved, 👎 10 audits regressed, 15 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
TypeScript Problems 🔴 33 🔴 0 ↓ −33.3
JS packages npm audit 🔴 47 🔴 45 ↓ −2.5
Lighthouse Performance 🔴 33 🔴 32 ↓ −1.5
JSDocs coverage Documentation coverage 🟡 53 🟡 53 ↑ +0.3
Code coverage Code coverage metrics 🟢 93 🟢 93 ↓ −0.1

29 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse Initial server response time was short 🟥 Root document took 620 ms 🟩 Root document took 530 ms ↓ −15 %
TypeScript No implicit any errors 🟩 passed 🟥 9 errors ↑ +∞ %
Lighthouse First Contentful Paint 🟥 3.1 s 🟥 3.5 s ↑ +13.9 %
Lighthouse Speed Index 🟥 7.3 s 🟥 8.6 s ↑ +17.6 %
JSDocs coverage Variables coverage 🟥 274 undocumented variables 🟥 274 undocumented variables  +0 %
JSDocs coverage Types coverage 🟥 264 undocumented types 🟥 269 undocumented types ↑ +1.9 %
JS packages Vulnerabilities for npm prod dependencies. 🟨 11 vulnerabilities (2 high, 2 moderate, 7 low) 🟨 11 vulnerabilities (2 high, 3 moderate, 6 low)  +0 %
Lighthouse Total Blocking Time 🟥 3,150 ms 🟥 2,330 ms ↓ −25.9 %
JSDocs coverage Methods coverage 🟨 10 undocumented methods 🟨 12 undocumented methods ↑ +20 %
Lighthouse Time to Interactive 🟥 14.2 s 🟥 14.6 s ↑ +2.5 %
JSDocs coverage Properties coverage 🟥 42 undocumented properties 🟥 43 undocumented properties ↑ +2.4 %
JSDocs coverage Functions coverage 🟥 585 undocumented functions 🟥 584 undocumented functions ↓ −0.2 %
Code coverage Branch coverage 🟨 89.2 % 🟨 89 % ↓ −0.2 %
Code coverage Function coverage 🟩 94.4 % 🟩 94.2 % ↓ −0.1 %
Code coverage Line coverage 🟩 92.8 % 🟩 92.8 % ↓ −0.1 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 2,087 KiB 🟩 Total size was 2,083 KiB ↓ −0.2 %
Lighthouse Minimizes main-thread work 🟥 13.9 s 🟥 12.3 s ↓ −11.5 %
Lighthouse Uses efficient cache policy on static assets 🟨 31 resources found 🟨 31 resources found ↑ +0.1 %
Lighthouse Max Potential First Input Delay 🟥 1,190 ms 🟥 1,630 ms ↑ +36.6 %
Lighthouse Reduce unused JavaScript 🟥 Potential savings of 225 KiB 🟥 Potential savings of 225 KiB ↓ −31.4 %
Lighthouse Metrics 🟩 100% 🟩 100% ↑ +2.5 %
Lighthouse Largest Contentful Paint 🟥 11.7 s 🟥 12.0 s ↑ +2.5 %
Lighthouse Server Backend Latencies 🟩 640 ms 🟩 350 ms ↓ −44.5 %
Lighthouse Remove duplicate modules in JavaScript bundles 🟥 Potential savings of 86 KiB 🟥 Potential savings of 86 KiB ↓ −62.2 %
Lighthouse JavaScript execution time 🟥 4.6 s 🟥 4.8 s ↑ +4.2 %
Lighthouse Reduce unused CSS 🟥 Potential savings of 125 KiB 🟥 Potential savings of 139 KiB ↓ −16.7 %
Lighthouse Network Round Trip Times 🟩 10 ms 🟩 50 ms ↑ +672.8 %
TypeScript Semantic errors 🟥 43 errors 🟥 80 errors ↑ +86 %
Lighthouse ARIA tooltip elements have accessible names 🟩 passed 🟩 0 ↓ −100 %
Axe ARIA hidden element must not be focusable or contain focusable elements 🟩 201 elements 🟩 202 elements ↑ +0.5 %

649 other audits are unchanged.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 31, 2026

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit f4bebc5 with previous commit 7b6e72c.

💼 Project utils

🤨 Code PushUp report has both improvements and regressions.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Documentation 🟡 61 🟡 61 ↑ +0.5
Code coverage 🟢 95 🟢 94 ↓ −0.3

4 other categories are unchanged.

👍 1 group improved, 👎 1 group regressed, 👍 3 audits improved, 👎 5 audits regressed

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
JSDocs coverage Documentation coverage 🟡 61 🟡 61 ↑ +0.5
Code coverage Code coverage metrics 🟢 95 🟢 94 ↓ −0.3

13 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
JSDocs coverage Variables coverage 🟥 50 undocumented variables 🟥 50 undocumented variables  +0 %
JSDocs coverage Types coverage 🟨 55 undocumented types 🟥 60 undocumented types ↑ +9.1 %
JSDocs coverage Methods coverage 🟨 10 undocumented methods 🟨 12 undocumented methods ↑ +20 %
JSDocs coverage Functions coverage 🟥 243 undocumented functions 🟥 242 undocumented functions ↓ −0.4 %
JSDocs coverage Properties coverage 🟥 39 undocumented properties 🟥 40 undocumented properties ↑ +2.6 %
Code coverage Branch coverage 🟩 91.9 % 🟩 91.4 % ↓ −0.5 %
Code coverage Function coverage 🟩 95.8 % 🟩 95.5 % ↓ −0.3 %
Code coverage Line coverage 🟩 97.8 % 🟩 97.7 % ↓ −0.2 %

436 other audits are unchanged.


13 other projects are unchanged.

@BioPhoton BioPhoton marked this pull request as ready for review February 1, 2026 03:28
@BioPhoton BioPhoton requested a review from Copilot February 1, 2026 03:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors NodeJS profiling persistence to use a sharded write-ahead log (WAL) flow and updates trace serialization/normalization utilities and tests accordingly.

Changes:

  • Introduces ShardedWal + process/time ID helpers and wires NodeJS profiler persistence to shard/merge traces.
  • Refactors trace event encoding/decoding and trace file generation to support deterministic output.
  • Moves trace JSON(L) normalization helpers from @code-pushup/test-utils into packages/utils/mocks and updates Vitest include patterns.

Reviewed changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
testing/test-utils/src/lib/utils/omit-trace-json.unit.test.ts Removes old trace JSONL normalization unit tests from test-utils.
testing/test-utils/src/lib/utils/omit-trace-json.ts Removes old trace JSONL normalization helper from test-utils.
testing/test-utils/src/index.ts Stops exporting removed omit-trace-json helper.
testing/test-setup-config/src/lib/vitest-config-factory.unit.test.ts Updates Vitest config factory tests to include mocks/** patterns.
testing/test-setup-config/src/lib/vitest-config-factory.ts Adds mocks/** include globs for unit/int tests.
packages/utils/src/lib/wal.ts Refactors WAL types/codec behavior; removes in-file sharded WAL implementation.
packages/utils/src/lib/wal.int.test.ts Adds integration tests for WriteAheadLogFile.
packages/utils/src/lib/wal-sharded.unit.test.ts Adds unit tests for new ShardedWal behavior (memfs).
packages/utils/src/lib/wal-sharded.ts Introduces new ShardedWal implementation and shard ID generation.
packages/utils/src/lib/wal-sharded.int.test.ts Adds integration tests for ShardedWal file behavior.
packages/utils/src/lib/user-timing-extensibility-api-utils.ts Adjusts track config typing to omit dataType.
packages/utils/src/lib/profiler/wal-json-trace.unit.test.ts Expands codec + trace format tests for new serialization behavior.
packages/utils/src/lib/profiler/wal-json-trace.ts Updates trace WAL format to use new codec + trace file helpers and base name constant.
packages/utils/src/lib/profiler/trace-file.type.ts Simplifies trace event typings and trace container typing.
packages/utils/src/lib/profiler/trace-file-utils.unit.test.ts Updates tests to new trace event factories and encoding/decoding.
packages/utils/src/lib/profiler/trace-file-utils.ts Refactors trace event factories and adds event encode/decode + (de)serialization helpers.
packages/utils/src/lib/profiler/profiler.unit.test.ts Updates unit tests to reflect new enable-state API usage.
packages/utils/src/lib/profiler/profiler.ts Adds debug state to profiler options and env var handling.
packages/utils/src/lib/profiler/profiler.int.test.ts Updates integration tests for new profiler defaults and track payload expectations.
packages/utils/src/lib/profiler/profiler-node.ts Switches NodeJS profiler persistence to ShardedWal and updates lifecycle/stats.
packages/utils/src/lib/profiler/profiler-node.int.test.ts Reworks NodeJS profiler integration tests for sharded output, snapshots, multiprocess test.
packages/utils/src/lib/profiler/constants.ts Adds sharding/output env vars and switches debug env var to DEBUG.
packages/utils/src/lib/profiler/snapshots/sharded-path-trace-events.jsonl Removes snapshot for previous single-shard JSONL output.
packages/utils/src/lib/profiler/snapshots/entries-write-to-shard.jsonl Adds snapshot for normalized shard JSONL output.
packages/utils/src/lib/profiler/snapshots/entries-write-to-shard.json Adds snapshot for normalized finalized trace JSON output.
packages/utils/src/lib/profiler/snapshots/debugMode-test.json Adds snapshot for debug-mode trace output.
packages/utils/src/lib/profiler/snapshots/custom-tracks-trace-events.jsonl Removes snapshot for previous custom-tracks JSONL output.
packages/utils/src/lib/profiler/snapshots/comprehensive-stats-trace-events.jsonl Removes snapshot for previous stats JSONL output.
packages/utils/src/lib/profiler/snapshots/buffered-test.json Adds snapshot for buffered-entry capture output.
packages/utils/src/lib/process-id.unit.test.ts Adds tests for new time/process/thread ID utilities.
packages/utils/src/lib/process-id.ts Introduces helpers for unique time/process/thread/instance IDs.
packages/utils/src/lib/performance-observer.unit.test.ts Updates tests for new debug env var and buffered behavior changes.
packages/utils/src/lib/performance-observer.ts Refactors buffered capture strategy and standardizes debug env var usage.
packages/utils/src/lib/create-runner-files.ts Uses new getUniqueProcessThreadId for per-runner uniqueness.
packages/utils/mocks/omit-trace-json.unit.test.ts Adds tests for new trace normalization helpers in mocks.
packages/utils/mocks/omit-trace-json.ts Adds new trace JSON/JSONL loading + normalization utilities for deterministic snapshots.
packages/utils/mocks/multiprocess-profiling/utils.ts Adds multiprocess profiling helper utilities.
packages/utils/mocks/multiprocess-profiling/profiler-worker.mjs Adds multiprocess coordinator script for profiling tests/demos.
packages/utils/mocks/multiprocess-profiling/profiler-worker-child.mjs Adds multiprocess child worker script for profiling tests/demos.
packages/utils/mocks/README.md Documents multiprocess profiling mocks usage.
packages/utils/eslint.config.js Allows sync fs usage in WAL/profiler test files.
packages/utils/docs/profiler.md Updates profiler docs for sharded WAL, env vars, state machine; includes new config tables.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to +30
const filePath = path.join(testDir, 'test.log');
walFile = new WriteAheadLogFile({ file: filePath, codec: stringCodec() });

Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

WriteAheadLogFile<string> is constructed with stringCodec(), but stringCodec is now declared as Codec<T extends object>. This won’t type-check. Either adjust the codec typing/implementation to support strings or update the test (and any call sites) to use object records.

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +17
let shardedWal: ShardedWal<string>;

Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

ShardedWal is declared as ShardedWal<T extends object>, but this test uses ShardedWal<string>, which won’t compile under the new constraint. Either loosen the generic constraint or update tests/usage to use object records and an appropriate codec.

Copilot uses AI. Check for mistakes.
Comment on lines +112 to +116
format: profilerFormat,
measureName,
outDir = PROFILER_PERSIST_OUT_DIR,
enabled,
filename,
debugEnvVar = PROFILER_DEBUG_ENV_VAR,
debug,
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

enabled and debug are destructured here but never used, which will trip unused-variable linting and also means the NodejsProfilerOptions debug flag has no effect on profiler debug mode.

Copilot uses AI. Check for mistakes.
Comment on lines +156 to +159
constructor(options: { id?: string; file: string; codec: Codec<T> }) {
const { file, codec } = options;
this.#file = file;
const c = createTolerantCodec(codec);
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

WriteAheadLogFile constructor now accepts an optional id, but the value is never stored or used. Either remove the parameter or persist/use it (e.g., for stats/logging) to avoid a misleading API.

Copilot uses AI. Check for mistakes.
Comment on lines +283 to 290
export const stringCodec = <T extends object = object>(): Codec<T> => ({
encode: v => JSON.stringify(v),
decode: v => {
try {
return JSON.parse(v) as T;
} catch {
return v as T;
return v as unknown as T;
}
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

stringCodec is typed as Codec<T extends object> but the implementation still round-trips strings at runtime (via JSON.stringify/parse). This creates a type-level mismatch with usages like WriteAheadLogFile<string>({ codec: stringCodec() }). Either widen the generic constraint (e.g. T extends object | string) or provide a separate JSON-object codec and keep a true string passthrough codec.

Copilot uses AI. Check for mistakes.
| `format` | `ProfilerFormat<DomainEvents>` | _required_ | WAL format configuration for sharded write-ahead logging, including `encodePerfEntry` |
| `measureName` | `string` | _auto-generated_ | Optional folder name for sharding. If not provided, a new group ID will be generated |
| `outDir` | `string` | `'tmp/profiles'` | Output directory for WAL shards and final files |
| `outBaseName` | `string` | _optional_ | Override the base name for WAL files (overrides format.baseName) |
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The options table lists outBaseName, but there is no corresponding option in NodejsProfilerOptions/PersistOptions (and no code uses it). This is misleading API documentation; either implement the option or remove it from the docs.

Suggested change
| `outBaseName` | `string` | _optional_ | Override the base name for WAL files (overrides format.baseName) |

Copilot uses AI. Check for mistakes.
Comment on lines +267 to 269
export type WalFormat<T extends object> = {
/** Base name for the WAL (e.g., "trace") */
baseName: string;
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

WalFormat is now constrained to T extends object, but the WAL implementation and tests in this PR still write primitive/string records. This type change will prevent using WalFormat<string> (and ShardedWal<string>) at compile time. Either restore T extends object | string or update all call sites/tests to use object records/codecs only.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

@BioPhoton BioPhoton Feb 1, 2026

Choose a reason for hiding this comment

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

@copilot If I add string | objects the typing gets complicated as every T has to extend it... is there a better more ergonomic option?

BioPhoton and others added 2 commits February 1, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🧩 utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants