Skip to content

fix(cmd): preserve spaced dash params#2276

Merged
yohamta0 merged 3 commits into
dagucloud:mainfrom
mmlngl:main
Jun 10, 2026
Merged

fix(cmd): preserve spaced dash params#2276
yohamta0 merged 3 commits into
dagucloud:mainfrom
mmlngl:main

Conversation

@mmlngl

@mmlngl mmlngl commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Allows for params after "--" to contain space char.

Changes

  • Arg parsing
  • Tests

Related Issues

Closes #2275

Checklist

  • Code follows the project style guidelines
  • Self-review of the code has been performed
  • Tests have been added or updated as needed
  • Documentation has been updated as needed
  • Changes have been tested locally

Summary by cubic

Preserves spaces in params passed after -- in dagu start, and lets a single JSON arg pass through unchanged. Prevents splitting values like "Something here" and keeps JSON objects/arrays valid.

  • Bug Fixes
    • Use quoteStartDashArgs when building DashArgs and spec.WithParams to quote spaced values but skip quoting for a single JSON arg.
    • Set the params string from joined dash args for correct display.
    • Add tests for spaced param after -- and for a single JSON param after --.

Written for commit 4c08842. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of runtime parameters passed after the -- separator. Arguments containing spaces are now correctly preserved as single values and properly mapped to their target parameters.
  • Tests

    • Added test coverage for validating correct parsing of spaced parameters passed after the -- separator.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR fixes parameter parsing when quoted strings with spaces are passed after the -- separator in dagu start. The command handler and validation layer now apply spec.QuoteRuntimeParams to preserve quoted arguments as single parameter values instead of splitting on whitespace.

Changes

Parameter quoting for dash-separated arguments

Layer / File(s) Summary
Core parameter quoting in command handler
internal/cmd/start.go
loadDAGWithParams extracts post--- arguments, quotes them via spec.QuoteRuntimeParams, and passes quoted parameters to spec.WithParams instead of raw dash-args slice.
Parameter validation input quoting
internal/cmd/params_validation.go
Adds import of internal/core/spec and updates buildStartValidationInput to wrap dash arguments with spec.QuoteRuntimeParams when constructing validation input.
Test fixture and case for spaced parameters
internal/cmd/start_test.go
Adds dagStartWithSingleParam DAG fixture that echoes a single positional parameter, and StartDAGWithSpacedParamAfterDash test case that verifies spaced arguments after -- parse as one value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% 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
Title check ✅ Passed The title clearly and concisely describes the main change: preserving spaces in dash parameters during command parsing.
Linked Issues check ✅ Passed The code changes implement the required fix: using spec.QuoteRuntimeParams to preserve spaces in dash-separated parameters and adding test coverage for the fix.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing issue #2275: parameter parsing, dash argument handling, and corresponding test coverage with no unrelated modifications.
Description check ✅ Passed The pull request description includes all required sections from the template: Summary, Changes, Related Issues, and Checklist with items marked complete. The description clearly explains the purpose and provides context.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@yohamta0

Copy link
Copy Markdown
Collaborator

Looking great! Thanks a lot for fixing the bug.
I'll make a few minor adjustments and then merge it.

@yohamta0 yohamta0 merged commit 0ce603e into dagucloud:main Jun 10, 2026
11 checks passed
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.

bug: string params with spaces after -- are split incorrectly

2 participants