fix(task): render dependency templates even when no args are passed#9062
fix(task): render dependency templates even when no args are passed#9062
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the dependency rendering logic to support default usage values by removing the requirement that a task must have explicit arguments. In both src/cli/run.rs and src/task/deps.rs, the code now attempts to parse usage values even when args is empty, allowing {{usage.*}} templates to resolve correctly. The reviewer suggested optimizing the implementation in src/cli/run.rs by adding a guard to check for the existence of usage templates before parsing, which avoids unnecessary processing for tasks that do not use them.
Greptile SummaryRemoves the Confidence Score: 5/5Safe to merge — the fix is narrowly scoped, logically correct, and has no regressions on existing tests. Both changes are symmetric and minimal: they replace an overly-restrictive No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Task invoked] --> B{has_usage_deps\nin depends/wait_for?}
B -- No --> G[resolve_depends\nskips usage templates]
B -- Yes --> C[parse_usage_values_from_task\nparses spec + applies defaults]
C --> D{usage_values\nempty?}
D -- Yes\nno defaults/required arg missing --> G
D -- No --> E[render_depends_with_usage\nreplaces usage.* templates]
E --> F[resolve_depends\nmatches resolved dep names]
G --> H[Tasks run without rendered deps]
F --> I[Tasks run with correct deps]
style H fill:#ffcccc
style I fill:#ccffcc
Reviews (3): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile |
602b819 to
5627ac8
Compare
…dx#9062) ## Summary - Fix `{{usage.*}}` templates in `depends` not being rendered when the task is invoked without arguments - The `!task.args.is_empty()` guard in both `run.rs` and `deps.rs` prevented template rendering when no CLI args were passed, even though the usage spec may define defaults - Dependencies with unrendered `{{usage.*}}` templates were silently dropped, causing the task to run with no dependencies at all --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
### 🐛 Bug Fixes - **(docs)** typo in Go Backend by @dolmen in [#9065](#9065) - **(task)** render dependency templates even when no args are passed by @MatthiasGrandl in [#9062](#9062) - support npm semver ranges in devEngines by @risu729 in [#9061](#9061) ### New Contributors - @dolmen made their first contribution in [#9065](#9065) - @MatthiasGrandl made their first contribution in [#9062](#9062)
Summary
{{usage.*}}templates independsnot being rendered when the task is invoked without arguments!task.args.is_empty()guard in bothrun.rsanddeps.rsprevented template rendering when no CLI args were passed, even though the usage spec may define defaults{{usage.*}}templates were silently dropped, causing the task to run with no dependencies at all