Skip to content

fix: require DAG definition for enqueue#2084

Merged
yottahmd merged 2 commits intomainfrom
codex/fix-enqueue-missing-dag-arg
May 4, 2026
Merged

fix: require DAG definition for enqueue#2084
yottahmd merged 2 commits intomainfrom
codex/fix-enqueue-missing-dag-arg

Conversation

@yottahmd
Copy link
Copy Markdown
Collaborator

@yottahmd yottahmd commented May 4, 2026

Summary

  • require a DAG definition argument before running dagu enqueue
  • return Cobra's normal missing-argument error instead of panicking in DAG loading
  • add a regression test for invoking enqueue without a DAG file

Testing

  • go test ./internal/cmd -count=1

Closes #2082

Summary by CodeRabbit

  • Bug Fixes

    • The enqueue command now enforces stricter input validation, requiring users to provide a DAG definition argument at command invocation to prevent invalid command usage.
  • Tests

    • Added test coverage to verify the enqueue command properly validates and enforces that required arguments are supplied before execution.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 138d48c4-f17c-4101-aa5e-f66d58f2d661

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The enqueue command now enforces a minimum of one positional argument by setting Args: cobra.MinimumNArgs(1) in its Cobra configuration. A corresponding test verifies the command rejects empty argument lists with an appropriate error message, preventing the panic that previously occurred.

Changes

CLI Argument Validation

Layer / File(s) Summary
Argument Validation
internal/cmd/enqueue.go
Enqueue() command adds Args: cobra.MinimumNArgs(1) to require at least one positional argument (the DAG definition file).
Test Coverage
internal/cmd/enqueue_test.go
New test TestEnqueueCommand_RequiresDAGDefinition verifies the command returns an error with message containing "requires at least 1 arg" when called without arguments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: requiring a DAG definition argument for the enqueue command, which matches the core fix in the changeset.
Linked Issues check ✅ Passed The PR fully addresses issue #2082 by adding argument validation to prevent panics and including a regression test verifying proper error handling.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the enqueue command's missing-argument handling and adding a regression test, with no unrelated modifications.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-enqueue-missing-dag-arg

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.

@yottahmd yottahmd merged commit 4ff6c7e into main May 4, 2026
10 checks passed
@yottahmd yottahmd deleted the codex/fix-enqueue-missing-dag-arg branch May 4, 2026 14:39
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.

dagu enqueue shows go panic instead of proper error message when receiving no dag file.

1 participant