Skip to content

Fix #1451 - Resolve duration expressions; Improve wait DSL contract#1454

Merged
fjtirado merged 9 commits into
serverlessworkflow:mainfrom
ricardozanini:issue/1449
Jun 12, 2026
Merged

Fix #1451 - Resolve duration expressions; Improve wait DSL contract#1454
fjtirado merged 9 commits into
serverlessworkflow:mainfrom
ricardozanini:issue/1449

Conversation

@ricardozanini

@ricardozanini ricardozanini commented Jun 11, 2026

Copy link
Copy Markdown
Member

Fix #1451

Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Copilot AI review requested due to automatic review settings June 11, 2026 20:20
@ricardozanini ricardozanini requested a review from fjtirado as a code owner June 11, 2026 20:20
@ricardozanini ricardozanini changed the title Fix #1449 - Resolve duration expressions; Improve wait DSL contract Fix #1451 - Resolve duration expressions; Improve wait DSL contract Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes #1449 by making WaitExecutor correctly support inline, literal, and expression-based durations (with runtime evaluation for expressions) and by expanding the fluent DSLs (DSL + FuncDSL) with ergonomic wait* convenience methods.

Changes:

  • Updated WaitExecutor to parse/validate inline + literal durations at build time and evaluate duration expressions at runtime with clearer error messages.
  • Added waitSeconds/minutes/hours/days/millis and wait(Duration) convenience methods to fluent/spec DSL and experimental FuncDSL.
  • Added new unit/integration tests plus YAML workflow samples and accompanying design/plan docs.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
impl/core/src/main/java/io/serverlessworkflow/impl/executors/WaitExecutor.java Adds literal parsing + runtime evaluation for duration expressions; refactors wait duration handling.
impl/test/src/test/java/io/serverlessworkflow/impl/test/WaitExecutorTest.java Adds integration tests for wait durations (inline/literal/expression) and workflow status transitions.
impl/test/src/test/resources/workflows-samples/wait-expression-input.yaml New YAML sample: wait duration read from workflow input via expression.
impl/test/src/test/resources/workflows-samples/wait-expression-context.yaml New YAML sample: wait duration read from workflow context via expression.
fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/dsl/DSL.java Adds wait convenience methods (waitSeconds, waitMillis, wait(Duration), etc.).
fluent/spec/src/test/java/io/serverlessworkflow/fluent/spec/dsl/DSLWaitTest.java Adds unit tests validating the new DSL wait convenience methods.
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/FuncTaskItemListBuilder.java Adds wait(...) task builder methods needed by FuncDSL.
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/dsl/FuncDSL.java Adds FuncDSL wait support + convenience methods mirroring DSL.
experimental/fluent/func/src/test/java/io/serverlessworkflow/fluent/func/FuncDSLWaitTest.java Adds unit tests validating FuncDSL wait methods.
docs/superpowers/specs/2026-06-11-waittask-ergonomics-design.md Design spec documenting the intended WaitTask ergonomics and executor behavior.
docs/superpowers/plans/2026-06-11-waittask-ergonomics.md Implementation plan describing the step-by-step rollout and tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/executors/WaitExecutor.java Outdated
Comment thread impl/test/src/test/java/io/serverlessworkflow/impl/test/WaitExecutorTest.java Outdated
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Copilot AI review requested due to automatic review settings June 11, 2026 21:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Comment thread impl/test/src/test/java/io/serverlessworkflow/impl/test/WaitExecutorTest.java Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 11, 2026 23:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread impl/test/src/test/java/io/serverlessworkflow/impl/test/WaitExecutorTest.java Outdated
Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/executors/WaitExecutor.java Outdated
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
@fjtirado

fjtirado commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

@ricardozanini I have created PR ricardozanini#2 to resuse already existing parsing duration code and to reduce time spend by the test.

Reusing existing code to deal with TimeoutAfter and keep the test
execution fast

@fjtirado fjtirado left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comments incorporated into additional PR

Copilot AI review requested due to automatic review settings June 12, 2026 13:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

// ========== DurationInline Tests ==========

@Test
@Disabled("This one slow down")
long elapsed = System.currentTimeMillis() - startTime;

assertThat(model).isNotNull();
assertThat(elapsed).isGreaterThanOrEqualTo(200); // 1 second + 500 milliseconds
Comment on lines +134 to +138
.build();

long startTime = System.currentTimeMillis();
WorkflowModel model = appl.workflowDefinition(workflow).instance(Map.of()).start().join();
long elapsed = System.currentTimeMillis() - startTime;
@ricardozanini

Copy link
Copy Markdown
Member Author

@fjtirado AI let a few comments for you. The Disabled one we can ditch.

@fjtirado fjtirado merged commit eef3bed into serverlessworkflow:main Jun 12, 2026
3 checks passed
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.

Improve WaitTask DSL ergonomics and fix WaitExecutor duration literal bug

3 participants