Skip to content

Conversation

basnijholt
Copy link
Owner

@basnijholt basnijholt commented Apr 16, 2025

This PR refactors how tool versions/tags are stored and handled within dotbins to improve accuracy and enable future reproducibility features like lock file support.

Motivation:

Storing only the stripped version (e.g., 1.2.3) prevents reliable fetching of the exact release needed for reproducible installs, as the original tag (e.g., v1.2.3) is lost. Storing the exact tag name from GitHub ensures we can always reference the precise release state. This change lays the groundwork for potential "install from lock file" functionality.

Additionally, supporting both the full tag ({tag}) and the stripped version ({version}) in asset patterns provides greater flexibility for matching real-world asset naming conventions.

Key Changes:

  1. VersionStore renamed to Manifest: The class responsible for storing installation state is now more accurately named Manifest.
  2. Stores Exact Tag: The manifest.json (previously versions.json) now stores the exact Git tag name (e.g., v1.2.3) under the key "tag". A manifest format version ("version": 2) is also added.
  3. New tag_to_version Utility: A helper function utils.tag_to_version() is introduced to derive the stripped version (e.g., 1.2.3) from a tag when needed.
  4. Flexible Asset Patterns: asset_patterns in dotbins.yaml now support both:
    • {tag}: Expands to the full tag name (e.g., v1.2.3).
    • {version}: Expands to the stripped version name (e.g., 1.2.3).
  5. Updated Comparison Logic: The logic to skip downloads (BinSpec.skip_download) now compares the stored full tag against the latest target full tag.
  6. User Display: User-facing commands (status, readme, update summary) now use tag_to_version() to display the more conventional stripped version number (e.g., 1.2.3), even though the full tag is stored internally.
  7. Tests Updated: All relevant tests have been updated to reflect the class renaming, stored field changes, and new logic.

Impact:

  • The format of the versions.json file has changed. (Note: Since there are no users, this isn't a breaking change in practice, but it's a format evolution).
  • Users configuring tools can now choose between {tag} and {version} in asset_patterns for optimal matching.

This change provides a more robust foundation for managing tool states accurately and paving the way for future enhancements.

Copy link

codecov bot commented Apr 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (71832c4) to head (2a6d6e8).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #98   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines         3250      3297   +47     
=========================================
+ Hits          3250      3297   +47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This reverts commit cfeb29d.
@basnijholt basnijholt changed the title Lockfile Track original tag Apr 16, 2025
@basnijholt basnijholt changed the title Track original tag Feat: Store exact tags in Manifest for reproducibility and support {tag} pattern Apr 16, 2025
@basnijholt basnijholt merged commit d415a31 into main Apr 17, 2025
15 checks passed
@basnijholt basnijholt deleted the lockfile branch April 17, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant