test(vfox): replace flaky external tests with local dummy plugin#6403
test(vfox): replace flaky external tests with local dummy plugin#6403
Conversation
## Summary - Replaced nodejs plugin with local dummy plugin in vfox tests to eliminate network dependencies - Tests no longer make external HTTP calls to GitHub or nodejs.org - Similar approach to commit b74b778 which fixed flaky HTTP tests with mock servers ## Changes Made - Modified dummy plugin to be completely self-contained (no external calls) - Updated test_env_keys, test_install, test_install_plugin, and test_metadata to use dummy plugin - Updated snapshot tests to reflect dummy plugin output - Added post_install hook to create dummy installation directories ## Testing - All vfox tests pass without network access - Tests are now deterministic and won't fail due to network issues or rate limits ## Related - Fixes flaky test failures seen in CI: https://github.com/jdx/mise/actions/runs/17991508443/job/51182302883 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
This PR replaces flaky external network calls in vfox tests with a local dummy plugin to eliminate dependencies on external services like GitHub and nodejs.org. This makes the tests deterministic and prevents CI failures due to network issues or rate limits.
- Replaced nodejs plugin tests with dummy plugin tests to eliminate external HTTP calls
- Updated snapshot tests to reflect dummy plugin output instead of nodejs plugin
- Enhanced dummy plugin with post_install hook to create installation directories
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/vfox/src/vfox.rs | Updated test methods to use dummy plugin instead of nodejs, removed network-dependent operations |
| crates/vfox/src/snapshots/vfox__vfox__tests__metadata.snap | Updated snapshot to reflect dummy plugin metadata instead of nodejs |
| crates/vfox/src/snapshots/vfox__vfox__tests__env_keys.snap | Updated snapshot to show dummy/1.0.0 path instead of nodejs/20.0.0 |
| crates/vfox/plugins/dummy/metadata.lua | Fixed trailing comma in legacyFilenames array |
| crates/vfox/plugins/dummy/hooks/post_install.lua | Added logic to create dummy installation directories and executable |
| crates/vfox/plugins/dummy/hooks/parse_legacy_file.lua | Simplified legacy file parsing logic |
| crates/vfox/plugins/dummy/hooks/available.lua | Removed trailing commas from version objects |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| end | ||
|
|
||
| -- Create the installation directory structure for dummy plugin | ||
| os.execute("mkdir -p " .. rootPath .. "/bin") |
There was a problem hiding this comment.
Using os.execute with user-controlled input can lead to command injection vulnerabilities. Consider using Lua's built-in file system functions or properly sanitizing the rootPath variable before concatenating it into shell commands.
| if dummy_file then | ||
| dummy_file:write("#!/bin/sh\necho 'dummy version 1.0.0'\n") | ||
| dummy_file:close() | ||
| os.execute("chmod +x " .. rootPath .. "/bin/dummy") |
There was a problem hiding this comment.
Similar to the mkdir command, this os.execute call with concatenated user input poses a command injection risk. Consider using Lua's file system APIs or ensure proper input sanitization.
| version = version | ||
| } | ||
| end | ||
| local file = io.open(filepath, "r") |
There was a problem hiding this comment.
If io.open fails and returns nil, calling file:read() and file:close() on nil will cause a runtime error. Add a nil check after io.open before proceeding with file operations.
| local file = io.open(filepath, "r") | |
| local file = io.open(filepath, "r") | |
| if not file then | |
| return {} | |
| end |
| end | ||
| local file = io.open(filepath, "r") | ||
| local content = file:read("*a") | ||
| file:close() |
There was a problem hiding this comment.
| dummy_file:write("#!/bin/sh\necho 'dummy version 1.0.0'\n") | ||
| dummy_file:close() | ||
| os.execute("chmod +x " .. rootPath .. "/bin/dummy") | ||
| end |
There was a problem hiding this comment.
Bug: Cross-Platform Shell Command Issues
The post_install hook uses non-portable Unix-specific shell commands (mkdir -p, chmod +x) and path separators (/) via os.execute, and writes a sh script. This fails on Windows, preventing directory and binary creation. Unquoted paths also break when rootPath contains spaces, causing installations and tests to fail.
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.9.17 x -- echo |
19.7 ± 0.7 | 18.8 | 26.0 | 1.01 ± 0.04 |
mise x -- echo |
19.5 ± 0.4 | 18.8 | 23.4 | 1.00 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.9.17 env |
18.8 ± 0.7 | 18.3 | 25.2 | 1.00 ± 0.04 |
mise env |
18.8 ± 0.3 | 18.2 | 20.2 | 1.00 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.9.17 hook-env |
18.4 ± 0.2 | 18.0 | 19.2 | 1.00 |
mise hook-env |
18.6 ± 0.3 | 18.1 | 20.3 | 1.01 ± 0.02 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.9.17 ls |
16.5 ± 0.5 | 15.9 | 21.2 | 1.00 |
mise ls |
16.5 ± 0.4 | 15.9 | 19.2 | 1.00 ± 0.04 |
xtasks/test/perf
| Command | mise-2025.9.17 | mise | Variance |
|---|---|---|---|
| install (cached) | 168ms | ✅ 102ms | +64% |
| ls (cached) | 63ms | 62ms | +1% |
| bin-paths (cached) | 70ms | 69ms | +1% |
| task-ls (cached) | 465ms | 463ms | +0% |
✅ Performance improvement: install cached is 64%
### 📦 Registry - fix mise-ghcup plugin managed tools descriptions by @risu729 in [#6411](#6411) - add Tinymist by @3w36zj6 in [#6412](#6412) - revert djinni backend to ubi by @risu729 in [#6410](#6410) ### 🚀 Features - **(github)** filter remote versions by version_prefix by @risu729 in [#6408](#6408) - Remove experimental labels for GitHub and HTTP backends by @Copilot in [#6415](#6415) ### 🧪 Testing - **(vfox)** replace flaky external tests with local dummy plugin by @jdx in [#6403](#6403) ### New Contributors - @Copilot made their first contribution in [#6415](#6415) Co-authored-by: mise-en-dev <release@mise.jdx.dev>
Summary
Changes Made
Testing
cargo test --package vfoxsuccessfullyRelated
🤖 Generated with Claude Code