feat(tasks): add extend mode for task includes#9038
feat(tasks): add extend mode for task includes#9038
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new configuration option, task_config.includes_mode, which allows users to choose between replacing or extending the default task include directories. The implementation includes updates to the configuration structures, logic for merging include paths, and corresponding documentation and E2E tests. Review feedback identifies a logic flaw in how the extension mode is applied across the configuration stack, which could prevent high-priority local configurations from overriding parent settings. There is also a suggestion to address logic duplication and potential inconsistencies between the different task loading mechanisms.
Greptile SummaryThis PR adds an opt-in Confidence Score: 5/5Safe to merge — the recursive extend logic is correct and terminates, all prior review concerns are addressed, and the implementation is well-tested. No P0 or P1 findings. The recursion in No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[task_includes_for_dir] --> B[task_include_specs_for_dir]
B --> C[configs_at_root]
B --> D[replacement_task_include_specs_for_dir]
D --> E{selected_task_include_config}
E -- "None (no config with includes)" --> F[default_task_include_specs_for_dir]
E -- "cf with includes_mode=Replace" --> G[task_include_specs_for_config cf]
E -- "cf with includes_mode=Extend" --> H[exclude cf, recurse]
H --> D
H --> I[prepend inherited specs]
I --> J[append task_include_specs_for_config cf]
K[load_tasks_in_dir] --> A
K --> L[task_git_includes_for_dir]
L --> B
M[load_file_tasks - global only] --> N{includes + mode?}
N -- "Some + Extend" --> O[default_task_includes + config includes]
N -- "Some + Replace" --> P[config includes only]
N -- "None" --> Q[default_task_includes]
Reviews (11): Last reviewed commit: "Merge branch 'main' into task-includes-m..." | Re-trigger Greptile |
75d27f5 to
4aeca61
Compare
This comment was marked as outdated.
This comment was marked as outdated.
4aeca61 to
2807066
Compare
This comment was marked as outdated.
This comment was marked as outdated.
320d4fb to
696c521
Compare
37eb492 to
52ce982
Compare
|
I don't really see much value in this, sorry. If you're using this why wouldn't you just list the directories you know you have? |
|
My idea was to provide a way to avoid repeating the same entries in |
Summary
Follow-up to #8740 and #8905.
Rebased on
mainafter #9039. This branch builds on #9039's fixedMISE_ENVtask-config precedence when resolving stackedtask_config.includes_mode = "extend"inheritance.This adds an explicit opt-in mode for users who want the additive task include behavior from #8740 without changing the existing default replacement semantics that were discussed in review.
task_config.includes_mode = "extend"task_config.includesreplacement behavior whenincludes_modeis unsettask_config.includesentries recursively when extend mode is enabledtask_config.includes_modeto the JSON schemadefault_task_includes()Verification
mise run render:schemacargo fmt --checkgit diff --checkmise run test:e2e e2e/tasks/test_task_includes_env_precedence e2e/tasks/test_task_includes_mode_extende2e/run_test tasks/test_task_remote_git_includes