EasyP

MVS Dependency Resolution

SemVer selection, compatible commit constraints, and reproducible Git dependencies in EasyP.

EasyP resolves dependencies separately for each protobuf module. Semantic requirements use Minimal Version Selection (MVS): select the maximum of the requested minimum versions. Exact Git commits and versionless requirements follow separate rules; SHA values have no invented SemVer ordering.

Selection rules

Requirements for one moduleResult
Several SemVer minimumsMaximum requested minimum
One explicit full SHAExact commit
Selected SemVer and SHA of the same commitCompatible; the tag stays in the lock for the semantic constraint
Different explicit SHAs, or selected tag at another commitConflict error
Versionless alongside SemVer or SHAVersionless requirement adds no constraint
Only versionless requirementsTidy uses the existing lock pin, or HEAD without one; update refreshes HEAD

A commit is not considered “newer” than a minimum version based on its date or ancestry. SemVer/SHA compatibility checks the selected tag's exact commit. If a stronger constraint replaces provisional HEAD, its dependency edges are rebuilt; dependencies and errors from discarded HEAD do not remain in the selected graph. Cyclic unstable versionless constraints are rejected.

Diamond dependency example

user
├── common v1.2.0
└── weather v2.1.0
    └── common v1.3.0

The user graph selects common v1.3.0 and weather v2.1.0. Numerically, v1.3.0 satisfies both common minimums; dependency resolution does not prove schema compatibility. Run easyp breaking separately for that check.

If user pins a SHA, the selected common v1.3.0 tag must point to that exact commit. A v1.2.0 tag at that SHA is insufficient when the maximum requirement is v1.3.0. If user's common requirement has no version, weather's semantic minimum determines the selection.

Module and descriptor boundaries

Each module has its own protobuf.mod and protobuf.lock. For example, proto/user can select common v1.3.0 while proto/order selects common v2.0.0 in an independent graph.

Independent graphs do not guarantee that their combined generation output is compatible:

OutputValidation
--descriptor_set_outMerges compatible graphs; conflicting definitions by import path or symbol are errors
--descriptor_set_out_dirIndependent set per project/module pair; graphs are not merged
Plugin outputIdentical shared files are deduplicated; different contents at one path or Go packages sharing a directory are errors

Managed options remain part of compatibility checks. Different dependency versions can have compatible descriptors, while different consumer settings can make them incompatible. --include_imports affects exported contents only; the full graph is always validated. Plugin import generation is separately controlled by with_imports, default false.

Manifest and local replacements

module github.com/acme/user
roots proto
require (
    github.com/acme/common v1.2.0
    github.com/acme/weather v2.1.0
)
replace github.com/acme/weather => ../weather-fork

roots is relative to the manifest directory and defaults to .. The get and mod commands find the nearest ancestor manifest within the workspace. Transitive requirements are recorded with // indirect.

A relative replace target is resolved from its owning protobuf.mod; an absolute target is used directly. Generation and linting support local replacements. get, mod tidy, mod update, and mod vendor reject them: remove replacements before these commands create or use a reproducible Git lock. This is command validation, not a CI rule rejecting commits.

For nested Git modules, require each identity declared by its manifest. Versionless requirements need no tags. Version v1.2.3 of a module in proto/user uses tag proto/user/v1.2.3.

Locks and immutable published versions

protobuf.lock records the source, selected tag or SHA, exact commit, and content hash. It is created by get, mod tidy, and mod update. mod download uses exact locked commits. The example below illustrates the format, not actual repository data.

version: 1
modules:
  - source: github.com/acme/common
    version: v1.3.0
    commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    hash: h1:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=

During tidy, get, and update, a fetched previously locked SemVer must match its recorded commit and hash. A mismatch raises ErrLockedVersionChanged before installing the new graph or writing the manifest or lock, including for transitive requirements and warm caches. A new version may be selected; unconstrained versionless requirements still refresh to HEAD, while explicit SHAs stay pinned.

mod download can retrieve the old commit after a tag moves if that commit remains available. The Go dirhash.Hash1 digest covers Git-tracked regular files with repository-relative paths. Both newly downloaded and installed cached files are verified.

Git object reuse

A shared object store is used per remote. Known exact commits can be reused without remote access. The first attempt fetches the requested commit at depth one. If a server rejects a historical SHA, EasyP fetches advertised reachable history and still requires the original commit; HEAD is never substituted. A cold fetch is therefore not always shallow. Tag lookups are refreshed separately so cache reuse cannot hide republishing.

Reproducibility depends on pinned commits remaining available and hashes matching. Breaking checks use each revision's own manifests and locks; the baseline is read from an isolated Git snapshot rather than the current working tree.

See protobuf.mod, protobuf.lock, and generation for details.

On this page