Skip to content

chore: fixes code smells, bump deps - #60

Merged
petruki merged 1 commit into
masterfrom
staging
Oct 11, 2026
Merged

petruki merged 1 commit into
masterfrom
staging

Conversation

@petruki

@petruki petruki commented Oct 11, 2026

Copy link
Copy Markdown
Member

This pull request includes several dependency updates, codebase improvements for asynchronous operations, and enhancements to test coverage and reliability. The main changes focus on upgrading dependencies for security and compatibility, optimizing asynchronous logic for better performance and clarity, and making test assertions more robust.

Dependency Upgrades:

  • Updated various dependencies in package.json, including express to 5.3.0, express-rate-limit, graphql-http, moment, mongodb, mongoose, pino, pino-pretty, switcher-client, eslint, jest, node-notifier, and supertest to their latest minor or patch versions.
  • Upgraded the sonarsource/sonarqube-scan-action GitHub Action to v8.3.0 in both .github/workflows/master.yml and .github/workflows/sonar.yml. [1] [2]

Asynchronous Code Improvements:

  • Refactored cache initialization and update logic to use Promise.all for parallel processing in src/helpers/cache/index.js and src/helpers/cache/worker.js, improving performance and code clarity. [1] [2]
  • Improved the logic in resolveComponentsFirst (in src/aggregator/resolvers.js) to use Promise.all for counting configs, reducing sequential awaits and simplifying group filtering.
  • Added void to fire-and-forget async calls (e.g., metric.save(), get, and post in src/models/metric.js and src/services/relay.js) to clarify intent and avoid unhandled promise rejections. [1] [2]
  • Used void for the mongoose connection in src/db/mongoose.js to avoid unhandled promise warnings.

Test Enhancements:

  • Improved test assertions in multiple test files (tests/client-api.test.js, tests/client-api-cached.test.js, tests/client-api-cached-payload.test.js, tests/client-api-payload.test.js) by capturing responses and asserting that response.body is defined after error cases, ensuring better test reliability and coverage. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

Configuration Cleanup:

  • Removed the SonarLint project connection block from .vscode/settings.json, likely as part of configuration cleanup.

Cache Logic Refactoring:

  • Refactored cache update logic in src/helpers/cache/worker.js to return update objects directly from updateDomainCacheSnapshot and filter out nulls, simplifying the flow and error handling.

These changes collectively improve the project's maintainability, test reliability, and performance.

@petruki petruki added this to the v1.1.0 milestone Oct 11, 2026
@petruki petruki self-assigned this Oct 11, 2026
@petruki petruki added the enhancement New feature or request label Oct 11, 2026
@sonarqubecloud

Copy link
Copy Markdown

@petruki
petruki merged commit 19ba646 into master Oct 11, 2026
5 checks passed
@petruki
petruki deleted the staging branch October 11, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant