Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@yottahmd
Copy link
Collaborator

Resolves #1352

Copilot AI review requested due to automatic review settings October 23, 2025 14:32
Copy link
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 adds support for shell-like parameter expansion, enabling substring slicing (${VAR:offset:length}) and default value fallbacks (${VAR:-default}) in DAG environment variables and parameters. The implementation leverages the mvdan.cc/sh/v3 library for proper shell-style expansion, replacing the previous os.Expand approach with more sophisticated parsing that handles complex parameter transformations.

Key changes include:

  • Integration of mvdan.cc/sh/v3 library for shell-compatible parameter expansion
  • Support for substring operations and default values in parameters, environment variables, and step outputs
  • Refactored parameter evaluation logic to centralize expansion through evalParamValue function

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/integration/env_test.go Adds integration tests for substring expansion, default values, and step output slicing
internal/core/spec/params.go Refactors parameter parsing to use new evalParamValue function; removes dag parameter from parseParams
internal/core/spec/builder_test.go Adds unit tests for substring, default fallback, and NoEval mode
internal/common/cmdutil/eval_test.go Adds test cases for substring expansion in variables and step references
internal/common/cmdutil/eval.go Implements shell expansion via expandWithShell, adds step reference slicing, and parsing logic
go.mod Adds dependency on mvdan.cc/sh/v3 v3.12.0
docs/writing-workflows/parameters.md Documents substring slicing and parameter chaining examples
docs/reference/changelog.md Documents new feature in v1.24.0 unreleased version

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@cloudflare-workers-and-pages
Copy link

Deploying dagu-doc with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4ba8341
Status: ✅  Deploy successful!
Preview URL: https://b80dec09.dagu-doc.pages.dev
Branch Preview URL: https://env-parse-issue.dagu-doc.pages.dev

View logs

@yottahmd yottahmd merged commit e368a7f into main Oct 23, 2025
5 checks passed
@yottahmd yottahmd deleted the env-parse-issue branch October 23, 2025 14:58
@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 71.10092% with 63 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.54%. Comparing base (98d795b) to head (4ba8341).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/common/cmdutil/eval.go 73.54% 33 Missing and 17 partials ⚠️
internal/core/spec/params.go 55.17% 9 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1354      +/-   ##
==========================================
- Coverage   60.62%   60.54%   -0.08%     
==========================================
  Files         165      165              
  Lines       23772    23832      +60     
==========================================
+ Hits        14411    14429      +18     
- Misses       8227     8261      +34     
- Partials     1134     1142       +8     
Files with missing lines Coverage Δ
internal/core/spec/params.go 71.05% <55.17%> (-0.85%) ⬇️
internal/common/cmdutil/eval.go 82.11% <73.54%> (-4.28%) ⬇️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98d795b...4ba8341. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Support Parameter Expansion

2 participants