Skip to content

fix(tasks): global file tasks not properly marked as such#8618

Merged
jdx merged 1 commit intojdx:mainfrom
roele:issues/8615
Mar 19, 2026
Merged

fix(tasks): global file tasks not properly marked as such#8618
jdx merged 1 commit intojdx:mainfrom
roele:issues/8615

Conversation

@roele
Copy link
Copy Markdown
Contributor

@roele roele commented Mar 16, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 16, 2026 22:24
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a bug where tasks defined in global configuration files were not being properly identified as global tasks. The changes introduce a new utility function to detect global task paths and integrate this logic into the task loading process, ensuring that all tasks sourced from global locations are correctly flagged. This fix improves the accuracy of task filtering and listing, particularly when using the --global option.

Highlights

  • Bug Fix: Global Task Identification: Addressed an issue where tasks defined in global configuration files were not correctly marked as 'global', leading to them not appearing when filtered with --global.
  • New Helper Function: Introduced is_global_task_include_path to determine if a given path points to a global task configuration directory.
  • Task Loading Logic Update: Modified load_local_tasks_with_context, load_file_tasks, and load_tasks_in_dir to utilize the new helper function and explicitly set the global flag for tasks originating from global paths.
  • E2E Test Enhancement: Updated the test_task_ls_global end-to-end test to include a global file-based task and verify that it is correctly listed under both general and global task listings.
Changelog
  • e2e/tasks/test_task_ls_global
    • Added a new global file task for testing purposes.
    • Updated assertions to verify that the new global file task is correctly listed when querying all tasks and specifically global tasks.
  • src/config/mod.rs
    • Implemented is_global_task_include_path function to check if a path is within a global task configuration directory.
    • Modified load_local_tasks_with_context to mark tasks as global if their include path is global.
    • Modified load_file_tasks to mark tasks as global if the configuration file itself is global.
    • Modified load_tasks_in_dir to mark tasks as global if their include path is global.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 16, 2026

Greptile Summary

This PR fixes a bug where file-based tasks located in the global task directory (~/.config/mise/tasks or the system config tasks dir) were not being tagged with global = true, causing them to be absent from mise tasks --global output.

The fix introduces two small helpers — is_global_task_include_path (path-component-aware check using Rust's starts_with) and mark_tasks_as_global — and applies them consistently across the three code paths that load file tasks: load_file_tasks, load_tasks_in_dir, and the no-config branch of the monorepo loader in load_local_tasks_with_context. An e2e test is added to cover the new behaviour.

Key points:

  • is_global_task_include_path uses Path::starts_with, which compares by path component, so there are no false-positive matches for sibling directories (e.g. ~/.config/mise/tasks-custom is not matched).
  • load_config_tasks (inline [tasks] entries) continues to use is_global_config to determine globalness; the new path-based approach applies only to file tasks. This is a pre-existing architectural split that isn't worsened by the PR.
  • The e2e test correctly verifies the file task appears in mise tasks and mise tasks --global but not in mise tasks --local.

Confidence Score: 4/5

  • Safe to merge; targeted fix with minimal blast radius and a covering e2e test.
  • The change is small and surgical — two new helpers applied in three call sites. The path-component-level starts_with check is safe and correct. The only pre-existing asymmetry (path-based detection in load_file_tasks vs. config-file-based detection in load_config_tasks) is not introduced by this PR. The e2e test validates the primary scenario. Score of 4 rather than 5 to acknowledge the missing cleanup of test artifacts and the minor gap for the found_config=true monorepo branch (which is covered indirectly via load_file_tasks but not with an explicit guard at the call site).
  • No files require special attention.

Important Files Changed

Filename Overview
src/config/mod.rs Introduces is_global_task_include_path and mark_tasks_as_global helpers and applies them in load_file_tasks, load_tasks_in_dir, and the no-config monorepo branch of load_local_tasks_with_context. The path-based global detection using Rust's component-aware starts_with is safe. The fix is applied consistently across all three loading code paths where file tasks can originate.
e2e/tasks/test_task_ls_global Adds a new executable file task at ~/.config/mise/tasks/myglobalfile and extends assertions to verify it appears in mise tasks and mise tasks --global but not in mise tasks --local. Alphabetical ordering of task names in the assertions is correct. The created file is not cleaned up at the end of the test (consistent with existing ~/.config/mise/config.toml behaviour).

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Load tasks] --> B{Source?}
    B --> C[load_file_tasks\nconfig includes]
    B --> D[load_tasks_in_dir\ntask_includes_for_dir]
    B --> E[load_local_tasks_with_context\nmonorepo, no config]

    C --> F{is_global_task_include_path?}
    D --> F
    E --> F

    F -- yes --> G[mark_tasks_as_global\ntask.global = true]
    F -- no --> H[task.global unchanged]

    G --> I[tasks returned]
    H --> I

    subgraph is_global_task_include_path
        J{path.starts_with\ndirs::CONFIG/tasks\nOR\ndirs::SYSTEM_CONFIG/tasks}
    end

    F --> J
Loading

Last reviewed commit: 5839c66

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes an issue where global file-based tasks were not being correctly marked as global. The changes introduce a new helper function is_global_task_include_path and modify several task loading functions to correctly set the global flag on tasks loaded from global paths. The logic appears correct and is supported by a new end-to-end test. I've identified some code duplication across the task loading functions and suggested a small refactoring to improve maintainability.

Comment thread src/config/mod.rs Outdated
Comment thread src/config/mod.rs Outdated
Comment thread src/config/mod.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes task “global” classification so that executable task files located in the global task directories are correctly marked as global and therefore show up under mise tasks --global.

Changes:

  • Add a helper to detect whether a task include path points at global task directories.
  • Mark tasks loaded from global task include paths (and from global config files) with task.global = true.
  • Extend the e2e test to cover global executable task files in ~/.config/mise/tasks.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/config/mod.rs Detect global task include roots and propagate task.global = true when loading tasks from those locations.
e2e/tasks/test_task_ls_global Adds coverage to ensure global file-based tasks are listed by default and under --global.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread e2e/tasks/test_task_ls_global
Comment thread src/config/mod.rs Outdated
@jdx jdx merged commit e9fef19 into jdx:main Mar 19, 2026
34 checks passed
@roele roele deleted the issues/8615 branch March 20, 2026 17:02
jdx pushed a commit that referenced this pull request Mar 21, 2026
### 🐛 Bug Fixes

- **(config)** resolve trust hash collision for same-name directories by
@tdragon in [#8628](#8628)
- **(docs)** fix width of tools table by @himkt in
[#8625](#8625)
- **(docs)** prevent homepage hero atmosphere overflow by @nygmaaa in
[#8642](#8642)
- **(doctor)** detect PATH ordering issues when mise is activated by
@jdx in [#8585](#8585)
- **(git)** use origin as remote name by @bentinata in
[#8626](#8626)
- **(installer)** normalize current version before comparison by @tak848
in [#8649](#8649)
- **(lockfile)** Resolve symlink when updating lockfiles by @chancez in
[#8589](#8589)
- **(python)** verify checksums for precompiled binary downloads by
@malept in [#8593](#8593)
- **(rust)** resolve relative CARGO_HOME/RUSTUP_HOME to absolute paths
by @simonepri in [#8604](#8604)
- **(task)** correctly resolve task name for _default files with
extensions by @youta1119 in
[#8646](#8646)
- **(tasks)** global file tasks not properly marked as such by @roele in
[#8618](#8618)
- **(tasks)** handle broken pipe in table print and task completion
output by @vmaleze in [#8608](#8608)
- use dark/light logo variants in README for GitHub dark mode by @jdx in
[#8656](#8656)
- failing rebuild of runtime symlinks for shared tools by @roele in
[#8647](#8647)
- add spaces around current element operator in flutter version_expr by
@roele in [#8616](#8616)
- complete task arguments correctly by @KevSlashNull in
[#8601](#8601)

### 📚 Documentation

- switch body font to DM Sans and darken dark mode background by @jdx in
[6e3ad34](6e3ad34)
- use Cormorant Garamond for headers and Roc Grotesk for body text by
@jdx in
[010812a](010812a)
- resolve chaotic heading hierarchy in task-arguments.md by @muzimuzhi
in [#8644](#8644)

### 🧪 Testing

- fix test_java and mark as slow by @roele in
[#8634](#8634)

### 📦️ Dependency Updates

- update docker/dockerfile:1 docker digest to 4a43a54 by @renovate[bot]
in [#8657](#8657)
- update ghcr.io/jdx/mise:alpine docker digest to 2584470 by
@renovate[bot] in [#8658](#8658)

### 📦 Registry

- add viteplus (npm:vite-plus) by @risu729 in
[#8594](#8594)
- remove backend.options for podman by @roele in
[#8633](#8633)
- add pi.dev coding agent by @dector in
[#8635](#8635)
- add ormolu ([github:tweag/ormolu](https://github.com/tweag/ormolu)) by
@3w36zj6 in [#8617](#8617)
- use version_expr for dart and sort versions by @roele in
[#8631](#8631)

### New Contributors

- @bentinata made their first contribution in
[#8626](#8626)
- @tdragon made their first contribution in
[#8628](#8628)
- @nygmaaa made their first contribution in
[#8642](#8642)
- @youta1119 made their first contribution in
[#8646](#8646)
- @chancez made their first contribution in
[#8589](#8589)
- @dector made their first contribution in
[#8635](#8635)
- @tak848 made their first contribution in
[#8649](#8649)

## 📦 Aqua Registry Updates

#### New Packages (5)

- [`acsandmann/rift`](https://github.com/acsandmann/rift)
-
[`alltuner/mise-completions-sync`](https://github.com/alltuner/mise-completions-sync)
- [`berbicanes/apiark`](https://github.com/berbicanes/apiark)
-
[`gitlab.com/graphviz/graphviz`](https://github.com/gitlab.com/graphviz/graphviz)
-
[`jorgelbg/pinentry-touchid`](https://github.com/jorgelbg/pinentry-touchid)

#### Updated Packages (7)

- [`UpCloudLtd/upcloud-cli`](https://github.com/UpCloudLtd/upcloud-cli)
- [`aquaproj/registry-tool`](https://github.com/aquaproj/registry-tool)
- [`go-swagger/go-swagger`](https://github.com/go-swagger/go-swagger)
-
[`gopinath-langote/1build`](https://github.com/gopinath-langote/1build)
- [`sassman/t-rec-rs`](https://github.com/sassman/t-rec-rs)
- [`sharkdp/fd`](https://github.com/sharkdp/fd)
- [`temporalio/cli`](https://github.com/temporalio/cli)
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.

4 participants