Skip to content

fix: refresh structured output examples#2055

Merged
yottahmd merged 3 commits intomainfrom
output-structured-examples
Apr 29, 2026
Merged

fix: refresh structured output examples#2055
yottahmd merged 3 commits intomainfrom
output-structured-examples

Conversation

@yottahmd
Copy link
Copy Markdown
Collaborator

@yottahmd yottahmd commented Apr 29, 2026

Summary

  • refresh the built-in DAG examples to use publish-only object-form output: for synthetic values instead of shelling out with echo
  • add a real JSON parsing example that shows decode: json and select: as a lightweight runtime contract for step output
  • update the bundled Dagu skill references to explain string-form vs object-form output and the failure behavior for malformed decoded output

Why

  • examples should model the current structured output feature directly instead of preserving old shell-based workarounds for fixed values
  • the bundled skill is user-facing guidance, so it needs to describe the actual two-mode output: behavior and the retry-relevant failure semantics
  • a concrete built-in example makes it easier for users to discover that decode: json plus select: can validate command output structure at runtime

Validation

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

Summary by CodeRabbit

  • Documentation
    • Clarified two output modes: string-form for flat variables and object-form for structured, step-scoped outputs (with decode/select); emphasized stdout is a log file path; added examples for JSON/YAML field extraction and validation.
    • Updated example DAGs and routing examples to use structured output references and explicit success/failure routing.
  • Bug Fix
    • Ignore temporary/atomic-write files when listing persisted JSON files.
  • Tests
    • Added unit test verifying temp files are excluded from persisted file lists.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 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: 822994f8-d333-4a31-a903-95585f95d720

📥 Commits

Reviewing files that changed from the base of the PR and between 009e570 and cdd241c.

📒 Files selected for processing (2)
  • internal/persis/filedistributed/helpers.go
  • internal/persis/filedistributed/helpers_test.go
✅ Files skipped from review due to trivial changes (1)
  • internal/persis/filedistributed/helpers.go

📝 Walkthrough

Walkthrough

Example DAGs and documentation were changed to separate string-form outputs (flat stdout variables) from object-form, publish-only outputs (structured ${step_id.output.*} with decode/select), updated example usages, and clarified ${step_id.stdout} as a log file path. One internal helper and its test were tweaked to ignore temp files.

Changes

Cohort / File(s) Summary
Example DAGs
internal/cmd/example.go
Refactored example DAG strings: replaced scalar output: VAR with object-form publish-only outputs (${step_id.output.<field>}), switched HTTP step capture to JSON decode + select, updated conditional routing to use object status and on_success/on_failure targets, and adjusted downstream references.
Core skill docs
skills/dagu/SKILL.md
Documented two distinct output: modes: string-form (output: VAR_NAME) for small stdout captured as flat variables and object-form for structured ${step_id.output.*} values; added `decode: json
Reference docs
skills/dagu/references/codingagent.md, skills/dagu/references/steptypes.md
Clarified three access patterns (string-form, object-form, ${step_id.stdout}), propagation semantics for type: dag/template, and added object-form examples.
File-distributed persistence
internal/persis/filedistributed/helpers.go, internal/persis/filedistributed/helpers_test.go
sortedFiles now filters to *.json files to ignore atomic-write temp files; added unit test verifying temp files (*.tmp.*) and non-file entries are excluded.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 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 'fix: refresh structured output examples' directly and clearly summarizes the main change—updating built-in DAG examples to use the structured output feature with publish-only object-form output.
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.

✏️ 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 output-structured-examples

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 `@skills/dagu/SKILL.md`:
- Around line 91-94: The publish step currently reads outputs via
${inspect_build.output.*} but does not declare an explicit dependency, which can
mislead DAG execution order; update the publish step (id: publish) to include
depends: [inspect_build] so it explicitly depends on the inspect_build step that
produces those outputs, ensuring correct execution ordering in type: graph DAGs
and preventing race conditions.
🪄 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: 7b01de33-2cda-445f-8860-25a938c779ae

📥 Commits

Reviewing files that changed from the base of the PR and between 44cfcf3 and e4e1e32.

📒 Files selected for processing (4)
  • internal/cmd/example.go
  • skills/dagu/SKILL.md
  • skills/dagu/references/codingagent.md
  • skills/dagu/references/steptypes.md

Comment thread skills/dagu/SKILL.md
@yottahmd
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 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

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 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 1ca702a into main Apr 29, 2026
10 checks passed
@yottahmd yottahmd deleted the output-structured-examples branch April 29, 2026 12:43
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.

1 participant