Repository navigation
Check real child DAGs and add dagu test flags - #4083
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
df9399f to
6a47a74
Compare
1e52d7e to
1c7a822
Compare
6a47a74 to
83c9a19
Compare
1c7a822 to
23ff070
Compare
23ff070 to
369db37
Compare
|
@coderabbitai review |
Action performed
|
A real dag.run step, a real parallel step, or a real handler starts its child in the case, and the child takes no mocks, so a source of the fail-closed rule in it must make the case invalid before anything runs. CheckRealChildren resolves each such child as an in-process child run loads it and reports its sources under the step's label, and reports a child that is named by a reference or does not resolve. It replaces the check that made every such case invalid, so a real child of side-effect-free steps now runs in the case.
--run selects cases by an RE2 expression on their names, and a test file error is still reported. --format json writes one JSON object once every case has ended, so CI can read the outcome of each case. --keep keeps each case directory and reports its path, so an author can read a case's logs and redirect files. The format check is shared with dagu dry.
Spec 101's status and the CLI skill reference now list --run, --format, and --keep, and llms.txt is regenerated. The reference also says that a real step's child runs in the case and is checked by the fail-closed rule, in place of the note that such a case is invalid. Spec 101 also states the error failure: a run that cannot reach a terminal status, such as one with a wait a test cannot settle, fails with it, so the JSON report's field and its actual value are written down.
369db37 to
631638a
Compare
Summary
#4082 added
dagu testwith the text report, and made a case with a real step that starts a child run invalid, since it did not check the child yet. This finishes T12 of #4029. The child DAG of a real step is checked by the fail-closed rule, so a real child of side-effect-free steps runs and one with an unhandled source makes the case invalid. It also adds the three flags Spec 101 defines for CI and debugging:--format json,--run, and--keep.Changes
dag.runstep, a realparallelstep, or a real handler resolves its child DAG before the case runs, as an in-process child run loads it. Each source of the fail-closed rule in the child is listed asstep <step>, child <DAG>, <source>. A child named by a reference, or one that does not resolve, makes the case invalid.--format json(-f) writes one JSON object to stdout once every case has ended.casesholdsfile,name,result,duration_ms,failuresorerrors, andcase_dir.invalid_filesappears when a file is invalid. Nothing else goes to stdout.--run <regexp>runs only the cases whose name the RE2 expression matches. A case it does not select is not reported, and a test file error still is.--keepkeeps each case directory and reports its absolute path: acase directory <path>line in text,case_dirin JSON.--runor--formatexits with status 2.errorfailure: a run that cannot reach a terminal status, such as one with a wait a test cannot settle, fails with"field": "error"and the reason asactual.--formatcheck is shared withdagu dry:dryOutputFormatis renamedoutputFormatParam.Before:
dagu test --format json ...fails withunknown flag: --format, and a case with a realdag.runstep is invalid. After:Core change
CheckRealChildrenwalks the steps and handlers that a case runs for real and start a child run. It checks each resolved child with the fail-closed checker, as a case with a real step and no mocks, and reports its sources under the parent step's label, with the fix "mock<step>instead". The command passes a resolver that loads a document of the parent's file, or the DAG the repository finds, without base-config handlers and with everyparams[].evaldeferred. The report keeps its counts and either writes text as each case ends or, with--format json, collects the cases and encodes them once inwriteSummary.internal/dagtest/realchild.go:19internal/cmd/test.go:262internal/cmd/test_report_json.go:51Testing
TestCheckRealChildren: child sources under the parent's label, a child named by a reference, a child that does not resolve, a real handler's child, and no check fordag.enqueue.TestWorkflowTests/parent.test.yaml(criterion 32): a real child of side-effect-free steps runs and skips its 60-second repeat interval, and a real child with arunstep makes the case invalid without running it.TestWorkflowTestJSON: one JSON object, the failure objects of a failed case with numericattempts, the errors of an invalid case withoutduration_ms, andinvalid_files.TestWorkflowTestJSONTimeout: atimeoutfailure carries the limit in milliseconds.TestWorkflowTestRun: selection by name, no match (exit 0, zero cases), and a file error still reported.TestWorkflowTestKeep: in text and JSON, the reported absolute path holds the mocked step's redirect file withFAIL, as Spec 101's "Side Effects That Stay Off" example states.TestWorkflowTestArgumentsgains an invalid--runand an unknown--format.-run TestWorkflowTest, by nameTestCheckRealChildren,TestCheckFailClosed,TestSchemaAccepts, andgofmt -landgo veton the touched packages. The rest runs in CI.Performance
No performance risk: this touches no server request, tick, or SSE path. The child check loads each real child DAG once per case before the case runs.
--format jsonholds one small object per case in memory until the end.--keepleaves each case directory, one run's records and logs, for the user to remove.Compatibility
CLI only: three new flags on
dagu test, and real child runs now run in a case instead of making it invalid.dagu dry --formatkeeps its behavior and error text.Exported identifiers
For maintainer approval:
dagtest.CheckRealChildren, which the command calls. The resolver is a plain function parameter, with no named type.Out of scope
The JSON fields that T17 adds:
fix,file_fix,default_mocked,auto_approved, andnotifications, and the failure fields for outputs, streams, and notifications.Agent
Claude Code, claude-opus-5-5, xhigh