Skip to content

Comments

refactor: refactor sharded wal to handle coordinator#1237

Open
BioPhoton wants to merge 18 commits intomainfrom
feat/utils/handle-coordinator-in-sharded-wal
Open

refactor: refactor sharded wal to handle coordinator#1237
BioPhoton wants to merge 18 commits intomainfrom
feat/utils/handle-coordinator-in-sharded-wal

Conversation

@BioPhoton
Copy link
Collaborator

@BioPhoton BioPhoton commented Feb 3, 2026

Precondition:

Related:

This PR includes:

  • split sharded wal logic
  • handle coordinator in sharder

Followup:

@nx-cloud
Copy link

nx-cloud bot commented Feb 3, 2026

View your CI Pipeline Execution ↗ for commit 55816b9

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

☁️ Nx Cloud last updated this comment at 2026-02-23 15:39:50 UTC

# Conflicts:
#	packages/utils/src/lib/wal.ts
#	packages/utils/src/lib/wal.unit.test.ts
…-sharded-wal' into feat/utils/handle-coordinator-in-sharded-wal
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 17, 2026

Open in StackBlitz

@code-pushup/ci

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

@code-pushup/cli

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

@code-pushup/core

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

@code-pushup/create-cli

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

@code-pushup/models

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

@code-pushup/axe-plugin

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

@code-pushup/nx-plugin

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

@code-pushup/eslint-plugin

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

@code-pushup/js-packages-plugin

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

@code-pushup/coverage-plugin

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

@code-pushup/jsdocs-plugin

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

@code-pushup/lighthouse-plugin

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

@code-pushup/typescript-plugin

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

@code-pushup/utils

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

commit: 55816b9

@github-actions
Copy link
Contributor

github-actions bot commented Feb 23, 2026

Code PushUp

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

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Security 🔴 39 🔴 0 ↓ −38.7
Performance 🔴 36 🔴 45 ↑ +8.6
Best Practices 🟢 100 🟢 97 ↓ −3.4
Updates 🟡 75 🟡 72 ↓ −3.3
Documentation 🟡 53 🟡 53 ↑ +0.5
Code coverage 🟢 93 🟢 93 ↑ +0.1
Bug prevention 🟡 75 🟡 75 ↓ −0.1
Axe Accessibility 🟡 88 🟡 88 ↓ −0.1
Code style 🟢 100 🟢 100
Type Safety 🟡 67 🟡 67
Miscellaneous 🟡 67 🟡 67
Accessibility 🟢 92 🟢 92
SEO 🟢 92 🟢 92
👍 3 groups improved, 👎 3 groups regressed, 👍 9 audits improved, 👎 10 audits regressed, 17 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
JS packages npm audit 🔴 39 🔴 0 ↓ −38.7
Lighthouse Performance 🔴 36 🔴 45 ↑ +8.6
Lighthouse Best Practices 🟢 100 🟢 97 ↓ −3.4
JS packages npm outdated dependencies 🟡 75 🟡 72 ↓ −3.3
JSDocs coverage Documentation coverage 🟡 53 🟡 53 ↑ +0.5
Code coverage Code coverage metrics 🟢 93 🟢 93 ↑ +0.1

28 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse Initial server response time was short 🟩 Root document took 510 ms 🟥 Root document took 670 ms ↑ +31.6 %
Lighthouse No issues in the Issues panel in Chrome Devtools 🟩 passed 🟥 failed ↓ −100 %
Lighthouse Reduce unused JavaScript 🟥 Potential savings of 225 KiB 🟨 Potential savings of 256 KiB ↓ −100 %
Lighthouse Remove duplicate modules in JavaScript bundles 🟥 Potential savings of 93 KiB 🟨 Potential savings of 80 KiB ↓ −100 %
JS packages Vulnerabilities for npm prod dependencies. 🟥 12 vulnerabilities (3 high, 2 moderate, 7 low) 🟥 22 vulnerabilities (13 high, 3 moderate, 6 low) ↑ +83.3 %
Lighthouse Largest Contentful Paint 🟥 11.6 s 🟥 4.7 s ↓ −59.4 %
Lighthouse Speed Index 🟥 7.3 s 🟥 6.2 s ↓ −15.2 %
Lighthouse First Contentful Paint 🟥 3.1 s 🟥 3.2 s ↑ +5.2 %
JS packages Outdated npm prod dependencies. 🟨 20 outdated package versions (6 major, 10 minor, 4 patch) 🟨 21 outdated package versions (7 major, 11 minor, 3 patch) ↑ +5 %
JSDocs coverage Methods coverage 🟨 10 undocumented methods 🟨 10 undocumented methods  +0 %
JSDocs coverage Properties coverage 🟥 43 undocumented properties 🟥 47 undocumented properties ↑ +9.3 %
JS packages Outdated npm dev dependencies. 🟨 62 outdated package versions (29 major, 25 minor, 8 patch) 🟨 61 outdated package versions (30 major, 25 minor, 6 patch) ↓ −1.6 %
Lighthouse Total Blocking Time 🟥 1,630 ms 🟥 1,670 ms ↑ +2.5 %
JSDocs coverage Variables coverage 🟥 273 undocumented variables 🟥 274 undocumented variables ↑ +0.4 %
Code coverage Branch coverage 🟨 89.2 % 🟨 89 % ↓ −0.2 %
Code coverage Function coverage 🟩 94.4 % 🟩 94.4 % ↑ +0.1 %
JSDocs coverage Types coverage 🟥 264 undocumented types 🟥 265 undocumented types ↑ +0.4 %
Code coverage Line coverage 🟩 92.7 % 🟩 92.7 % ↑ +0.1 %
JSDocs coverage Functions coverage 🟥 585 undocumented functions 🟥 584 undocumented functions ↓ −0.2 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 2,091 KiB 🟩 Total size was 2,137 KiB ↑ +2.2 %
Lighthouse Uses efficient cache policy on static assets 🟨 31 resources found 🟨 31 resources found ↑ +0.1 %
Lighthouse Server Backend Latencies 🟩 310 ms 🟩 930 ms ↑ +196.7 %
Lighthouse Minimizes main-thread work 🟥 10.3 s 🟥 9.9 s ↓ −3.3 %
Lighthouse Reduce unused CSS 🟥 Potential savings of 111 KiB 🟥 Potential savings of 110 KiB ↑ +54.2 %
Lighthouse JavaScript execution time 🟥 3.0 s 🟥 3.1 s ↑ +4.1 %
Lighthouse Metrics 🟩 100% 🟩 100% ↑ +0.5 %
Lighthouse Time to Interactive 🟥 13.5 s 🟥 13.6 s ↑ +0.5 %
Lighthouse Max Potential First Input Delay 🟥 990 ms 🟥 940 ms ↓ −5.4 %
JS packages Vulnerabilities for npm dev dependencies. 🟥 48 vulnerabilities (3 critical, 9 high, 32 moderate, 4 low) 🟥 81 vulnerabilities (3 critical, 65 high, 10 moderate, 3 low) ↑ +68.8 %
Lighthouse Network Round Trip Times 🟩 30 ms 🟩 60 ms ↑ +91.6 %
Lighthouse Avoids an excessive DOM size 🟥 2,366 elements 🟥 2,360 elements ↓ −0.3 %
Axe Elements must only use supported ARIA attributes 🟩 101 elements 🟩 96 elements ↓ −5 %
Axe ARIA attributes must be used as specified for the element's role 🟩 101 elements 🟩 96 elements ↓ −5 %
Axe Elements must only use permitted ARIA attributes 🟩 101 elements 🟩 96 elements ↓ −5 %
Axe ARIA attributes must conform to valid names 🟩 101 elements 🟩 96 elements ↓ −5 %
Lighthouse Cumulative Layout Shift 🟩 0 🟩 0 ↑ +∞ %

643 other audits are unchanged.

@BioPhoton BioPhoton marked this pull request as ready for review February 23, 2026 08:53
@github-actions
Copy link
Contributor

github-actions bot commented Feb 23, 2026

Code PushUp

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

💼 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 🟡 60 🟡 61 ↑ +0.6
Code coverage 🟢 95 🟢 95 ↓ −0.1

4 other categories are unchanged.

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

🗃️ Groups

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

13 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
JSDocs coverage Methods coverage 🟨 10 undocumented methods 🟨 10 undocumented methods  +0 %
JSDocs coverage Properties coverage 🟥 40 undocumented properties 🟥 44 undocumented properties ↑ +10 %
Code coverage Branch coverage 🟩 91.8 % 🟩 91.3 % ↓ −0.5 %
JSDocs coverage Types coverage 🟨 55 undocumented types 🟨 56 undocumented types ↑ +1.8 %
JSDocs coverage Variables coverage 🟥 49 undocumented variables 🟥 50 undocumented variables ↑ +2 %
Code coverage Function coverage 🟩 95.8 % 🟩 95.9 % ↑ +0.1 %
JSDocs coverage Functions coverage 🟥 243 undocumented functions 🟥 242 undocumented functions ↓ −0.4 %
Code coverage Line coverage 🟩 97.8 % 🟩 97.8 % ↑ +0.1 %

436 other audits are unchanged.

💼 Project plugin-lighthouse

🤨 Code PushUp report has both improvements and regressions.

🕵️ See full comparison in Code PushUp portal 🔍

All of 6 categories are unchanged.

1 audit changed without impacting score

🗃️ Groups

All of 15 groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Code coverage Branch coverage 🟩 98.8 % 🟩 98.8 % ↓ −0.1 %

443 other audits are unchanged.


12 other projects are unchanged.

return ++ShardedWal.instanceCount;
},
});
readonly groupId = getUniqueTimeId();
Copy link
Collaborator

Choose a reason for hiding this comment

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

The groupId default value is always overwritten and never used. Consider declaring the field without a default.

Comment on lines +349 to +350
// create dir if not existing
ensureDirectoryExistsSync(groupDir);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I found it a bit hard to follow which layer is responsible for creating which directory. The finalize path calls ensureDirectoryExistsSync three times across two methods.

What do you think about moving the directory creation into finalize() so that shardFiles() stays a pure read method?

}

/**
* NOTE: this helper is only used in this file. The rest of the repo avoids sync methods so it is not reusable.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The comment is misleading as ensureDirectoryExistsSync is actually exported and used in other files.

: this.getCreatedShardFiles();

return {
lastRecover: this.#lastRecovery,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a specific reason why the names differ so that lastRecover maps to lastRecovery?

* Handles distributed logging across multiple processes/files with atomic finalization.
*/

export class ShardedWal<T extends WalRecord = WalRecord> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: stale profiler references in JSDoc.

setCoordinatorProcess and isCoordinatorProcess have JSDoc and parameter names from before the generalization. profilerID param name, references to "origin PID", "enabled profiling", and CP_PROFILER_ORIGIN_PID. These could be updated to match the generic coordinator terminology used everywhere else in the class.

BioPhoton and others added 5 commits February 23, 2026 16:16
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>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
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.

2 participants