Skip to content

feat: Implement FuncDoTaskBuilder to also cover raise and tryCatch#1322

Open
matheusandre1 wants to merge 3 commits intoserverlessworkflow:mainfrom
matheusandre1:feature/1304
Open

feat: Implement FuncDoTaskBuilder to also cover raise and tryCatch#1322
matheusandre1 wants to merge 3 commits intoserverlessworkflow:mainfrom
matheusandre1:feature/1304

Conversation

@matheusandre1
Copy link
Copy Markdown
Contributor

Many thanks for submitting your Pull Request ❤️!

What this PR does / why we need it: draft to Closes: #1304

Special notes for reviewers:

Additional information (if needed):

@matheusandre1
Copy link
Copy Markdown
Contributor Author

take a look, @domhanak....

@mcruzdev
Copy link
Copy Markdown
Collaborator

mcruzdev commented Apr 21, 2026

Hi @matheusandre1 is this ready for review?

@matheusandre1 matheusandre1 marked this pull request as ready for review April 21, 2026 04:01
@matheusandre1 matheusandre1 requested a review from fjtirado as a code owner April 21, 2026 04:01
Copilot AI review requested due to automatic review settings April 21, 2026 04:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the experimental FuncWorkflowBuilder / FuncDoTaskBuilder fluent API so function-based workflows can include raise() and tryCatch() tasks (per #1304), avoiding the need to fall back to JQ for these constructs.

Changes:

  • Add raise(...) and tryCatch(...) support to the func “do” fluent surface (FuncDoFluent, FuncDoTaskBuilder, FuncTaskItemListBuilder) and provide matching FuncDSL helpers.
  • Introduce FuncRaiseTaskBuilder and FuncTryTaskBuilder to build the corresponding spec task structures.
  • Add a JUnit test validating raise and try/catch compilation through FuncWorkflowBuilder.

Reviewed changes

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

Show a summary per file
File Description
experimental/fluent/func/src/test/java/io/serverlessworkflow/fluent/func/FuncDSLTest.java Adds coverage ensuring raise and tryCatch tasks are emitted correctly via FuncWorkflowBuilder.
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/spi/FuncDoFluent.java Extends the func “do” fluent interface to include raise and try/catch task fluent APIs.
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/dsl/FuncDSL.java Adds FuncDSL.raise(...) and FuncDSL.tryCatch(...) task configurer helpers.
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/FuncTryTaskBuilder.java New builder for try/catch tasks (try handler + catch handler + retry/errors/backoff helpers).
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/FuncTaskItemListBuilder.java Implements list-level raise and tryCatch task appenders.
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/FuncRaiseTaskBuilder.java New builder for raise tasks.
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/FuncDoTaskBuilder.java Wires raise and tryCatch through the workflow “do” builder to the underlying list builder.

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

Copy link
Copy Markdown
Collaborator

@mcruzdev mcruzdev left a comment

Choose a reason for hiding this comment

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

It looks great @matheusandre1, please, could you add a test that demostrate a workflow running? Inside src/test/java/io/serverlessworkflow/fluent/test?

@mcruzdev
Copy link
Copy Markdown
Collaborator

Why src/test/java/io/serverlessworkflow/fluent/test? I didn't understand

Where we are testing all the FuncDSL methods

Copilot AI review requested due to automatic review settings April 21, 2026 22:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 8 out of 8 changed files in this pull request and generated 2 comments.


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

@matheusandre1
Copy link
Copy Markdown
Contributor Author

matheusandre1 commented Apr 21, 2026

@mcruzdev , Ignore review copilot or can I do this refactor?

@matheusandre1 matheusandre1 marked this pull request as draft April 21, 2026 23:08
@mcruzdev
Copy link
Copy Markdown
Collaborator

@mcruzdev , Ignore review copilot or can I do this refactor?

I think it makes sense, we can have something like we have for FuncForkTaskBuilder having an AbstractForkTaskBuilder, TAL: #1302

@matheusandre1
Copy link
Copy Markdown
Contributor Author

I'm doing something similar, I'll send it shortly.

@fjtirado fjtirado marked this pull request as ready for review April 22, 2026 09:57
@fjtirado fjtirado marked this pull request as draft April 22, 2026 09:57
@fjtirado
Copy link
Copy Markdown
Collaborator

fjtirado commented Apr 22, 2026

@matheusandre1 Please note that #1332 has changed some assumptions that were wrongly done about how the generated workflow should look like.

Signed-off-by: Matheus Andre <matheusandr2@gmail.com>
Signed-off-by: Matheus André <matheusandr2@gmail.com>
Signed-off-by: Matheus André <matheusandr2@gmail.com>
@matheusandre1 matheusandre1 force-pushed the feature/1304 branch 2 times, most recently from 883eec8 to 2cf0431 Compare April 22, 2026 14:43
Signed-off-by: Matheus André <matheusandr2@gmail.com>
@fjtirado
Copy link
Copy Markdown
Collaborator

@matheusandre1 there are some errors, please take a look, I think they are related with the comment I made

@matheusandre1
Copy link
Copy Markdown
Contributor Author

Yes, I adjusted it now.

@fjtirado fjtirado marked this pull request as ready for review April 22, 2026 15:00
@fjtirado fjtirado requested review from Copilot and mcruzdev April 22, 2026 15:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

feat: Implement FuncDoTaskBuilder to also cover raise() and tryCatch()

4 participants