-
-
Notifications
You must be signed in to change notification settings - Fork 769
fix(tasks): fix nested colons with mise task edit
#6978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This test validates the behavior of `mise task edit foo:bar:baz` and verifies that the created task can be run with `mise run foo:bar:baz`. The test currently exposes a bug where task names with colons (e.g., foo:bar:baz) create files with colons in the filename rather than creating the proper directory structure (foo/bar/baz). This causes the task to not be found when attempting to run it. The name_from_path function in src/task/mod.rs:888 converts colons to underscores in path components and joins them with colons, but the edit command in src/cli/tasks/edit.rs:27 doesn't perform the reverse conversion when creating the file path from the task name. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an end-to-end test to validate the handling of task names containing nested colons (e.g., foo:bar:baz). The test intentionally exposes a bug where the mise task edit command creates files with colons in the filename instead of creating the proper nested directory structure, causing tasks to become unfindable.
Key Changes:
- Adds comprehensive e2e test for task edit/run operations with colon-separated task names
- Validates task creation, execution, and listing for both shallow and deeply nested task names
- Uses a fake editor script to automate the task editing process without user interaction
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # and can be run with `mise run foo:bar:baz` | ||
|
|
||
| # Create a temporary editor script that just writes a simple task | ||
| export EDITOR="$PWD/fake-editor" |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using $PWD/fake-editor creates a dependency on the current working directory. Consider using an absolute path or ensure the script is always run from a known location to prevent failures if the working directory changes during test execution.
|
|
||
| # Test 1: Create a task with nested colons using task edit | ||
| echo "Running: mise task edit foo:bar:baz --path" | ||
| mise task edit foo:bar:baz --path 2>&1 | tee /tmp/task_path.txt |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using hardcoded /tmp paths can cause issues in environments where /tmp is not available or when running tests in parallel. Consider using a test-specific temporary directory (e.g., via mktemp -d) to avoid conflicts and ensure cleanup.
| assert_contains "mise tasks ls" "foo:bar:baz" | ||
|
|
||
| # Test 3: Try editing an existing nested task (should not create duplicates) | ||
| mise task edit foo:bar:baz --path >/tmp/task_path2.txt 2>&1 |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using hardcoded /tmp paths can cause issues in environments where /tmp is not available or when running tests in parallel. Consider using a test-specific temporary directory (e.g., via mktemp -d) to avoid conflicts and ensure cleanup.
| fi | ||
|
|
||
| # Test 4: Create a task with multiple levels of nesting | ||
| mise task edit deploy:prod:backend:api --path >/tmp/task_path3.txt 2>&1 |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using hardcoded /tmp paths can cause issues in environments where /tmp is not available or when running tests in parallel. Consider using a test-specific temporary directory (e.g., via mktemp -d) to avoid conflicts and ensure cleanup.
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.11.4 x -- echo |
18.3 ± 0.3 | 17.9 | 22.4 | 1.00 ± 0.02 |
mise x -- echo |
18.3 ± 0.2 | 17.7 | 21.1 | 1.00 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.11.4 env |
17.8 ± 0.3 | 17.4 | 20.7 | 1.00 |
mise env |
17.9 ± 0.6 | 17.2 | 24.5 | 1.00 ± 0.04 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.11.4 hook-env |
17.9 ± 0.3 | 17.3 | 22.4 | 1.00 |
mise hook-env |
18.0 ± 0.2 | 17.5 | 20.0 | 1.01 ± 0.02 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.11.4 ls |
15.4 ± 0.2 | 15.0 | 16.2 | 1.00 |
mise ls |
15.5 ± 0.2 | 15.0 | 16.3 | 1.01 ± 0.02 |
xtasks/test/perf
| Command | mise-2025.11.4 | mise | Variance |
|---|---|---|---|
| install (cached) | 104ms | 105ms | +0% |
| ls (cached) | 63ms | 63ms | +0% |
| bin-paths (cached) | 69ms | 69ms | +0% |
| task-ls (cached) | 413ms | 415ms | +0% |
When using `mise task edit foo:bar:baz`, the command now correctly creates a directory structure (mise-tasks/foo/bar/baz) instead of creating a file with colons in the filename (mise-tasks/foo:bar:baz). This fix: 1. Replaces colons with MAIN_SEPARATOR_STR when joining the task name to the task directory path (matching the behavior in task add) 2. Creates parent directories if they don't exist using file::create_dir_all() The e2e test now passes, validating that: - Tasks with nested colons create proper directory structures - Tasks can be run with their colon-separated names - Tasks appear correctly in `mise tasks ls` - Deeply nested task names work correctly Fixes the issue where task names like "foo:bar:baz" would create files with colons instead of directories, causing the task to not be found when running `mise run foo:bar:baz`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
mise task edit
### 🚀 Features - **(http)** Add 'format' to http backend by @thejcannon in [#6957](#6957) ### 🐛 Bug Fixes - **(bootstrap)** wrong directory on first run by @vmeurisse in [#6971](#6971) - **(tasks)** fix nested colons with `mise task edit` by @jdx in [#6978](#6978) - Use compatible env flags by @thejcannon in [#6964](#6964) - Flush vfox download buffer by @blampe in [#6969](#6969) ### 📚 Documentation - `arch()` template is `x64` by @thejcannon in [#6967](#6967) - update section headers in getting-started.md by @JunichiroKohari in [#6980](#6980) ### New Contributors - @JunichiroKohari made their first contribution in [#6980](#6980) - @blampe made their first contribution in [#6969](#6969) - @thejcannon made their first contribution in [#6964](#6964) ## 📦 Aqua Registry Updates #### New Packages (1) - [`cirruslabs/cirrus-cli`](https://github.com/cirruslabs/cirrus-cli) #### Updated Packages (1) - [`axodotdev/cargo-dist`](https://github.com/axodotdev/cargo-dist)
Summary
This PR adds an e2e test that validates the behavior of
mise task edit foo:bar:bazand verifies that the created task can be run withmise run foo:bar:baz.Issue
The test currently exposes a bug where task names with colons (e.g.,
foo:bar:baz) create files with colons in the filename rather than creating the proper directory structure (foo/bar/baz). This causes the task to not be found when attempting to run it.Root Cause
The
name_from_pathfunction insrc/task/mod.rs:888converts colons to underscores in path components and joins them with colons to create task names from file paths:mise-tasks/foo/bar/baz→ Task name:foo:bar:bazHowever, the edit command in
src/cli/tasks/edit.rs:27doesn't perform the reverse conversion when creating the file path from the task name:This means when you run
mise task edit foo:bar:baz, it createsmise-tasks/foo:bar:baz(with colons in the filename) instead ofmise-tasks/foo/bar/baz(directory structure).Test Plan
Run the test to see it fail (exposing the bug):
The test validates:
mise task edit foo:bar:bazmise run foo:bar:bazmise tasks lsdeploy:prod:backend:api🤖 Generated with Claude Code
Note
Maps colon-separated task names to nested file paths in
tasks editand adds e2e tests validating creation, execution, and listing of nested tasks.src/cli/tasks/edit.rsto convert:in task names to path separators (MAIN_SEPARATOR_STR) when creating paths:foo:bar:baz→foo/bar/baz.file::create_dir_all).e2e/tasks/test_task_edit_nested_namescovering:mise task edit foo:bar:baz --path.mise run foo:bar:baz,deploy:prod:backend:api).mise tasks lsand paths are stable across edits.Written by Cursor Bugbot for commit 1a363f4. This will update automatically on new commits. Configure here.