Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b28e46e
feat(lockfile): implement complete lockfile generation with concurren…
jdx Sep 7, 2025
f7d348f
fix: restore proper lockfile generation implementation
jdx Sep 7, 2025
59a9a1a
test: update lock e2e tests for new lockfile generation implementation
jdx Sep 7, 2025
2ad9d00
feat(lockfile): implement full metadata fetching for Bun backend
jdx Sep 7, 2025
85cf8eb
[autofix.ci] apply automated fixes
autofix-ci[bot] Sep 7, 2025
d2ce4fa
feat(lockfile): implement shared GitHub release metadata fetching wit…
jdx Sep 7, 2025
f039863
[autofix.ci] apply automated fixes
autofix-ci[bot] Sep 7, 2025
b89ccbf
refactor: remove dead code and improve e2e tests
jdx Sep 7, 2025
b7277a2
feat(lockfile): implement fallback checksum calculation for GitHub re…
jdx Sep 7, 2025
c794d0e
refactor(github): simplify GitHub release integration and enhance loc…
jdx Sep 7, 2025
5cbb27c
wip
jdx Sep 7, 2025
fccd79c
[autofix.ci] apply automated fixes
autofix-ci[bot] Sep 7, 2025
7997b05
wip
jdx Sep 7, 2025
960d480
feat(lockfile): improve aqua backend and metadata fetching
jdx Sep 7, 2025
2b867a5
wip
jdx Sep 7, 2025
3a4cd55
refactor(core): use get_tarball_url for consistent download URLs in d…
jdx Sep 7, 2025
b0005df
feat(lockfile): add mise lock tests to aqua and github backends and f…
jdx Sep 7, 2025
2cf04a2
[autofix.ci] apply automated fixes
autofix-ci[bot] Sep 7, 2025
114f8cf
wip
jdx Sep 7, 2025
b2de94f
wip
jdx Sep 7, 2025
df17a2b
feat(lockfile): change asset_pattern from Option<String> to String an…
jdx Sep 7, 2025
970aa22
wip
jdx Sep 7, 2025
79e17e0
wip
jdx Sep 7, 2025
ca37c6f
wip
jdx Sep 7, 2025
97f7777
wip
jdx Sep 7, 2025
5415ea0
wip
jdx Sep 7, 2025
26145df
wip
jdx Sep 7, 2025
dae8dc6
wip
jdx Sep 7, 2025
3263de0
Merge remote-tracking branch 'origin/main' into 09-07-feat_lockfile_i…
jdx Sep 7, 2025
349a94f
wip
jdx Sep 7, 2025
c0e8b33
chore: init agent-os
jdx Sep 7, 2025
f1ef4dd
wip
jdx Sep 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
~/.cache/mise
- run: mise x wait-for-gh-rate-limit -- wait-for-gh-rate-limit
- run: mise install
- run: mise lock --force
- run: mise x -- bun i
- run: mise run render
- run: mise run lint-fix
Expand Down
18 changes: 18 additions & 0 deletions e2e/backend/test_aqua
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,21 @@ assert_contains "MISE_USE_VERSIONS_HOST=0 mise ls-remote aqua:sharkdp/hyperfine"
1.9.0
1.10.0
1.11.0"

# Test Aqua backend with mise lock
export MISE_LOCKFILE=1

cat <<EOF >mise.toml
[tools]
"age" = "1.2.0"
EOF

touch mise.lock
mise install
mise lock --force --platforms macos-arm64
assert_contains "cat mise.lock" '[[tools.age]]'
assert_contains "cat mise.lock" 'version = "1.2.0"'
assert_contains "cat mise.lock" 'backend = "aqua:FiloSottile/age"'
assert_contains "cat mise.lock" 'url = "https://github.com/FiloSottile/age/releases'
assert_contains "cat mise.lock" 'size = 4516837'
assert_contains "cat mise.lock" 'checksum = "blake3:a54d750d8599612d69bc9499b32a549506bfa1e122a051f31754b9ec4d94fc44"'
18 changes: 18 additions & 0 deletions e2e/backend/test_github_tools
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,21 @@ assert_contains "mise x -- rg --version" "ripgrep 14.1.0"
assert "mise use github:nats-io/natscli@0.2.3"
assert "mise which nats"
assert_contains "mise x -- nats --version" "0.2.3"

# Test GitHub backend with mise lock
export MISE_LOCKFILE=1
export MISE_EXPERIMENTAL=1

cat <<EOF >mise.toml
[tools]
"github:BurntSushi/ripgrep" = "14.1.0"
EOF

touch mise.lock
mise install
mise lock --force --platforms macos-arm64
assert_contains "cat mise.lock" '[[tools."github:BurntSushi/ripgrep"]]'
assert_contains "cat mise.lock" 'version = "14.1.0"'
assert_contains "cat mise.lock" 'backend = "github:BurntSushi/ripgrep"'
assert_contains "cat mise.lock" 'url = "https://github.com/BurntSushi/ripgrep/releases'
assert_contains "cat mise.lock" 'platforms.macos-arm64'
193 changes: 76 additions & 117 deletions e2e/cli/test_lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,143 +3,102 @@
export MISE_LOCKFILE=1
export MISE_EXPERIMENTAL=1

echo "=== Testing basic lock command with no lockfiles ==="
# Test basic lock command with no lockfiles
assert_contains "mise lock" "No lockfile found, would create"
assert_contains "mise lock" "full implementation coming in next phase"
echo "=== Testing basic lock command with no tools ==="
# Test basic lock command with no tools configured
assert_contains "mise lock" "No tools found to process"

echo "=== Testing basic lock command with simple lockfile ==="
# Create a basic lockfile and corresponding toml file for testing
echo "=== Testing dry-run with configured tools ==="
# Create a basic toml file with tools
cat <<EOF >mise.toml
[tools]
tiny = "1.0.0"
dummy = "2.0.0"
EOF

cat <<EOF >mise.lock
[tools.tiny]
version = "1.0.0"
backend = "asdf:tiny"
# Test dry-run mode with tools configured
assert_contains "mise lock --dry-run" "Targeting 1 platform(s)"
assert_contains "mise lock --dry-run" "Dry run - showing what would be processed"
assert_contains "mise lock --dry-run" "tiny"
assert_contains "mise lock --dry-run" "dummy"

[tools.dummy]
version = "2.0.0"
backend = "core:dummy"
EOF
echo "=== Testing lockfile generation ==="
# Test actual lockfile generation (will create mise.lock)
assert_contains "mise lock" "Targeting 1 platform(s)"
assert_contains "mise lock" "Lockfile updated at"

# Verify the lockfile was created with new multi-version format
assert "test -f mise.lock" ""
assert_contains "cat mise.lock" "[[tools.tiny]]"
assert_contains "cat mise.lock" "[[tools.dummy]]"
assert_contains "cat mise.lock" "backend ="
assert_contains "cat mise.lock" "version ="

# Test basic lock analysis
assert_contains "mise lock" "Found lockfile"
assert_contains "mise lock" "Tools: dummy, tiny"
assert_contains "mise lock" "No platform data found"
echo "=== Testing tool filtering ==="
# Test filtering by specific tool (dry-run to avoid modifying)
assert_contains "mise lock tiny --dry-run" "tiny"
assert_not_contains "mise lock tiny --dry-run" "dummy"

# Test dry-run mode with no platforms
assert_contains "mise lock --dry-run" "Found lockfile"
assert_contains "mise lock --dry-run" "Tools: dummy, tiny"
assert_contains "mise lock --dry-run" "No platform data found"
echo "=== Testing platform filtering ==="
# Test filtering by specific platform
assert_contains "mise lock --platforms linux-x64" "Targeting 1 platform(s): linux-x64"
assert_contains "mise lock --platforms macos-arm64" "Targeting 1 platform(s): macos-arm64"

echo "=== Testing lockfile with platform data ==="
# Create lockfile with platform-specific data
# Test multiple platform filtering
assert_contains "mise lock --platforms linux-x64,macos-arm64" "Targeting 2 platform(s): linux-x64, macos-arm64"

echo "=== Testing force flag ==="
# Test force flag - should regenerate lockfile even when it doesn't exist
rm -f mise.lock
assert_contains "mise lock --force" "Lockfile updated at"

# Create an existing lockfile with outdated content (missing dummy tool)
cat <<EOF >mise.lock
[tools.tiny]
version = "1.0.0"
backend = "asdf:tiny"

[tools.tiny.platforms.linux-x64]
checksum = "sha256:abc123"
size = 1024
url = "https://example.com/tiny-1.0.0-linux-x64.tar.gz"

[tools.tiny.platforms.macos-arm64]
checksum = "sha256:def456"
size = 2048
url = "https://example.com/tiny-1.0.0-macos-arm64.tar.gz"

[tools.dummy]
version = "2.0.0"
backend = "core:dummy"

[tools.dummy.platforms.linux-x64]
checksum = "sha256:ghi789"
size = 4096
url = "https://example.com/dummy-2.0.0-linux-x64.tar.gz"
[tools]
tiny = [{ backend = "asdf:tiny", version = "1.0.0", platforms = { "linux-x64" = { checksum = "sha256:old_checksum", size = 999, url = "https://example.com/old-url" } } }]
EOF

# Test platform detection
assert_contains "mise lock" "Platforms: linux-x64, macos-arm64"
assert_contains "mise lock" "Would update 2 tool(s) for 2 platform(s)"
# Verify the old lockfile only contains tiny, not dummy
assert_contains "cat mise.lock" "tiny"
assert_not_contains "cat mise.lock" "dummy"
assert_not_contains "cat mise.lock" "[[tools.tiny]]"
assert_not_contains "cat mise.lock" "[[tools.dummy]]"

echo "=== Testing dry-run with detailed output ==="
# Test detailed dry-run output
output=$(mise lock --dry-run)
assert_contains "echo '$output'" "✓ tiny for linux-x64"
assert_contains "echo '$output'" "✓ tiny for macos-arm64"
assert_contains "echo '$output'" "✓ dummy for linux-x64"
# Test that --force regenerates existing lockfile with proper content
assert_contains "mise lock --force" "Lockfile updated at"

echo "=== Testing tool filtering ==="
# Test filtering by specific tool
assert_contains "mise lock tiny" "Would update 1 tool(s) for 2 platform(s)"
assert_contains "mise lock dummy" "Would update 1 tool(s) for 2 platform(s)"
# Verify the lockfile was actually regenerated with both tools from mise.toml
assert_contains "cat mise.lock" "[[tools.tiny]]"
assert_contains "cat mise.lock" "[[tools.dummy]]"
# Verify it's using the new format, not the old one
assert_not_contains "cat mise.lock" "old_checksum"

# Test multiple tool filtering
assert_contains "mise lock tiny dummy" "Would update 2 tool(s) for 2 platform(s)"
echo "=== Testing existing lockfile handling ==="
# Test that when lockfile exists, we extract platforms from it
cat <<EOF >mise.lock
[tools]
tiny = [{ backend = "asdf:tiny", version = "1.0.0", platforms = { "linux-x64" = { checksum = "sha256:abc123", size = 1024, url = "https://example.com/tiny-1.0.0-linux-x64.tar.gz" } } }]
dummy = [{ backend = "core:dummy", version = "2.0.0" }]
EOF

# Test non-existent tool filtering - when no matching tools, no update line is shown
assert_not_contains "mise lock nonexistent" "Would update"
# When lockfile exists and no platform specified, should extract from lockfile
assert_contains "mise lock --dry-run" "Targeting 1 platform(s): linux-x64"

echo "=== Testing platform filtering ==="
# Test filtering by specific platform
assert_contains "mise lock --platform linux-x64" "Would update 2 tool(s) for 1 platform(s)"
assert_contains "mise lock --platform macos-arm64" "Would update 2 tool(s) for 1 platform(s)"
echo "=== Testing aqua cargo-binstall digest resolution ==="
# Ensure that when using aqua for cargo-binstall we resolve GitHub digest (sha256) not fallback blake3
cat <<EOF >mise.toml
[tools]
cargo-binstall = "1.15.3"
EOF

# Test multiple platform filtering
assert_contains "mise lock --platform linux-x64,macos-arm64" "Would update 2 tool(s) for 2 platform(s)"

# Test non-existent platform filtering - when no matching platforms, no update line is shown
assert_not_contains "mise lock --platform windows-x64" "Would update"

echo "=== Testing combined filtering ==="
# Test tool + platform filtering
assert_contains "mise lock tiny --platform linux-x64" "Would update 1 tool(s) for 1 platform(s)"
assert_contains "mise lock dummy --platform macos-arm64" "Would update 1 tool(s) for 1 platform(s)"

# Test dry-run with filtering
output=$(mise lock tiny --platform linux-x64 --dry-run)
assert_contains "echo '$output'" "✓ tiny for linux-x64"
assert_not_contains "echo '$output'" "✓ tiny for macos-arm64"
assert_not_contains "echo '$output'" "✓ dummy for linux-x64"

echo "=== Testing flag combinations ==="
# Test force flag (should still work in analysis mode)
assert_contains "mise lock --force" "Would update 2 tool(s) for 2 platform(s)"

# Test jobs flag
assert_contains "mise lock --jobs 2" "Would update 2 tool(s) for 2 platform(s)"

echo "=== Testing local config focus ==="
# The lock command now focuses on just the current config root
# Verify it works correctly with the local lockfile
assert_contains "mise lock" "Found lockfile"

echo "=== Testing error cases ==="
# Test invalid tool argument - should still show analysis but with no updates
assert_not_contains "mise lock 'invalid@version'" "Would update"

echo "=== Testing lockfile preservation ==="
# Verify that running lock command doesn't modify lockfiles (in current phase)
if command -v sha256sum >/dev/null; then
checksum_before=$(sha256sum mise.lock | cut -d' ' -f1)
mise lock >/dev/null 2>&1
checksum_after=$(sha256sum mise.lock | cut -d' ' -f1)
elif command -v shasum >/dev/null; then
checksum_before=$(shasum -a 256 mise.lock | cut -d' ' -f1)
mise lock >/dev/null 2>&1
checksum_after=$(shasum -a 256 mise.lock | cut -d' ' -f1)
else
# Skip checksum test if neither command is available
echo "Skipping checksum test - neither sha256sum nor shasum available"
checksum_before="test"
checksum_after="test"
fi
assert "echo $checksum_before" "$checksum_after"
rm -f mise.lock
assert_contains "mise lock -f" "Lockfile updated at"

assert_contains "cat mise.lock" "[[tools.cargo-binstall]]"
assert_contains "cat mise.lock" 'backend = "aqua:cargo-bins/cargo-binstall"'
# Expect sha256 algorithm (from GitHub API), not blake3 fallback
assert_contains "cat mise.lock" 'checksum = "sha256:'
assert_not_contains "cat mise.lock" 'checksum = "blake3:'
rm -f mise.toml mise.lock

echo "=== Testing help and version info ==="
# Test that help works
Expand Down
50 changes: 19 additions & 31 deletions e2e/cli/test_lock_creation
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,38 @@ dummy = "2.0.0"
EOF

echo "=== Testing lockfile creation use case ==="
# Test when no lockfiles exist but mise.toml exists
assert_contains "mise lock" "No lockfile found, would create"
assert_contains "mise lock" "mise.lock"
# Test when no lockfiles exist but mise.toml exists - should create lockfile
assert_contains "mise lock" "Targeting 1 platform(s)"
assert_contains "mise lock" "Lockfile updated at mise.lock"

# Should detect the missing lockfile and show what would be created
assert_contains "mise lock" "No lockfile found, would create"
assert_contains "mise lock" "mise.lock"
assert_contains "mise lock" "Would create lockfile with 2 tool(s): tiny, dummy"
assert_contains "mise lock" "Would initialize 2 tool(s) in new lockfile"
# Verify the lockfile was created
assert "test -f mise.lock" ""

echo "=== Testing dry-run mode for lockfile creation ==="
# Test detailed dry-run output
# Remove lockfile and test dry-run
rm -f mise.lock
output=$(mise lock --dry-run)
assert_contains "echo '$output'" "✓ tiny (new lockfile)"
assert_contains "echo '$output'" "✓ dummy (new lockfile)"
assert_contains "echo '$output'" "Dry run - showing what would be processed"
assert_contains "echo '$output'" "tiny"
assert_contains "echo '$output'" "dummy"

echo "=== Testing tool filtering for lockfile creation ==="
# Test filtering by specific tool
assert_contains "mise lock tiny" "Would initialize 1 tool(s) in new lockfile"
output=$(mise lock tiny --dry-run)
assert_contains "echo '$output'" "tiny (new lockfile)"
assert_not_contains "echo '$output'" "dummy (new lockfile)"
assert_contains "echo '$output'" "tiny"
assert_not_contains "echo '$output'" "dummy"

# Test filtering by multiple tools
assert_contains "mise lock tiny dummy" "Would initialize 2 tool(s) in new lockfile"
# Test actual creation with filtering
rm -f mise.lock
assert_contains "mise lock tiny" "Lockfile updated at mise.lock"

# Test non-existent tool filtering
assert_not_contains "mise lock nonexistent" "Would initialize"

echo "=== Testing transition from creation to existing ==="
# Create a lockfile - now it should show as existing instead of missing
cat <<EOF >mise.lock
[tools.tiny]
version = "1.0.0"
backend = "asdf:tiny"
EOF

# Should now show existing lockfile instead of missing
assert_contains "mise lock" "Found lockfile"
assert_not_contains "mise lock" "No lockfile found, would create"
echo "=== Testing lockfile regeneration ==="
# Test that existing lockfile gets updated
assert_contains "mise lock" "Lockfile updated at mise.lock"

echo "=== Testing platform filtering with existing lockfile ==="
# Platform filtering should work with existing lockfile
assert_contains "mise lock --platform linux-x64" "Would update"
assert_contains "mise lock --platforms linux-x64" "Targeting 1 platform(s): linux-x64"

echo "=== Testing help for creation ==="
# Help should mention both updating and creating
Expand Down
4 changes: 2 additions & 2 deletions e2e/cli/test_lock_future
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ cat mise.lock
# - Checksums are updated
# - URLs are current
# - All existing platforms are refreshed
# - New platforms can be added via --platform flag
# - New platforms can be added via --platforms flag

echo "=== Testing platform addition (future) ==="
# This should add a new platform to the lockfile
mise lock --platform macos-arm64
mise lock --platforms macos-arm64

echo "Lockfile with new platform:"
cat mise.lock
Expand Down
Loading
Loading