EasyP

Resolving Diamond Dependencies

How Minimal Version Selection (MVS) chooses a version in a dependency diamond, and what still needs compatibility testing.

The diamond dependency problem occurs when direct and transitive requirements request different versions of the same module. EasyP uses MVS to select a version within each module's dependency graph.


Scenario Description

Consider a service module user that relies on two dependencies: common and weather.

  • user explicitly requires common v1.2.0.
  • user explicitly requires weather v2.1.0.
  • weather v2.1.0 transitively requires common v1.3.0.
               +-------------------+
               |    proto/user     |
               +---------+---------+
                         |
           +-------------+-------------+
           |                           |
           v                           v
+---------------------+     +---------------------+
| github.com/acme/    |     | github.com/acme/    |
| common v1.2.0       |     | weather v2.1.0      |
+---------------------+     +----------+----------+
                                       |
                                       v
                            +---------------------+
                            | github.com/acme/    |
                            | common v1.3.0       |
                            +---------------------+

The MVS Resolution Rule

For semantic-version requirements on the same module, MVS selects the highest requested minimum:

Resolved Version = max(Requested Minimums)
  1. Collect requested minimums: [ v1.2.0 (from user), v1.3.0 (from weather) ]
  2. Select maximum: max(v1.2.0, v1.3.0) = v1.3.0
  3. Outcome: common v1.3.0 is selected for the module resolution graph.

MVS selects v1.3.0 from these requirements; it does not test whether either consumer compiles. Semantic version labels express maintainer intent and do not prove schema or generated-code compatibility. Separate root modules resolve independently and can select different versions.


What If Breaking Changes Occur?

If the selected version is incompatible, the graph can resolve successfully while generation or consumer tests fail. Run easyp breaking against an appropriate available baseline before release, then test generated clients. The checker covers its implemented rules and configured scope; it cannot guarantee every consumer remains compatible.

This maximum-of-minimums example applies to semantic versions. Different exact commit requirements conflict. An exact commit can coexist with semantic-version requirements only when the selected tag resolves to that same commit. See dependency resolution.

On this page