Skip to content

fix: allow multiple history status filters#2085

Merged
yottahmd merged 4 commits intomainfrom
codex/issue-2083-history-multi-status
May 4, 2026
Merged

fix: allow multiple history status filters#2085
yottahmd merged 4 commits intomainfrom
codex/issue-2083-history-multi-status

Conversation

@yottahmd
Copy link
Copy Markdown
Collaborator

@yottahmd yottahmd commented May 4, 2026

Summary

  • allow dagu history --status to accept comma-separated status filters
  • propagate multiple status values through remote history queries
  • update CLI help and add parser/query coverage

Testing

  • go test ./internal/cmd/...
  • go test ./internal/intg -run TestHistoryCommand -count=1
  • go test ./internal/persis/filedagrun/...

Closes #2083

Summary by CodeRabbit

  • New Features

    • The history command’s --status flag now accepts multiple comma-separated statuses for both local and remote queries; remote requests send repeated status parameters.
  • Bug Fixes

    • Validation tightened: empty, whitespace-only, or invalid statuses are rejected with clear errors; certain unsupported values are rejected for remote queries.
  • Tests

    • Added tests for multi-status parsing and remote query parameter handling; updated concurrency test to use filesystem-based coordination for robust scheduling checks.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2aab5e07-c25b-40f4-b9da-e17508d1a31f

📥 Commits

Reviewing files that changed from the base of the PR and between a61dc36 and f46f0e8.

📒 Files selected for processing (1)
  • internal/runtime/runner_test.go

📝 Walkthrough

Walkthrough

The dagu history --status flag now accepts a single status or a comma-separated list. Parsing, validation, local wiring, remote query shape, and tests were updated so multiple statuses are propagated and sent as repeated status query parameters for remote requests.

Changes

Multi-Status History Filtering

Layer / File(s) Summary
Flag & Documentation
internal/cmd/flags.go, internal/cmd/history.go
Updated --status usage/help and examples to indicate single or comma-separated statuses (e.g., running,queued).
Local Status Parsing
internal/cmd/history.go
Added parseStatuses to split comma-separated input, trim whitespace, ignore empty segments, validate via parseStatus, and error if no valid statuses. buildStatusOption now uses this and returns exec.WithStatuses(statuses).
Local Tests
internal/cmd/history_test.go
Added TestParseStatuses covering multi-status parsing, trimming/empty-segment behavior, and error cases (blank or invalid entries).
Remote Query Shape
internal/cmd/remote_client.go
remoteHistoryQuery replaces Status *int with Statuses []int.
Remote Status Parsing
internal/cmd/remote_commands.go
buildRemoteHistoryQuery now uses remoteStatusValues to parse comma-separated values into a slice. remoteStatusValues splits, trims, skips blanks, validates via remoteStatusValue (which rejects none for remote), and errors if none remain.
Remote Request Encoding
internal/cmd/remote_client.go
listDAGRuns builds url.Values and emits one status query parameter per status value. do now converts a map to url.Values and delegates to doWithQueryValues which encodes/appends the query string.
Remote Tests
internal/cmd/remote_commands_test.go
Added TestBuildRemoteHistoryQueryParsesMultipleStatuses (verifies parsing into query.Statuses) and TestRemoteClientListDAGRunsUsesRepeatedStatusParams (httptest server asserts repeated status query params like ["1","5"]).
sequenceDiagram
    participant CLI as CLI (dagu history)
    participant Parser as Parser (parseStatuses / remoteStatusValues)
    participant Client as RemoteClient
    participant Server as Remote API
    CLI->>Parser: read --status "running,queued"
    Parser-->>CLI: return [running, queued]
    CLI->>Client: build query with multiple statuses
    Client->>Client: encode repeated "status" params
    Client->>Server: GET /runs?status=running&status=queued
    Server-->>Client: 200 OK (runs list)
    Client-->>CLI: display filtered runs
Loading

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.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 'fix: allow multiple history status filters' accurately and concisely describes the main change—enabling the history command's --status flag to accept comma-separated values.
Linked Issues check ✅ Passed All coding requirements from issue #2083 are met: the --status flag now accepts comma-separated values, multiple statuses propagate through remote queries using repeated parameters, and parser/query tests validate the behavior.
Out of Scope Changes check ✅ Passed All changes are directly related to enabling multiple status filters in the history command. The concurrent execution test refactoring uses improved synchronization but remains focused on testing core runner functionality.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-2083-history-multi-status

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/cmd/remote_client.go`:
- Around line 169-175: The status handling currently serializes query.Statuses
into a single comma-separated string (using fmt.Sprintf and strings.Join into
params["status"]); instead, emit repeated query parameters so the request
becomes ?status=1&status=2. Replace the block that builds params["status"] to
iterate query.Statuses and call params.Add("status", fmt.Sprintf("%d", status))
for each entry (or, if params is not url.Values, change params to url.Values and
use Add) so multiple status values are sent as repeated parameters per the
OpenAPI explode:true declaration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6e2cbc37-71a1-44bd-b7c9-0d4c728a175d

📥 Commits

Reviewing files that changed from the base of the PR and between 4d26d43 and f76f24e.

📒 Files selected for processing (6)
  • internal/cmd/flags.go
  • internal/cmd/history.go
  • internal/cmd/history_test.go
  • internal/cmd/remote_client.go
  • internal/cmd/remote_commands.go
  • internal/cmd/remote_commands_test.go

Comment thread internal/cmd/remote_client.go
@yottahmd
Copy link
Copy Markdown
Collaborator Author

yottahmd commented May 4, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yottahmd
Copy link
Copy Markdown
Collaborator Author

yottahmd commented May 4, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yottahmd
Copy link
Copy Markdown
Collaborator Author

yottahmd commented May 4, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yottahmd yottahmd merged commit e425221 into main May 4, 2026
10 checks passed
@yottahmd yottahmd deleted the codex/issue-2083-history-multi-status branch May 4, 2026 16:11
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.

Allow the --status parameter for dagu history to accept multiple values

1 participant