Skip to content

Refactor/modules and add tests for counters#57

Merged
doctorlai-msrc merged 3 commits into
mainfrom
refactor
Jun 11, 2026
Merged

Refactor/modules and add tests for counters#57
doctorlai-msrc merged 3 commits into
mainfrom
refactor

Conversation

@doctorlai-msrc

Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 55.66% 236 / 424
🔵 Statements 56.22% 244 / 434
🔵 Functions 76.31% 58 / 76
🔵 Branches 42.04% 74 / 176
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/config.js 0% 0% 0% 0% 9-21
src/counters.js 100% 66.66% 100% 100%
src/health-check.js 100% 96.15% 100% 100%
src/index.js 0% 0% 0% 0% 29-432
Generated in workflow #28 for commit 839ada8 by the Vitest Coverage Report Action

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors src/index.js by extracting configuration loading, node health-check logic, and request/health statistics into dedicated modules, and adds Jest coverage for the new counters implementation.

Changes:

  • Extract YAML config loading into src/config.js and replace inline config parsing in src/index.js.
  • Move node probing / health-check logic into src/health-check.js and wire it into the request flow.
  • Introduce src/counters.js for centralized statistics (with mutex-guarded updates) and add Jest tests for it.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/index.js Switches to loadConfig, Counters, and createGetServerData to reduce inline logic and centralize stats updates.
src/health-check.js New module encapsulating node probing (version + jussi checks) and counter updates.
src/counters.js New counters/state container (per-node maps + totals + RPS window) with async-mutex protection.
src/config.js New helper to load YAML config and expand ${ENV_VAR} placeholders.
js_tests/counters.test.js Adds unit tests for the new Counters module behavior.
README.md Adds Docker Hub badges.

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

Comment thread src/health-check.js Outdated
Comment thread src/index.js Outdated
Comment thread src/health-check.js
@doctorlai-msrc doctorlai-msrc merged commit 8c42fc8 into main Jun 11, 2026
3 checks passed
@doctorlai-msrc doctorlai-msrc deleted the refactor branch June 11, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants