Skip to content

api: Add step samples, events, availability and selected-step runs - #4

Open
SCcagg5 wants to merge 14 commits into
stack/03-g3from
stack/04-g4
Open

SCcagg5 wants to merge 14 commits into
stack/03-g3from
stack/04-g4

Conversation

@SCcagg5

@SCcagg5 SCcagg5 commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Part of a stack of 31 pull requests that depend on each other. They must be reviewed and merged in order: each PR builds on the previous one and its diff only contains its own changes.

All PRs of the stack
# PR
1 specs: Add spec 083 and the samples store
2 ir: Add run state fields for ephemeral runs and reused outputs
3 runtime: Bound continuous steps and carry outputs of selected steps
4 api: Add step samples, events, availability and selected-step runs
5 test(ui): add YAML fixtures for the document model tests
6 ui(lib): add shared UI kit, status helpers and right-panel shell
7 ui(canvas): add canvas engine core, toolbars and editor helpers
8 ui(i18n): add workspace message catalogs, first batch
9 ui(canvas): add canvas Flow view, step run panel and workflow panel
10 ui(editor): add YAML document model, canvas model and run source logic
11 ui(editor): Add edit session, YAML format and quick fixes, run actions, tab strip
12 ui(editor): Add canvas graph model, Add step panel, issues popover, run bar
13 ui(canvas): Add layered layout, dependency edges, status styles, reference picker
14 ui(canvas): Add export, flow builder, upstream data panel, output capture
15 ui(canvas): Add node cards, launchers, inspector sections, client issues
16 ui(editor): Add visual editor, step inspector and YAML file panel
17 ui(lists): Open runs on the workflow page; add tab and schedule helpers
18 ui(workspace): Add workspace URL state, legacy redirects and run list links
19 ui(workspace): Add workspace data layer, run facts and Workflow panel
20 ui(workspace): Add run start controls, visible runs and reuse source
21 ui(workspace): Add data provider, bar identity, continuous panel and step list
22 ui(logs): Add run actions cluster, cached logs and log popout page
23 ui(workspace): Add Activity dock, step run view and workflow page
24 test(workspace): Add integration tests for the workspace shell and step view
25 ui(pages): Retire classic run pages and open runs on the workflow page
26 test(editor): Add integration tests for the editor, inspector and run overlay
27 test(ui): Add repository-wide guard tests and ESLint boundary rules
28 e2e: Add workspace helpers and fixtures, update existing specs
29 e2e: Add workspace specs, part 1 of 2
30 e2e: Add workspace specs, part 2 of 2
31 examples: Add the workspace demo workflows

Stack 4/31. Base branch: stack/03-g3. Review and merge in order; this PR builds on the previous one.
Size: 48 files changed, 10916 insertions(+), 1551 deletions(-).
Checked: Go build, vet and tests of the changed packages, on top of the previous PR.

Summary

This PR adds the intake, CLI and REST API for selected-step runs with carried outputs. It adds endpoints for step samples, events, availability and outputs. It adds editor endpoints for validation issues and reference scope. The OpenAPI file and the generated types are updated.

Why

PR 1 to PR 3 give the store, the state and the runtime. The UI PRs that follow need an API to read them and to start a run of chosen steps. This PR is the last backend step before the UI.

Changes

  • OpenAPI (api/v1/api.yaml, generated api/v1/api.gen.go, ui/src/api/v1/schema.ts)
    • New paths under /dag-runs/{name}/{dagRunId}/steps/{stepName}/: samples, events, availability, outputs.
    • New schemas: StepSamples, StepEvents, StepAvailability, StepOutputs, ReusedInput, ReusedOutputSource, ValidationIssue, ReferenceScope.
    • Start requests gain outputsFromRuns, outputsSources and ephemeral.
  • Intake (internal/intake/steps.go, seed.go)
    • SelectedStepNodes, LoadRunStepSources, CheckRunStepSources, CheckOutputSources, SelectionSkipsHandlers.
  • CLI (internal/cmd/start_steps.go, start.go, remote_commands.go): --output-from <step>=<run-id> replaces --output. The old flag gives a clear error.
  • Handlers (internal/service/frontend/api/v1)
    • step_samples.go, editor_step_outputs.go.
    • start_steps.go: validates outputsFromRuns and ephemeral, which needs steps. seeded_run.go and dagruns.go apply them.
    • editor_issues.go, editor_scope.go, editor_scope_steps.go: structured validation issues and the reference scope.
    • dags.go: spec validation returns a SHA-256. UpdateDAGSpec returns 409 when expectedSha256 differs.
  • Server: ephemeral_cleanup.go removes ended ephemeral runs after a TTL.
  • Docs: skills/dagu/references/cli.md, specs/021-mcp-read-tool.md.

How to review

  1. Read the diff of api/v1/api.yaml. Skip api.gen.go.
  2. Read internal/intake/steps.go.
  3. Read start_steps.go (API) and start_steps.go (CLI).
  4. Read step_samples.go, then the editor files.

Pay most attention to these places:

  • CheckRunStepSources: a step can only be reused from a finished run where it succeeded.
  • The optimistic lock on UpdateDAGSpec (409 on a stale hash).
  • ephemeral_cleanup.go: a run that has not ended must never be removed.

Tests

  • internal/service/frontend/api/v1: step_samples_test.go, start_steps_internal_test.go, editor_issues_test.go, editor_issues_api_test.go, editor_scope_test.go, editor_scope_steps_test.go, editor_scope_api_test.go, editor_step_outputs_test.go, dags_test.go.
  • internal/intake/steps_test.go, internal/cmd/start_test.go, remote_commands_test.go.
  • Conformance: spec013_step_run/ (ephemeral, from runs, handlers), spec083_continuous_runs/ (API, status and log), spec021_mcp_read_tool/read_run_test.go, conformance/cli/start_test.go.

Screenshots

No visible UI change in this PR.
The first UI PR that uses these endpoints comes after this one in the stack (PR 5 onward).

This was referenced Oct 28, 2026
SCcagg5 and others added 14 commits October 31, 2026 19:35
…agucloud#3383)

* Runtime: continuous runner bounds, outputs of selected step runs, synthetic data tool
* Satisfy linters in the continuous runner
* Fix continuous step reporting found in review
* Write synthetic runs like the runner does
* Align spec 013 wording with the code
* Fix continuous step counts and step finish order
* Record continuous step failures as they happen
Convert sample counts through a saturating helper instead of raw
uint64 to int64 casts, and name every run status in the conformance
wait loop, treating a rejected run as finished.
A start request with outputs now has to say which run each step's
outputs came from, so the integration test supplies outputsSources
alongside outputs.
These fixtures use sh syntax that PowerShell does not parse, and one
relies on sh rejecting an unresolved reference. Skip them on Windows
as the other shell-dependent tests in this package do.
Fix the wording of ReusedOutputSource, and say that the streak and
lastFailureAt of a step are approximate once the raw tier no longer
holds the last failure.
A bad events cursor gets 400, a window where every sample failed has
an availability of 0, a short outage has a length of 0 seconds, and a
stopped event carries no failed count. The conformance test reads
the tiers by the wall clock, gives CI more time, and checks the cursor.
Spec 083 states what it covers, its errors, and an example.
Two saves from the same read of a DAG could both pass the hash check
and the later one replace the earlier. A conditional update checks
the hash and writes under a lock that every process sharing the DAG
store takes. A failed re-read after a rejected spec is now returned
instead of the hash of an empty spec.
An empty default is a default; the scope dropped it like no default.
Tag builds with the run ID, which works with any date command, give
build an ID apart from its name so that the by-ID case resolves an
ID, and assert the exact message for an invalid run ID.
The help and the skill reference said every skipped step; only the
skipped steps that the selected steps depend on carry outputs.
outputsFromRuns accepted a run that never ran the step: a selected-steps
run records the steps it did not carry as skipped by retry with no
times, and those nodes passed as reusable. Only a node that succeeded
or carried outputs (it has a finish time) can now give its outputs, both
for the check and for reusedInputs.

outputs without outputsSources is accepted again, as in released
versions; such a step has no reusedInputs entry. dagu start --output
keeps working as a deprecated flag that points to --output-from. The API
descriptions, spec 013, and the CLI references say so.

A plain spec update takes the lock that a conditional update holds, so
it cannot land between the hash check and the write. When the lock
directory is unusable, it writes without the lock, since no conditional
update can take the lock there either.

The step outputs endpoint shows outputs that only reach the published
payload, as a reference resolves them, and shows the captured value of
an output variable, which differs from the output value with
output_schema.

The events endpoint rejects a cursor the store did not give, as spec
083 says. The samples and events endpoints document their 400 response.
Nothing can reference the outputs of a handler step, so the scope gives
a handler no outputs. It still copied the outputsKnown value of the
step, so a handler that only a run would reveal names for said
"runtime", and the editor then accepted references to it that the
server rejects. A handler entry now says its empty list is final.
A run seeded from another run, such as a selected-steps run with
outputsFromRunId or an ephemeral run, names the log files of the source
run for its skipped steps. Removing the seeded run deleted those files,
so the cleanup of an ephemeral run, ten minutes after it ended, took
the step logs of a run that stays in the history.

A run now removes only the step logs that lie in the log directory of
one of its own attempts. The logs that an attempt carries from an
earlier attempt of the same run still go with it.
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.

2 participants