Module version_resolver

Module version_resolver 

Source
Expand description

Centralized version resolution module for AGPM

This module implements the core version-to-SHA resolution strategy that ensures deterministic and efficient dependency management. By resolving all version specifications to commit SHAs upfront, we enable:

  • SHA-based worktree caching: Reuse worktrees for identical commits
  • Reduced network operations: Single fetch per repository
  • Deterministic installations: Same SHA always produces same result
  • Efficient deduplication: Multiple refs to same commit share one worktree

§Architecture

The VersionResolver operates in two phases:

  1. Collection Phase: Gather all unique (source, version) pairs
  2. Resolution Phase: Batch resolve all versions to SHAs

This design minimizes Git operations and enables parallel resolution.

Structs§

PreparedSourceVersion
Represents a prepared source version with worktree information.
ResolvedVersion
Centralized version resolver for efficient SHA resolution
VersionEntry
Version resolution entry tracking source and version to SHA mapping
VersionResolutionService
Service for version resolution and worktree management.
VersionResolver
Centralized version resolver for batch SHA resolution.
WorktreeManager
Manages worktree creation for resolved dependency versions.

Enums§

PreparedVersionState
State of a prepared version in the concurrent preparation cache.

Functions§

find_best_matching_tag
Finds the best matching tag for a version constraint.
is_version_constraint
Checks if a string represents a version constraint rather than a direct reference.
parse_tags_to_versions
Parses Git tags into semantic versions, filtering out non-semver tags.
sort_versions_deterministic
Sorts tag-version pairs by semantic version (descending), with deterministic tie-breaking.