wait: defer strict validation for value references to run time

Merged
IA
6h ago
+354-66

Summary

Build-time validation of wait steps rejected any with value that was not already a literal: a ${...} or $VAR reference in duration, until, url, status, state, poll_interval, or request_timeout failed before the DAG ever ran, even when the reference would have resolved to a valid value. This change defers strict checks for reference-carrying fields to run time, once references have resolved.

Changes

  • internal/runtime/builtin/wait/config.go: guard each strict check in parseConfig with a new isValueReference helper (IsWholeReference + HasValueReference, matching the decision/mail precedent), so both scoped references and bare ${NAME}/$NAME environment forms defer; Status is any-typed and parseStatus now returns the parsed int, owns the 200 default, accepts YAML numeric types and numeric strings, and defers references
  • internal/runtime/builtin/wait/wait.go: validateStep defers references, newExecutor keeps strict checks (values already resolved in node.go); waitHTTP compares against the parsed int
  • internal/cmn/schema/dag.schema.json: preserve the state enum via the repo's anyOf enum-or-reference idiom; document the status string/reference form alongside the integer union
  • specs/039-wait.md: document reference deferral for ${...} and $VAR forms in the behavior and validation sections
  • Tests: reference-deferral and literal-rejection tables plus parseStatus coverage in wait_test.go; conformance tests for a resolved wait.duration reference (exit 0) and a resolved numeric-string wait.http status (exit 0), alongside the existing resolved-bad-URL rejection test

Related Issues

Closes https://github.com/dagucloud/dagu/issues/3226

Checklist

  • Code follows the project style guidelines
  • Self-review of the code has been performed
  • Tests have been added or updated as needed
  • Documentation has been updated as needed
  • Changes have been tested locally

Validation: go vet and go test ./internal/spec/ ./internal/runtime/builtin/wait/ ./internal/executor/registry/ pass; conformance/spec039_wait passes against a binary built from this branch; schema tests pass when excluding TestDAGSchemaRepoCopyMatchesEmbeddedSchema/TestConfigSchemaRepoCopyMatchesEmbeddedSchema, which fail on Windows checkouts where the repo-copy schemas materialize as text stubs instead of symlinks (pre-existing). Branch rebased onto current upstream/main.