Skip to content

fix(task): normalize variadic usage env values - #11881

Merged
jdx merged 1 commit into
jdx:mainfrom
Marukome0743:pr11878
Aug 12, 2026
Merged

jdx merged 1 commit into
jdx:mainfrom
Marukome0743:pr11878

Conversation

@Marukome0743

@Marukome0743 Marukome0743 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • normalize environment-backed variadic usage arguments and value-taking flags to arrays in the structured Tera usage map
  • preserve each environment variable as one array element instead of splitting on whitespace
  • add unit and offline E2E coverage for env values, CLI precedence, joining, indexing, and iteration

Root cause

usage-lib returns CLI and default values for var=#true as MultiString, but returns an env= value as a scalar String. mise copied that parser type directly into the Tera context, so filters such as join rejected environment-backed variadic values even though the documented usage map contract says they are arrays.

This change normalizes the value at mise's structured Tera boundary. It intentionally leaves the shell-facing $usage_* serialization and deprecated template helpers unchanged. A single environment variable remains one logical value, preserving embedded whitespace and matching the existing single-string default behavior.

Verification

  • mise exec -- cargo test --all-features task::task_script_parser::tests
  • mise run test:e2e e2e/tasks/test_task_usage_map_tera e2e/tasks/test_task_usage_env_tera
  • mise exec -- cargo check --all-features
  • mise exec -- cargo clippy --workspace --all-features --all-targets -- -D warnings
  • mise exec -- cargo fmt --all -- --check
  • mise exec -- shellcheck e2e/tasks/test_task_usage_map_tera
  • mise exec -- shfmt -d e2e/tasks/test_task_usage_map_tera

mise run format and mise run lint reach the repository-wide hk wrapper, which exits before running checks because this checkout is managed by Sapling and hk requires a Git worktree. The relevant formatting, shell, Cargo, and Clippy checks above pass when run directly.

Addresses #7550

AI-assisted — Tool: Codex; model: OpenAI/GPT-5; version: unavailable.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The task usage parser now exposes environment-backed variadic strings and flags as single-element arrays. Parser tests and an end-to-end Tera task test verify array rendering and CLI precedence.

Changes

Variadic environment values

Layer / File(s) Summary
Normalize variadic environment values
src/task/task_script_parser.rs
Variadic string arguments and flags from environment variables now become single-element arrays. Tests cover environment defaults, explicit CLI values, joining, rendering, and structured usage context.
Validate Tera rendering
e2e/tasks/test_task_usage_map_tera
The end-to-end test verifies array length, separator joining, iteration output, and CLI precedence over NODENAMES.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: jdx, risu729, jambalaya56562

Poem

I’m a rabbit with arrays in tow,
One env value, one neat row.
CLI carrots hop ahead,
Tera loops where they are led.
Parse, render, and tests all glow!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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: normalizing variadic task usage values from environment variables.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Marukome0743
Marukome0743 force-pushed the pr11878 branch 2 times, most recently from 2454b7d to 3f00f31 Compare August 11, 2026 15:36
@github-actions

Copy link
Copy Markdown
Contributor

This PR currently has failing checks. If this continues for 7 days, it will be closed automatically.

This is warning day 1 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@Marukome0743
Marukome0743 force-pushed the pr11878 branch 3 times, most recently from 86d8e6b to eea07c6 Compare August 12, 2026 04:37
@Marukome0743
Marukome0743 marked this pull request as ready for review August 12, 2026 23:39
@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR normalizes environment-backed variadic arguments and value-taking flags into one-element arrays at the structured Tera usage-map boundary.

  • Preserves embedded whitespace within each environment variable value.
  • Keeps CLI-provided variadic values as multi-element arrays with CLI precedence.
  • Adds unit and offline end-to-end coverage for array length, joining, indexing, and iteration.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The normalization is restricted to variadic string arguments and value-taking flags, preserves each environment value as one logical element, and is covered across environment and CLI paths.

Important Files Changed

Filename Overview
src/task/task_script_parser.rs Normalizes scalar parser output for environment-backed variadic string values while retaining existing boolean, count, scalar, and multi-string conversions; focused tests cover arguments and value-taking flags.
e2e/tasks/test_task_usage_map_tera Adds end-to-end checks confirming one-element environment arrays, whitespace preservation, iteration, joining, and CLI precedence.

Reviews (1): Last reviewed commit: "fix(task): normalize variadic usage env ..." | Re-trigger Greptile

@jdx
jdx merged commit 587da7c into jdx:main Aug 12, 2026
30 checks passed
@Marukome0743
Marukome0743 deleted the pr11878 branch August 12, 2026 23:48
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.

2 participants