Skip to content

fix(task): resolve templates in included task files#10312

Merged
jdx merged 1 commit into
mainfrom
codex/fix-included-task-template
Jun 11, 2026
Merged

fix(task): resolve templates in included task files#10312
jdx merged 1 commit into
mainfrom
codex/fix-included-task-template

Conversation

@jdx

@jdx jdx commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes task template resolution for tasks defined in TOML files loaded through task_config.includes.

Tasks loaded from included tasks.toml files were parsed and rendered without receiving the collected task_templates map, so a task that only had extends = "template:..." could be loaded without the template's run entries and then exit successfully without doing anything.

Changes

Validation

  • mise run test:e2e e2e/tasks/test_task_templates

Fixes #8779


Note

Low Risk
Narrow change to task-loading plumbing with a regression e2e; fixes incorrect silent no-op runs, no auth or data-path impact.

Overview
Fixes extends for tasks loaded from task_config.includes TOML files (e.g. tasks.toml), where templates were never applied so tasks could run with no run and succeed silently.

The collected task_templates map is now passed through load_file_tasksload_tasks_includesload_task_file, and resolve_task_template runs on included TOML tasks before rendering—the same path inline [tasks.*] entries already used. Monorepo subdirectory include loading gets the same threading.

An e2e case covers a template in mise.toml with a task in an included tasks.toml that extends it.

Reviewed by Cursor Bugbot for commit a56da5b. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Tests

    • Added validation for task template definitions applied to tasks in included task configuration files.
  • Chores

    • Enhanced task template support in the configuration and file task loading pipeline.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change extends task template support to tasks defined in included TOML files. Task templates are now passed through the entire file loading pipeline—from load_config_and_file_tasks through load_file_tasks and load_tasks_includes to load_task_file—where they are resolved before task rendering, enabling the extends keyword to work in included task definitions.

Changes

Task Template Support in Included Tasks

Layer / File(s) Summary
E2E validation of task template support in includes
e2e/tasks/test_task_templates
New test case validates that tasks in included tasks.toml files can extend templates defined in mise.toml by enabling experimental mode, creating a template, including a tasks.toml, and confirming the task runs with the template's behavior.
Task loading pipeline threading and template resolution
src/config/mod.rs
Function signatures for task loading (load_file_tasks, load_tasks_includes, load_task_file) accept templates and forward them through the chain. load_task_file resolves task template extends before rendering. Monorepo subdirectory loading and per-directory task loading forward templates. Existing per-task-vars test updated to pass empty template map to satisfy new signatures.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • jdx/mise#10219: Intersects with the task-include TOML loading pipeline in load_tasks_includes and load_task_file, extending directory includes to load .toml files, which shares the same code paths being modified for template threading.

Poem

🐰 Templates flow through tasks so true,
From config down to files anew,
Extends now works in includes grand,
Where configs dance and tasks are planned! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: resolving task templates in included task files, which directly matches the PR's core objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@jdx jdx changed the title [codex] fix included task template resolution fix included task template resolution Jun 11, 2026
@jdx jdx marked this pull request as ready for review June 11, 2026 19:07
@jdx jdx changed the title fix included task template resolution fix(task): resolve templates in included task files Jun 11, 2026
@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes silent no-op task runs when a task in an included tasks.toml uses extends to reference a template defined in mise.toml. The root cause was that load_task_file never received the collected task_templates map, so resolve_task_template was never called before render.

  • templates is now threaded through load_file_tasksload_tasks_includesload_task_file, and resolve_task_template is called on each TOML task before rendering — identical to the path already used for inline [tasks.*] entries.
  • The monorepo subdir no-config path (!found_config branch) also gets the fix, keeping parity across all task-loading entry points.
  • An e2e regression (assert_fail) confirms that the included task executes the template's run script and no longer exits silently.

Confidence Score: 5/5

Narrow plumbing change — adds a missing parameter to three call sites, no new logic, backed by a regression e2e that catches the original silent-exit behaviour.

The change is strictly additive: every call site that already had templates now forwards it further down the call chain, and the function signatures are updated in lock-step. The inline-task path already used resolve_task_template in exactly the same position, so the new call in load_task_file is a direct copy of proven code. The unit test for load_task_file is updated to pass IndexMap::new() (the correct empty-templates default). The e2e covers the exact reproduction scenario from the linked discussion.

No files require special attention.

Important Files Changed

Filename Overview
src/config/mod.rs Threads templates through load_file_tasksload_tasks_includesload_task_file and calls resolve_task_template on each TOML task before rendering, mirroring the existing inline-task path
e2e/tasks/test_task_templates Adds a regression test verifying that a task in an included tasks.toml that extends a template actually executes the template's run (uses assert_fail to confirm non-silent execution)

Reviews (1): Last reviewed commit: "fix(task): resolve templates in included..." | Re-trigger Greptile

@jdx jdx enabled auto-merge (squash) June 11, 2026 19:13
@jdx jdx merged commit 7048974 into main Jun 11, 2026
34 checks passed
@jdx jdx deleted the codex/fix-included-task-template branch June 11, 2026 19:21
@github-actions

Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.2 x -- echo 22.0 ± 2.0 19.0 29.7 1.00
mise x -- echo 22.3 ± 2.0 19.7 45.2 1.01 ± 0.13

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.2 env 20.7 ± 1.3 18.7 28.7 1.00
mise env 21.1 ± 1.0 19.4 26.5 1.02 ± 0.08

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.2 hook-env 21.9 ± 1.9 19.2 30.7 1.00
mise hook-env 23.8 ± 2.0 20.3 33.9 1.09 ± 0.13

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.2 ls 17.9 ± 1.2 15.7 23.0 1.00
mise ls 20.6 ± 2.7 16.0 31.2 1.15 ± 0.17
⚠️ Inconclusive: ls measured 15% slower, but the relative uncertainty overlaps the 10% threshold.

xtasks/test/perf

Command mise-2026.6.2 mise Variance
install (cached) 149ms 151ms -1%
ls (cached) 64ms 66ms -3%
bin-paths (cached) 74ms 77ms -3%
task-ls (cached) 136ms 137ms +0%

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.

1 participant