Skip to content

Conversation

@BioPhoton
Copy link
Collaborator

@BioPhoton BioPhoton commented Jan 9, 2026

Related: #1197

This PR includes:

  • types for source sink flows
  • wal.ts - general WriteAheadLog and sharded WAL inc format and filenames
  • wal-trace-json.ts traceEvent specific login for a WAL
  • profiler constants to control WAL leader
  • moved trace utils into profiler

Note

This PR addresses a comment related to logging.
It could also be used as file output for the logger

Warning

All filesystem operations in WAL—and indirectly in the profiler—are synchronous by design.
The eslint rules are disables over file name pattern

Why synchronous fs is used for WAL code?

  • Profilers are side-channels, not business logic
  • Data must never be lost, reordered, or partially written
  • process.on('exit') cannot safely run async I/O
  • Sync writes guarantee ordering + durability
  • Profiler I/O volume is small → overhead is negligible
  • Crash-safety > throughput

Note

Introduces a synchronous Write-Ahead Log system and integrates it with profiler trace generation.

  • New wal.ts: WriteAheadLogFile, ShardedWal, codecs (stringCodec, createTolerantCodec), sharding IDs/paths, finalize/cleanup helpers, and AppendableSink interface
  • Profiler: add getProfilerId, new constants, and move/expand trace utils (trace-file-utils.ts) with encode/decode helpers, metadata, and entryToTraceEvents
  • New wal-json-trace.ts: generate complete Chrome trace content and expose traceEventWalFormat
  • Refactor PerformanceObserverSink to use AppendableSink.append and update mocks/tests; remove legacy sink-source.type.ts
  • Set realistic time origin in tests; add many unit/integration tests
  • ESLint: disable n/no-sync for wal*.ts files

Written by Cursor Bugbot for commit 953a3e7. This will update automatically on new commits. Configure here.

@nx-cloud
Copy link

nx-cloud bot commented Jan 9, 2026

View your CI Pipeline Execution ↗ for commit 953a3e7

Command Status Duration Result
nx affected -t int-test --parallel=3 ✅ Succeeded 1m 32s View ↗
nx affected -t unit-test --parallel=3 ✅ Succeeded 43s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-26 22:21:37 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 9, 2026

Open in StackBlitz

@code-pushup/ci

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

@code-pushup/cli

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

@code-pushup/core

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

@code-pushup/create-cli

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

@code-pushup/models

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

@code-pushup/nx-plugin

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

@code-pushup/axe-plugin

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

@code-pushup/coverage-plugin

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

@code-pushup/eslint-plugin

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

@code-pushup/js-packages-plugin

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

@code-pushup/jsdocs-plugin

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

@code-pushup/lighthouse-plugin

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

@code-pushup/typescript-plugin

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

@code-pushup/utils

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

commit: 953a3e7

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit 276ae6b with previous commit ea27cdc.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Performance 🔴 29 🔴 33 ↑ +4.6
Documentation 🔴 42 🔴 46 ↑ +3.6
Code coverage 🟢 92 🟢 93 ↑ +0.2
Bug prevention 🟡 75 🟡 75 ↓ −0.1
Axe Accessibility 🟡 88 🟡 88 ↓ −0.1
Code style 🟢 100 🟢 100
Security 🔴 47 🔴 47
Updates 🟡 78 🟡 78
Type Safety 🟡 67 🟡 67
Miscellaneous 🟡 67 🟡 67
Accessibility 🟢 92 🟢 92
Best Practices 🟢 100 🟢 100
SEO 🟢 92 🟢 92
👍 3 groups improved, 👍 13 audits improved, 12 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Lighthouse Performance 🔴 29 🔴 33 ↑ +4.6
JSDocs coverage Documentation coverage 🔴 42 🔴 46 ↑ +3.6
Code coverage Code coverage metrics 🟢 92 🟢 93 ↑ +0.2

31 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse First Contentful Paint 🟥 3.9 s 🟥 3.2 s ↓ −18.8 %
Lighthouse Speed Index 🟥 9.3 s 🟥 7.6 s ↓ −18.2 %
JSDocs coverage Classes coverage 🟥 6 undocumented classes 🟨 6 undocumented classes  +0 %
JSDocs coverage Properties coverage 🟥 30 undocumented properties 🟥 41 undocumented properties ↑ +36.7 %
Lighthouse Time to Interactive 🟥 17.7 s 🟥 13.7 s ↓ −22.6 %
Lighthouse Total Blocking Time 🟥 7,300 ms 🟥 2,310 ms ↓ −68.4 %
JSDocs coverage Functions coverage 🟥 579 undocumented functions 🟥 582 undocumented functions ↑ +0.5 %
JSDocs coverage Types coverage 🟥 272 undocumented types 🟥 262 undocumented types ↓ −3.7 %
JSDocs coverage Methods coverage 🟨 13 undocumented methods 🟨 15 undocumented methods ↑ +15.4 %
JSDocs coverage Variables coverage 🟥 272 undocumented variables 🟥 280 undocumented variables ↑ +2.9 %
Code coverage Branch coverage 🟨 89 % 🟨 89.2 % ↑ +0.3 %
Code coverage Line coverage 🟩 92.3 % 🟩 92.6 % ↑ +0.2 %
Code coverage Function coverage 🟩 94.1 % 🟩 94.3 % ↑ +0.2 %
Lighthouse Minimizes main-thread work 🟥 24.2 s 🟥 11.9 s ↓ −50.7 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 2,098 KiB 🟩 Total size was 2,087 KiB ↓ −0.5 %
Lighthouse JavaScript execution time 🟥 9.6 s 🟥 4.9 s ↓ −48.5 %
Lighthouse Metrics 🟩 100% 🟩 100% ↓ −22.6 %
Lighthouse Largest Contentful Paint 🟥 14.5 s 🟥 11.5 s ↓ −20.4 %
Lighthouse Max Potential First Input Delay 🟥 3,650 ms 🟥 1,250 ms ↓ −65.9 %
Lighthouse Server Backend Latencies 🟩 1,040 ms 🟩 300 ms ↓ −70.8 %
Lighthouse Uses efficient cache policy on static assets 🟨 31 resources found 🟨 31 resources found ↓ −0.1 %
Lighthouse Reduce unused CSS 🟥 Potential savings of 125 KiB 🟥 Potential savings of 125 KiB ↑ +7.1 %
Lighthouse Initial server response time was short 🟩 Root document took 560 ms 🟩 Root document took 580 ms ↑ +4.9 %
Lighthouse Reduce unused JavaScript 🟥 Potential savings of 226 KiB 🟥 Potential savings of 226 KiB ↓ −0.9 %
Lighthouse Network Round Trip Times 🟩 20 ms 🟩 20 ms ↑ +28.5 %

654 other audits are unchanged.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2026

Code PushUp

🥳 Code PushUp report has improved – compared current commit 276ae6b with previous commit ea27cdc.

💼 Project utils

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Documentation 🔴 46 🟡 51 ↑ +5.6
Code coverage 🟢 95 🟢 95 ↑ +0.3

4 other categories are unchanged.

👍 2 groups improved, 👍 9 audits improved

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
JSDocs coverage Documentation coverage 🔴 46 🟡 51 ↑ +5.6
Code coverage Code coverage metrics 🟢 95 🟢 95 ↑ +0.3

13 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
JSDocs coverage Classes coverage 🟨 3 undocumented classes 🟨 3 undocumented classes  +0 %
JSDocs coverage Properties coverage 🟥 27 undocumented properties 🟥 38 undocumented properties ↑ +40.7 %
JSDocs coverage Types coverage 🟥 66 undocumented types 🟨 56 undocumented types ↓ −15.2 %
JSDocs coverage Functions coverage 🟥 241 undocumented functions 🟥 244 undocumented functions ↑ +1.2 %
JSDocs coverage Methods coverage 🟨 13 undocumented methods 🟨 15 undocumented methods ↑ +15.4 %
JSDocs coverage Variables coverage 🟥 49 undocumented variables 🟥 57 undocumented variables ↑ +16.3 %
Code coverage Branch coverage 🟩 91.7 % 🟩 92.2 % ↑ +0.5 %
Code coverage Function coverage 🟩 95.7 % 🟩 96 % ↑ +0.3 %
Code coverage Line coverage 🟩 97.7 % 🟩 97.9 % ↑ +0.1 %

435 other audits are unchanged.


13 other projects are unchanged.

@BioPhoton BioPhoton requested a review from matejchalk January 17, 2026 22:34
@BioPhoton BioPhoton changed the title feat(utils): add file sink classes feat(utils): add WriteAheadLog classes Jan 18, 2026
Copy link
Collaborator

@hanna-skryl hanna-skryl left a comment

Choose a reason for hiding this comment

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

The justification for sync file operations is well-reasoned 👍 I've added a few minor suggestions and comments.

BioPhoton and others added 3 commits January 19, 2026 21:48
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
# Conflicts:
#	packages/utils/src/lib/performance-observer.int.test.ts
#	packages/utils/src/lib/profiler/profiler.unit.test.ts
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is ON, but it could not run because Privacy Mode (Legacy) is turned on. To enable Bugbot Autofix, switch your privacy mode in the Cursor dashboard.

@BioPhoton BioPhoton requested a review from hanna-skryl January 26, 2026 22:03
@BioPhoton BioPhoton requested a review from hanna-skryl January 26, 2026 23:37
@BioPhoton BioPhoton merged commit e677d4f into main Jan 26, 2026
36 of 38 checks passed
@BioPhoton BioPhoton deleted the feat/utils/file-sink branch January 26, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants