Skip to content

fix(tasks): add file task header parser support for spaces around =#8574

Merged
jdx merged 1 commit intojdx:mainfrom
roele:issues/8546
Mar 12, 2026
Merged

fix(tasks): add file task header parser support for spaces around =#8574
jdx merged 1 commit intojdx:mainfrom
roele:issues/8546

Conversation

@roele
Copy link
Copy Markdown
Contributor

@roele roele commented Mar 12, 2026

Current behaviour might be a bit misleading as found in #8546. @jdx any particular reason spaces around = shouldn't be supported?

Copilot AI review requested due to automatic review settings March 12, 2026 19:37
@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 enhances the task header parsing logic to accommodate spaces around the equals sign in variable assignments. This change improves the flexibility and robustness of the task parsing mechanism, ensuring that task headers with spaces around the equals sign are correctly interpreted. A new test case was added to validate the fix.

Highlights

  • File Task Header Parsing: The pull request modifies the regex used to parse file task headers to allow for spaces around the = sign, addressing a potential issue where the current behavior might be misleading.
  • Test Case: A new test case test_from_path_env_file_with_spaces_around_equals was added to verify that the task parser correctly handles spaces around the equals sign in environment variable assignments within task headers.
Changelog
  • src/task/mod.rs
    • Modified regex to allow spaces around the '=' in task header variable assignments.
Activity
  • The pull request addresses issue File tasks do no honor "env._.file" #8546, which reported that the current behavior might be misleading.
  • The author, roele, has requested feedback on whether spaces around the '=' should be supported, referencing a discussion with @jdx.
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.

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 correctly adds support for spaces around the equals sign in task file headers by updating the parsing regular expression. A corresponding test case is also added to validate the new behavior. The changes are straightforward and well-implemented.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 12, 2026

Greptile Summary

This PR makes the file-task header parser tolerant of optional whitespace around the = sign (e.g. #MISE env._.file = "env.yaml"), matching the ergonomic expectation reported in issue #8546. The fix is a one-line regex change in Task::from_path and a new unit test that validates end-to-end env-file loading with the spaced syntax.

  • Regex change (src/task/mod.rs:323): [a-z0-9_.-]+=[a-z0-9_.-]+\s*=\s* — allows zero or more whitespace characters on both sides of =. The captured TOML fragment (e.g. key = value) is valid TOML, so the downstream toml::de::from_str call is unaffected.
  • New test test_from_path_env_file_with_spaces_around_equals: creates a scratch task file with #MISE env._.file = "env.yaml", resolves its env, and asserts the expected variable is present. The test is guarded with #[cfg(unix)]; since the file is only parsed (not executed) and YAML loading is cross-platform, this guard may be more conservative than necessary, but it is not incorrect.

Confidence Score: 5/5

  • This PR is safe to merge — the change is a minimal, well-scoped regex relaxation with a targeted unit test.
  • The regex change is a single-character-class addition (\s*) on both sides of =, TOML's own parser already accepts spaces around = so the captured string remains valid, the logic path is unchanged, and a new unit test directly validates the fixed behavior.
  • No files require special attention.

Important Files Changed

Filename Overview
src/task/mod.rs Regex updated to allow optional whitespace (\s*) around = in file task header directives; new unit test added to validate the behavior with env._.file = "env.yaml" syntax.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Task file read line-by-line] --> B{Regex match on line}
    B -- No match --> C[Skip line]
    B -- Match --> D[Extract captured TOML token]
    D --> E[toml parse as toml Value]
    E -- Parse error --> F[Return Err]
    E -- Success --> G[Collect into Vec of toml Values]
    G --> H[Filter to toml Table entries]
    H --> I[Deep-merge tables via fold]
    I --> J[Parse task fields: description, alias, env, etc]
Loading

Last reviewed commit: 0afeafa

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

This PR updates the file-task header parser so #MISE TOML assignments can include whitespace around = (e.g. env._.file = "env.yaml"), addressing the confusing behavior reported in #8546.

Changes:

  • Relax the task-header capture regex to allow optional whitespace around =.
  • Add a regression test ensuring env._.file = "..." headers are parsed and applied correctly.

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

@jdx jdx merged commit 9043fe0 into jdx:main Mar 12, 2026
34 checks passed
@roele roele deleted the issues/8546 branch March 13, 2026 06:32
mise-en-dev added a commit that referenced this pull request Mar 13, 2026
### 🚀 Features

- **(github)** use release latest endpoint to get latest release by
@roele in [#8516](#8516)
- **(install)** add shared and system install directories by @jdx in
[#8581](#8581)
- **(vfox)** add provenance metadata to lockfile for tool plugins by
@malept in [#8544](#8544)

### 🐛 Bug Fixes

- **(aqua)** expose main binary when files field is empty and
symlink_bins is enabled by @AlexanderTheGrey in
[#8550](#8550)
- **(env)** redact secrets in `mise set` listing and task-specific env
by @jdx in [#8583](#8583)
- **(prepare)** install config tools before running prepare steps by
@jdx in [#8582](#8582)
- **(task)** allow ctrl-c to interrupt tool downloads during `mise run`
by @jdx in [#8571](#8571)
- **(tasks)** add file task header parser support for spaces around = by
@roele in [#8574](#8574)

### 📚 Documentation

- **(task)** add property description for interactive by @roele in
[#8562](#8562)
- add missing `</bold>` closing tag by @muzimuzhi in
[#8564](#8564)
- rebrand site with new chef logo and warm culinary palette by @jdx in
[#8587](#8587)

### 📦️ Dependency Updates

- update ghcr.io/jdx/mise:alpine docker digest to de4657e by
@renovate[bot] in [#8577](#8577)
- update ghcr.io/jdx/mise:copr docker digest to eef29a2 by
@renovate[bot] in [#8578](#8578)
- update ghcr.io/jdx/mise:rpm docker digest to 5a96587 by @renovate[bot]
in [#8580](#8580)
- update ghcr.io/jdx/mise:deb docker digest to 464cf7c by @renovate[bot]
in [#8579](#8579)

### 📦 Registry

- fix flatc version test mismatch by @jdx in
[#8588](#8588)

### Chore

- **(registry)** skip spark test-tool by @jdx in
[#8572](#8572)

### New Contributors

- @AlexanderTheGrey made their first contribution in
[#8550](#8550)

## 📦 Aqua Registry Updates

#### New Packages (6)

- [`bahdotsh/mdterm`](https://github.com/bahdotsh/mdterm)
-
[`callumalpass/mdbase-lsp`](https://github.com/callumalpass/mdbase-lsp)
- [`facebook/ktfmt`](https://github.com/facebook/ktfmt)
- [`gurgeous/tennis`](https://github.com/gurgeous/tennis)
-
[`tektoncd/pipelines-as-code`](https://github.com/tektoncd/pipelines-as-code)
- [`weedonandscott/trolley`](https://github.com/weedonandscott/trolley)

#### Updated Packages (2)

- [`apple/container`](https://github.com/apple/container)
- [`cocogitto/cocogitto`](https://github.com/cocogitto/cocogitto)
fragon10 pushed a commit to fragon10/mise that referenced this pull request Mar 27, 2026
…dx#8574)

Current behaviour might be a bit misleading as found in jdx#8546. @jdx any
particular reason spaces around `=` shouldn't be supported?

Co-authored-by: mise-en-dev <release@mise.jdx.dev>
fragon10 pushed a commit to fragon10/mise that referenced this pull request Mar 27, 2026
### 🚀 Features

- **(github)** use release latest endpoint to get latest release by
@roele in [jdx#8516](jdx#8516)
- **(install)** add shared and system install directories by @jdx in
[jdx#8581](jdx#8581)
- **(vfox)** add provenance metadata to lockfile for tool plugins by
@malept in [jdx#8544](jdx#8544)

### 🐛 Bug Fixes

- **(aqua)** expose main binary when files field is empty and
symlink_bins is enabled by @AlexanderTheGrey in
[jdx#8550](jdx#8550)
- **(env)** redact secrets in `mise set` listing and task-specific env
by @jdx in [jdx#8583](jdx#8583)
- **(prepare)** install config tools before running prepare steps by
@jdx in [jdx#8582](jdx#8582)
- **(task)** allow ctrl-c to interrupt tool downloads during `mise run`
by @jdx in [jdx#8571](jdx#8571)
- **(tasks)** add file task header parser support for spaces around = by
@roele in [jdx#8574](jdx#8574)

### 📚 Documentation

- **(task)** add property description for interactive by @roele in
[jdx#8562](jdx#8562)
- add missing `</bold>` closing tag by @muzimuzhi in
[jdx#8564](jdx#8564)
- rebrand site with new chef logo and warm culinary palette by @jdx in
[jdx#8587](jdx#8587)

### 📦️ Dependency Updates

- update ghcr.io/jdx/mise:alpine docker digest to de4657e by
@renovate[bot] in [jdx#8577](jdx#8577)
- update ghcr.io/jdx/mise:copr docker digest to eef29a2 by
@renovate[bot] in [jdx#8578](jdx#8578)
- update ghcr.io/jdx/mise:rpm docker digest to 5a96587 by @renovate[bot]
in [jdx#8580](jdx#8580)
- update ghcr.io/jdx/mise:deb docker digest to 464cf7c by @renovate[bot]
in [jdx#8579](jdx#8579)

### 📦 Registry

- fix flatc version test mismatch by @jdx in
[jdx#8588](jdx#8588)

### Chore

- **(registry)** skip spark test-tool by @jdx in
[jdx#8572](jdx#8572)

### New Contributors

- @AlexanderTheGrey made their first contribution in
[jdx#8550](jdx#8550)

## 📦 Aqua Registry Updates

#### New Packages (6)

- [`bahdotsh/mdterm`](https://github.com/bahdotsh/mdterm)
-
[`callumalpass/mdbase-lsp`](https://github.com/callumalpass/mdbase-lsp)
- [`facebook/ktfmt`](https://github.com/facebook/ktfmt)
- [`gurgeous/tennis`](https://github.com/gurgeous/tennis)
-
[`tektoncd/pipelines-as-code`](https://github.com/tektoncd/pipelines-as-code)
- [`weedonandscott/trolley`](https://github.com/weedonandscott/trolley)

#### Updated Packages (2)

- [`apple/container`](https://github.com/apple/container)
- [`cocogitto/cocogitto`](https://github.com/cocogitto/cocogitto)
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