Skip to content

test(config): cobertura para merge-utils e env-interpolator (#52)#598

Open
nikolasdehor wants to merge 1 commit intoSynkraAI:mainfrom
nikolasdehor:test/config-utils-coverage
Open

test(config): cobertura para merge-utils e env-interpolator (#52)#598
nikolasdehor wants to merge 1 commit intoSynkraAI:mainfrom
nikolasdehor:test/config-utils-coverage

Conversation

@nikolasdehor
Copy link
Contributor

@nikolasdehor nikolasdehor commented Mar 13, 2026

Resumo

Adiciona 44 testes unitários para dois módulos core de configuração sem cobertura:

merge-utils.js (23 testes)

  • isPlainObject: 6 testes — objetos literais, arrays, null, primitivos, Date/RegExp
  • deepMerge: 13 testes — last-wins, deep merge, +append arrays, null delete, imutabilidade, 3+ níveis
  • mergeAll: 4 testes — múltiplas camadas, null/undefined, sem args

env-interpolator.js (21 testes)

  • interpolateString: 7 testes — ${VAR}, ${VAR:-default}, múltiplas vars, warnings
  • interpolateEnvVars: 6 testes — objetos aninhados, arrays, primitivos, imutabilidade
  • lintEnvPatterns: 5 testes — detecção em strings/arrays/deep objects
  • ENV_VAR_PATTERN: 3 testes — regex global, captura de nome e default

Closes #52 (parcial)

Plano de teste

  • npx jest tests/core/config/ — 82/82 passando (inclui testes existentes)
  • Isolamento de env vars com save/restore em beforeEach/afterAll

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for configuration utilities to improve code reliability and stability.

…nkraAI#52)

Cobre deepMerge (13 testes), mergeAll (4 testes), isPlainObject (6 testes),
interpolateString (7 testes), interpolateEnvVars (6 testes),
lintEnvPatterns (5 testes) e ENV_VAR_PATTERN (3 testes).
@vercel
Copy link

vercel bot commented Mar 13, 2026

@nikolasdehor is attempting to deploy a commit to the Pedro Valério Lopez's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added area: agents Agent system related area: workflows Workflow system related squad mcp type: test Test coverage and quality area: core Core framework (.aios-core/core/) area: installer Installer and setup (packages/installer/) area: synapse SYNAPSE context engine area: cli CLI tools (bin/, packages/aios-pro-cli/) area: pro Pro features (pro/) area: health-check Health check system area: docs Documentation (docs/) area: devops CI/CD, GitHub Actions (.github/) labels Mar 13, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Walkthrough

Adds comprehensive unit test suites for env-interpolator and merge-utils config modules. Tests cover variable interpolation with defaults, recursive environment variable resolution, deep object merging, pattern detection, and immutability validation across various edge cases.

Changes

Cohort / File(s) Summary
Config Module Tests
tests/core/config/env-interpolator.test.js, tests/core/config/merge-utils.test.js
Comprehensive unit tests for env-interpolator (variable interpolation, environment resolution, pattern detection) and merge-utils (plain object detection, deep merging with array handling, multi-layer merges). Covers edge cases, immutability validation, and warning collection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding tests for merge-utils and env-interpolator modules with comprehensive coverage.
Linked Issues check ✅ Passed The PR contributes to issue #52 objectives by adding 44 unit tests for config utilities, though it addresses only a partial scope compared to the full coverage gaps listed in the issue.
Out of Scope Changes check ✅ Passed All changes are in-scope: two new test files covering config modules directly mentioned in the PR objectives with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/core/config/env-interpolator.test.js`:
- Line 17: Replace the relative
require('../../../.aiox-core/core/config/env-interpolator') in
tests/core/config/env-interpolator.test.js with the repository's absolute import
for that module (use the project's absolute import root/prefix and the module
name env-interpolator), so the test imports the same module via the established
absolute path convention rather than a relative path.

In `@tests/core/config/merge-utils.test.js`:
- Line 12: Replace the relative require in the test that imports deepMerge,
mergeAll, and isPlainObject with the repository's absolute-import path: update
the require statement that currently points to
'../../../.aiox-core/core/config/merge-utils' so it imports from the
package/root absolute module path used across the repo (keeping the same
exported symbols deepMerge, mergeAll, isPlainObject) to follow the
absolute-import rule.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 67a41f17-bf34-4b27-b678-ae9735bc9f69

📥 Commits

Reviewing files that changed from the base of the PR and between f74e3e7 and b565f71.

📒 Files selected for processing (2)
  • tests/core/config/env-interpolator.test.js
  • tests/core/config/merge-utils.test.js

interpolateEnvVars,
lintEnvPatterns,
ENV_VAR_PATTERN,
} = require('../../../.aiox-core/core/config/env-interpolator');
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Use absolute import path here.

Line 17 uses a relative require(...); please switch it to the project’s absolute import convention used in this repository.

As per coding guidelines, "**/*.{js,jsx,ts,tsx}: Use absolute imports instead of relative imports in all code".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/core/config/env-interpolator.test.js` at line 17, Replace the relative
require('../../../.aiox-core/core/config/env-interpolator') in
tests/core/config/env-interpolator.test.js with the repository's absolute import
for that module (use the project's absolute import root/prefix and the module
name env-interpolator), so the test imports the same module via the established
absolute path convention rather than a relative path.


'use strict';

const { deepMerge, mergeAll, isPlainObject } = require('../../../.aiox-core/core/config/merge-utils');
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Replace relative import with absolute import.

Line 12 should follow the repository absolute-import rule instead of ../../../....

As per coding guidelines, "**/*.{js,jsx,ts,tsx}: Use absolute imports instead of relative imports in all code".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/core/config/merge-utils.test.js` at line 12, Replace the relative
require in the test that imports deepMerge, mergeAll, and isPlainObject with the
repository's absolute-import path: update the require statement that currently
points to '../../../.aiox-core/core/config/merge-utils' so it imports from the
package/root absolute module path used across the repo (keeping the same
exported symbols deepMerge, mergeAll, isPlainObject) to follow the
absolute-import rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents Agent system related area: cli CLI tools (bin/, packages/aios-pro-cli/) area: core Core framework (.aios-core/core/) area: devops CI/CD, GitHub Actions (.github/) area: docs Documentation (docs/) area: health-check Health check system area: installer Installer and setup (packages/installer/) area: pro Pro features (pro/) area: synapse SYNAPSE context engine area: workflows Workflow system related mcp squad type: test Test coverage and quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(coverage): Improve global test coverage after ADE implementation

1 participant