Skip to content

[CI Failure Doctor] Dependabot PR #11024 broke CI: npm peer dependency conflict between vitest@4.0.17 and @vitest/coverage-v8@4.0.10 #11030

@github-actions

Description

@github-actions

Summary

The CI failed on the main branch after merging Dependabot PR #11024. The lint-js job failed during npm ci due to a peer dependency conflict between vitest@4.0.17 and @vitest/coverage-v8@4.0.10.

Failure Details

Root Cause Analysis

Dependabot updated only vitest from 4.0.10 to 4.0.17 but did not update the related packages that have peer dependencies on vitest:

{
  "devDependencies": {
    "@vitest/coverage-v8": "^4.0.10",   // ❌ Still pinned to 4.0.10
    "@vitest/ui": "^4.0.10",            // ❌ Still pinned to 4.0.10  
    "vitest": "^4.0.17"                 // ✅ Updated to 4.0.17
  }
}

Error Message

npm error ERESOLVE could not resolve
npm error
npm error While resolving: @vitest/coverage-v8@4.0.10
npm error Found: vitest@4.0.17
npm error
npm error Could not resolve dependency:
npm error peer vitest@"4.0.10" from @vitest/coverage-v8@4.0.10
npm error
npm error Conflicting peer dependency: vitest@4.0.10

The @vitest/coverage-v8@4.0.10 package has a strict peer dependency on vitest@4.0.10, which conflicts with the updated vitest@4.0.17.

Reproduction

cd actions/setup/js
npm ci
# Error: ERESOLVE could not resolve peer dependency

Recommended Actions

Option 1: Update All Vitest Packages Together (Recommended)

Update all vitest-related packages to 4.0.17:

cd actions/setup/js
npm install --save-dev vitest@4.0.17 @vitest/coverage-v8@4.0.17 @vitest/ui@4.0.17

Option 2: Use Caret (^) Version Ranges in package.json

Change from exact versions to caret ranges to allow compatible minor/patch updates:

{
  "devDependencies": {
    "@vitest/coverage-v8": "^4.0.17",
    "@vitest/ui": "^4.0.17",
    "vitest": "^4.0.17"
  }
}

Note: The package.json already uses ^4.0.10 for coverage and ui packages, but the lock file has them pinned. The solution is to update the lock file by running npm install with the updated versions.

Option 3: Configure Dependabot to Update Vitest Packages Together

Add a grouped update configuration in .github/dependabot.yml:

version: 2
updates:
  - package-ecosystem: "npm"
    directory: "/actions/setup/js"
    groups:
      vitest:
        patterns:
          - "vitest"
          - "@vitest/*"

This ensures Dependabot updates all vitest packages in a single PR.

Prevention Strategies

  1. Group Vitest Dependencies: Configure Dependabot to update vitest and all @vitest/* packages together
  2. Add Pre-merge CI Check: Ensure the lint-js job runs before merging Dependabot PRs
  3. Use Renovate Instead: Consider using Renovate which has better peer dependency handling
  4. Lock File Validation: Add a CI step to validate that npm ci succeeds before merge

AI Team Self-Improvement

Add this to AGENTS.md for AI coding agents:

### Dependabot PR Review Guidelines

When reviewing Dependabot PRs that update npm packages:

1. **Check for peer dependencies**: If updating packages like `vitest`, ensure all related packages (`@vitest/coverage-v8`, `@vitest/ui`, etc.) are updated in the same PR
2. **Run `npm ci` locally**: Before approving, verify that `npm ci` succeeds in the affected directory
3. **Review package.json and package-lock.json together**: Ensure version ranges (^, ~) are consistent and lock file versions are compatible
4. **Group related updates**: For packages with peer dependencies, configure Dependabot groups or manually update all related packages together

**Example: Vitest ecosystem**
- When updating `vitest`, also update `@vitest/coverage-v8`, `@vitest/ui`, `@vitest/browser`, etc.
- These packages have strict peer dependencies and must stay in sync

Historical Context

This is a new type of failure - the first npm peer dependency conflict from Dependabot in the investigation history. Previous Dependabot-related issues have been about:

Impact

  • Severity: HIGH - Blocks all CI runs on main branch
  • Affected Jobs: All jobs cancelled after lint-js failure
  • Time to Fix: 5-10 minutes (update package.json + run npm install)

Files to Modify

  • actions/setup/js/package.json - Update @vitest/* versions
  • actions/setup/js/package-lock.json - Will be regenerated by npm install
  • .github/dependabot.yml - Add vitest dependency group (optional but recommended)

AI generated by CI Failure Doctor

To add this workflow in your repository, run gh aw add githubnext/agentics/workflows/ci-doctor.md@ea350161ad5dcc9624cf510f134c6a9e39a6f94d. See usage guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcidependenciesPull requests that update a dependency filenpm

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions