Skip to content

fix: isolate CodeRabbit unit tests from WSL probe on Windows#809

Open
grupogegedelivery-cpu wants to merge 1 commit into
SynkraAI:mainfrom
grupogegedelivery-cpu:fix/coderabbit-windows-tests
Open

fix: isolate CodeRabbit unit tests from WSL probe on Windows#809
grupogegedelivery-cpu wants to merge 1 commit into
SynkraAI:mainfrom
grupogegedelivery-cpu:fix/coderabbit-windows-tests

Conversation

@grupogegedelivery-cpu

@grupogegedelivery-cpu grupogegedelivery-cpu commented Jul 14, 2026

Copy link
Copy Markdown

Summary

  • Mock child_process.spawnSync in layer2-pr-automation.test.js and quality-gate-pipeline.test.js so runCodeRabbit's WSL availability probe does not run for real on Windows hosts, letting the mocked runCommand() control test outcomes instead of the host environment.
  • Replace bash-specific || true in the aiox-install integration test with a try/catch around execSync, since cmd.exe on Windows does not understand that syntax.

Why

On a Windows host without WSL installed, npm run test failed 10 tests across 3 suites:

  • Layer2PRAutomation (4 tests) and Quality Gate Pipeline Integration / Smoke Tests (5 tests) failed because runCodeRabbit() performs a real spawnSync(\'wsl\', [\'-l\']) probe before ever reaching the mocked runCommand(), so tests that mock runCommand still hit the real (failing) WSL check.
  • aiox-install integration.test.js failed because it shells out with node ... || true, a bash idiom not understood by cmd.exe (Windows' default execSync shell).

Testing

  • npm run test: 375/375 suites passed (12 skipped), 9002/9174 tests passed (172 skipped), exit code 0.

Additional changes bundled in this branch

  • npm audit fix (60 packages updated, 0 vulnerabilities remaining)
  • npm approve-scripts for unrs-resolver and @aiox-squads/core
  • .aiox-core/data/entity-registry.yaml and .aiox-core/install-manifest.yaml auto-regenerated by the repo's own pre-commit/pre-push hooks (timestamps only)

Summary by CodeRabbit

  • Chores

    • Refreshed installation and registry metadata to keep tracked file information current.
    • Updated script execution permissions for approved tooling.
  • Tests

    • Improved quality-gate test reliability by isolating external command behavior.
    • Strengthened CLI error-handling coverage, including output from failed commands.
    • Ensured test mocks are consistently restored between test runs.

- Mock child_process.spawnSync in layer2-pr-automation.test.js and
  quality-gate-pipeline.test.js so runCodeRabbit's WSL availability
  check does not run for real, letting the mocked runCommand() control
  test outcomes instead of the host environment.
- Replace bash-specific `|| true` in aiox-install integration test
  with try/catch around execSync, since cmd.exe on Windows does not
  understand that syntax.
- chore: npm audit fix (60 packages updated, 0 vulnerabilities)
- chore: npm approve-scripts for unrs-resolver and @aiox-squads/core
- chore: entity-registry re-sync (auto-generated timestamps)
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

@grupogegedelivery-cpu is attempting to deploy a commit to the SINKRA - AIOX Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added type: test Test coverage and quality area: docs Documentation (docs/) labels Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to aiox-core! Thanks for your first pull request.

What happens next?

  1. Automated checks will run on your PR
  2. A maintainer will review your changes
  3. Once approved, we'll merge your contribution!

PR Checklist:

Thanks for contributing!

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Registry and install-manifest metadata were refreshed, package script permissions were added, and tests were updated to isolate spawnSync and capture CLI error output.

Changes

Core metadata and test execution

Layer / File(s) Summary
Registry and install metadata refresh
.aiox-core/data/entity-registry.yaml, .aiox-core/install-manifest.yaml
Registry timestamps and path formatting were refreshed, while manifest timestamps, hashes, and sizes were updated.
Package script permissions
package.json
Added script execution permissions for unrs-resolver@1.11.1 and @aiox-squads/core@5.1.0.
Process execution test isolation
tests/integration/quality-gate-pipeline.test.js, tests/unit/quality-gates/layer2-pr-automation.test.js, tests/packages/aiox-install/integration.test.js
Quality-gate tests now mock and restore spawnSync; the install test combines stdout and stderr when handling command failures.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: area: core

Suggested reviewers: oalanicolas, pedrovaleriolopez

🚥 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 summarizes the main change: isolating CodeRabbit tests from the Windows WSL probe.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (2)
tests/packages/aiox-install/integration.test.js (1)

181-189: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Use execFileSync to prevent path escaping vulnerabilities.

Passing dynamic variables like binPath directly into a shell command string using execSync can lead to path escaping issues or command injection. Since the PR focuses on Windows test compatibility, it is especially important to avoid shell strings, as Windows paths frequently contain spaces that can break unescaped shell execution. As per path instructions, look for potential security vulnerabilities.

Switching to execFileSync bypasses the shell entirely, making it safer. The shell-specific 2>&1 redirection can be removed entirely because the try/catch block already accurately aggregates error.stdout and error.stderr from the exception.

♻️ Proposed refactor

Update the execution block to use execFileSync (ensure execFileSync is imported from child_process if not already available):

-      try {
-        result = execSync(`node "${binPath}" --invalid-flag 2>&1`, {
-          encoding: 'utf8',
-          timeout: 10000,
-        });
-      } catch (error) {
-        result = (error.stdout || '') + (error.stderr || '');
-      }
+      try {
+        result = require('child_process').execFileSync('node', [binPath, '--invalid-flag'], {
+          encoding: 'utf8',
+          timeout: 10000,
+        });
+      } catch (error) {
+        result = (error.stdout || '') + (error.stderr || '');
+      }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/packages/aiox-install/integration.test.js` around lines 181 - 189,
Replace the execSync invocation in the invalid-flag execution test with
execFileSync, passing binPath and --invalid-flag as separate arguments and
removing the shell-specific 2>&1 redirection. Ensure execFileSync is imported
from child_process, while preserving the existing timeout, encoding, and
catch-block aggregation of stdout and stderr.

Sources: Path instructions, Linters/SAST tools

tests/integration/quality-gate-pipeline.test.js (1)

10-14: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use absolute imports instead of relative paths.

As per coding guidelines, use absolute imports in JavaScript and TypeScript source code. These imports use extensive relative path traversal (../../ and ../../../) to reach the .aiox-core directory. Utilizing absolute imports prevents reference breakages during file moves.

  • tests/integration/quality-gate-pipeline.test.js#L10-L14: Update these require statements to use absolute import paths (e.g., using configured path aliases).
  • tests/unit/quality-gates/layer2-pr-automation.test.js#L8-L8: Update this require statement to use an absolute import path.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/integration/quality-gate-pipeline.test.js` around lines 10 - 14,
Replace the relative require paths in
tests/integration/quality-gate-pipeline.test.js lines 10-14 for
QualityGateManager, Layer1PreCommit, Layer2PRAutomation, Layer3HumanReview, and
ChecklistGenerator with configured absolute import paths. Also update the
require at tests/unit/quality-gates/layer2-pr-automation.test.js line 8 to use
the corresponding absolute path; preserve the imported symbols and test
behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/integration/quality-gate-pipeline.test.js`:
- Around line 10-14: Replace the relative require paths in
tests/integration/quality-gate-pipeline.test.js lines 10-14 for
QualityGateManager, Layer1PreCommit, Layer2PRAutomation, Layer3HumanReview, and
ChecklistGenerator with configured absolute import paths. Also update the
require at tests/unit/quality-gates/layer2-pr-automation.test.js line 8 to use
the corresponding absolute path; preserve the imported symbols and test
behavior.

In `@tests/packages/aiox-install/integration.test.js`:
- Around line 181-189: Replace the execSync invocation in the invalid-flag
execution test with execFileSync, passing binPath and --invalid-flag as separate
arguments and removing the shell-specific 2>&1 redirection. Ensure execFileSync
is imported from child_process, while preserving the existing timeout, encoding,
and catch-block aggregation of stdout and stderr.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c0155d9b-93cb-4b59-8ee8-e6c9948bba31

📥 Commits

Reviewing files that changed from the base of the PR and between 0b32b68 and 3845475.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • .aiox-core/data/entity-registry.yaml
  • .aiox-core/install-manifest.yaml
  • package.json
  • tests/integration/quality-gate-pipeline.test.js
  • tests/packages/aiox-install/integration.test.js
  • tests/unit/quality-gates/layer2-pr-automation.test.js

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

Labels

area: docs Documentation (docs/) type: test Test coverage and quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant