Add specification example workflows as Storybook stories #164
Add specification example workflows as Storybook stories #164cheryl7114 wants to merge 14 commits into
Conversation
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
sync branch
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
✅ Deploy Preview for swf-editor ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Storybook “Examples” and “Use Cases” collections to showcase Serverless Workflow DSL patterns in the diagram editor.
Changes:
- Added multiple workflow YAML files under
stories/examples/workflowsandstories/use-cases/workflows - Added Storybook stories + MDX overview pages to browse/render these workflows in
DiagramEditor - Updated Storybook preview parameters (backgrounds + story sorting) and stories README
Reviewed changes
Copilot reviewed 47 out of 47 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/multi-agent-ai-content-generation.yaml | New use-case workflow demonstrating multi-step AI content generation/refinement |
| packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-github-issues.yaml | New use-case workflow for GitHub issue triage/review/close automation |
| packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml | New use-case workflow for EV station events and session lifecycle |
| packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/automated-data-backup.yaml | New use-case workflow for DB backup and upload |
| packages/serverless-workflow-diagram-editor/stories/use-cases/index.ts | Re-exports use-case workflow YAML content for Storybook |
| packages/serverless-workflow-diagram-editor/stories/use-cases/UseCases.stories.tsx | Storybook stories rendering each use-case workflow in DiagramEditor |
| packages/serverless-workflow-diagram-editor/stories/use-cases/Overview.mdx | Use-cases documentation/overview page |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/wait-duration-inline.yaml | New example workflow for inline wait duration |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/try-catch-then.yaml | New example workflow for try/catch and conditional continuation |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/try-catch-retry-reusable.yaml | New example workflow for reusable retry policy |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/switch-then-string.yaml | New example workflow for switch with string then targets |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/star-wars-homeworld.yaml | New example workflow calling SWAPI and chaining results |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/set.yaml | New example workflow for basic set usage |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/schedule-event-driven.yaml | New example workflow for event-driven schedule |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/schedule-cron.yaml | New example workflow for cron schedule |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/run-subflow.yaml | New example workflow for running a sub-workflow |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/run-shell-stdin-and-arguments.yaml | New example workflow for running shell with stdin/args |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/run-script-with-stdin-and-arguments.yaml | New example workflow for running script with stdin/args/env |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/run-return-all.yaml | New example workflow for returning all container output |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/run-container-stdin-and-arguments.yaml | New example workflow for running container with stdin/args |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/raise-reusable.yaml | New example workflow demonstrating reusable error definitions |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/mock-service-extension.yaml | New example workflow demonstrating a mock call extension |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/listen-to-one.yaml | New example workflow for listening to a single event |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/listen-to-any-forever-foreach.yaml | New example workflow for listen-any + foreach loop |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/listen-to-all.yaml | New example workflow for listening to all correlated events |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/fork.yaml | New example workflow showing fork with competing branches |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/for.yaml | New example workflow demonstrating for iteration |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/emit.yaml | New example workflow emitting an event |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/do-single.yaml | New example workflow with a single do task |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/do-multiple.yaml | New example workflow with multiple do tasks |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/conditional-task.yaml | New example workflow for conditional task execution |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/call-openapi.yaml | New example workflow calling an OpenAPI operation |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/call-mcp.yaml | New example workflow calling MCP tooling over stdio |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/call-http-query-headers-expressions.yaml | New example workflow for HTTP query/headers via expressions |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/call-grpc.yaml | New example workflow calling gRPC method |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/call-custom-function-inline.yaml | New example workflow defining and calling an inline function |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/call-custom-function-cataloged.yaml | New example workflow calling a cataloged function definition |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/call-asyncapi-subscribe-consume-forever-foreach.yaml | New example workflow subscribing/consuming AsyncAPI messages |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/call-asyncapi-publish.yaml | New example workflow publishing AsyncAPI messages |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/authentication-reusable.yaml | New example workflow with reusable auth configuration |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/authentication-oauth2.yaml | New example workflow for OAuth2 authentication configuration |
| packages/serverless-workflow-diagram-editor/stories/examples/workflows/accumulate-room-readings.yaml | New example workflow accumulating readings with correlation |
| packages/serverless-workflow-diagram-editor/stories/examples/index.ts | Re-exports example workflow YAML content for Storybook |
| packages/serverless-workflow-diagram-editor/stories/examples/Overview.mdx | Examples documentation/overview page |
| packages/serverless-workflow-diagram-editor/stories/examples/Examples.stories.tsx | Storybook stories rendering each example workflow in DiagramEditor |
| packages/serverless-workflow-diagram-editor/stories/README.md | Updates stories directory documentation to mention examples |
| packages/serverless-workflow-diagram-editor/.storybook/preview.tsx | Updates Storybook preview parameters (backgrounds + story ordering) |
Comments suppressed due to low confidence (11)
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/multi-agent-ai-content-generation.yaml:1
- The workflow references
.refined_text/.refined_imageduring reevaluation, but the precedingrefineText/refineImagetasks don’t export these fields into context. As written, reevaluation will use missing/incorrect data anddeliverContentwill still emit the original.text/.image. Export the refined outputs into context (and update.text/.imageif those are the canonical fields) before callingreevaluate/deliverContent.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1 .eventis initialized from$workflow.input[0].data, but the subsequent switch conditions expect.event.type. If.typeis on the envelope (commonly$workflow.input[0].type) this will never match. Additionally,handleStationEventsusesthen: raiseUnsupportedEventErrorafter the switch, which can cause the unsupported-event error path to run even after a successful match (depending on DSL semantics). Consider storing the full event (including type) in.eventand handling unsupported events via adefaultswitch case rather than an unconditionalthen.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1- The fault event type string in the switch condition (
com.ev-power-supplier.charging.station-faulted.v1) does not match the scheduled event type (com.ev-power-supplier.charging-station.faulted.v1). This mismatch will prevent thestationErrorbranch from ever being selected. Update the condition to use the same type value as the schedule.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1 - The fault event type string in the switch condition (
com.ev-power-supplier.charging.station-faulted.v1) does not match the scheduled event type (com.ev-power-supplier.charging-station.faulted.v1). This mismatch will prevent thestationErrorbranch from ever being selected. Update the condition to use the same type value as the schedule.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1 - Correct spelling improves clarity and consistency: rename
tryAquireSlottotryAcquireSlot, andfeedBacktofeedback(orprovideFeedback).
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1 - Correct spelling improves clarity and consistency: rename
tryAquireSlottotryAcquireSlot, andfeedBacktofeedback(orprovideFeedback).
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1 - Correct spelling improves clarity and consistency: rename
tryAquireSlottotryAcquireSlot, andfeedBacktofeedback(orprovideFeedback).
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/automated-data-backup.yaml:1 - The shell command references environment variables with underscores (
$SQLSERVER_HOST,$SQLSERVER_USER,$SQLSERVER_PASSWORD,$DATABASE_NAME), but the workflow defines different variable names (SQLSERVERHOST,SQLSERVERUSER,SQLSERVERPASSWORD,DATABASENAME). This will lead to empty/unset variables at runtime. Also, the backup file name/path is inconsistent (/var/backup/db.bakvs/backup/YourDatabase.bak). Align the environment variable names used in the command with those defined inenvironment, and ensure the produced backup path matches whatreadBackupFilereads.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/automated-data-backup.yaml:1 - The shell command references environment variables with underscores (
$SQLSERVER_HOST,$SQLSERVER_USER,$SQLSERVER_PASSWORD,$DATABASE_NAME), but the workflow defines different variable names (SQLSERVERHOST,SQLSERVERUSER,SQLSERVERPASSWORD,DATABASENAME). This will lead to empty/unset variables at runtime. Also, the backup file name/path is inconsistent (/var/backup/db.bakvs/backup/YourDatabase.bak). Align the environment variable names used in the command with those defined inenvironment, and ensure the produced backup path matches whatreadBackupFilereads.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/automated-data-backup.yaml:1 - This example commits plaintext credentials (SQL password) and a bearer token into the repository. Even for Storybook samples, this is risky because it encourages copy/paste of secrets and may be flagged by secret scanners. Replace these with obvious placeholders (e.g.,
REPLACE_ME) or expression-based references to secrets/environment variables.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/automated-data-backup.yaml:1 - This example commits plaintext credentials (SQL password) and a bearer token into the repository. Even for Storybook samples, this is risky because it encourages copy/paste of secrets and may be flagged by secret scanners. Replace these with obvious placeholders (e.g.,
REPLACE_ME) or expression-based references to secrets/environment variables.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
|
|
||
| - **`introduction/`** - Introductory documentation and welcome pages | ||
| - **`features/`** - Component features and interactive stories | ||
| - **`examples/`** - Serverless workflow specification example workflows |
There was a problem hiding this comment.
Reads slightly: better Serverless workflow specification example workflows > Serverless workflow specification examples
There was a problem hiding this comment.
@lornakelly did you mean Serverless workflow specification examples > Serverless workflow specification example workflows?
|
Thanks for the PR @cheryl7114, great work! Just added a few comments |
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 48 out of 49 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (8)
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/automated-data-backup.yaml:1
- The backup flow is internally inconsistent, so it’s likely to fail at runtime: (1) the command references
$SQLSERVER_HOST/$SQLSERVER_USER/$SQLSERVER_PASSWORD/$DATABASE_NAME, but the environment definesSQLSERVERHOST/SQLSERVERUSER/SQLSERVERPASSWORD/DATABASENAME(different names); (2) the backup is written to/var/backup/db.bakbut the mounted volume appears to map to/backup, and the next step reads/backup/YourDatabase.bak(different path and filename). Align the environment variable names and ensure the backup is written to and read from the same mounted path/filename.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/automated-data-backup.yaml:1 - This workflow includes a hard-coded bearer token. Even for Storybook sample content, committing secrets (or secret-looking tokens) is risky because they tend to get copied into real configs; prefer placeholders (e.g.,
${ $secrets.MINIO_TOKEN },${ .token }, or a clearly fake sentinel likeREPLACE_ME) and document where the value should come from.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1 - The
handleStationEventstask will always transition toraiseUnsupportedEventErrorbecausethen:is set on the switch task itself. Also, the fault event type string in the switch (com.ev-power-supplier.charging.station-faulted.v1) does not match the scheduled type (com.ev-power-supplier.charging-station.faulted.v1). Move unsupported handling into adefaultswitch case (or otherwise ensure only unsupported events raise), and make the event type constants consistent.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1 - The
handleStationEventstask will always transition toraiseUnsupportedEventErrorbecausethen:is set on the switch task itself. Also, the fault event type string in the switch (com.ev-power-supplier.charging.station-faulted.v1) does not match the scheduled type (com.ev-power-supplier.charging-station.faulted.v1). Move unsupported handling into adefaultswitch case (or otherwise ensure only unsupported events raise), and make the event type constants consistent.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-github-issues.yaml:1 - These
set: issue:blocks overwrite the entireissueobject with only the listed fields, which will discard previously captured properties (e.g.,number,repository,author) that are later referenced (like$context.issue.repository.organization). Update the assignments to merge into the existing issue object rather than replacing it (e.g., by creating a new object based on the existing$context.issueand only changingassignedTo/status/...).
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-github-issues.yaml:1 - These
set: issue:blocks overwrite the entireissueobject with only the listed fields, which will discard previously captured properties (e.g.,number,repository,author) that are later referenced (like$context.issue.repository.organization). Update the assignments to merge into the existing issue object rather than replacing it (e.g., by creating a new object based on the existing$context.issueand only changingassignedTo/status/...).
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/multi-agent-ai-content-generation.yaml:1 reevaluatereferences.refined_textand.refined_image, but the precedingrefineText/refineImagetasks don’t export those fields into the context in this workflow. As written, the reevaluation step won’t have the refined content available; export/assign the refined outputs fromrefineText/refineImageinto the context (or changereevaluateto use the correct output paths provided by those calls).
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1- Correct the typo in the task name
tryAquireSlot(should betryAcquireSlot) to avoid propagating misspellings into diagrams and references.
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 48 out of 49 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (8)
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/automated-data-backup.yaml:1
- The container command references environment variables with underscores (
$SQLSERVER_HOST,$DATABASE_NAME, etc.), but theenvironment:keys are defined without underscores (SQLSERVERHOST,DATABASENAME, etc.), so the backup command won’t receive the expected values. Also, the backup writes to/var/backup/db.bakbut the next step reads/backup/YourDatabase.bak, so the pipeline can’t find the output file; align env var names and the produced/consumed backup file path/name across steps.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/automated-data-backup.yaml:1 - The container command references environment variables with underscores (
$SQLSERVER_HOST,$DATABASE_NAME, etc.), but theenvironment:keys are defined without underscores (SQLSERVERHOST,DATABASENAME, etc.), so the backup command won’t receive the expected values. Also, the backup writes to/var/backup/db.bakbut the next step reads/backup/YourDatabase.bak, so the pipeline can’t find the output file; align env var names and the produced/consumed backup file path/name across steps.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/automated-data-backup.yaml:1 - This workflow hardcodes credentials (SQL password) and a bearer token in-repo. Even as Storybook examples, these patterns are easy to cargo-cult into production; replace with clearly fake placeholders (e.g.,
REPLACE_ME) or reference runtime-provided secrets/inputs so secret scanners and users don’t treat them as real credentials.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/automated-data-backup.yaml:1 - This workflow hardcodes credentials (SQL password) and a bearer token in-repo. Even as Storybook examples, these patterns are easy to cargo-cult into production; replace with clearly fake placeholders (e.g.,
REPLACE_ME) or reference runtime-provided secrets/inputs so secret scanners and users don’t treat them as real credentials.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1 initializestores only$workflow.input[0].datainto.event, but the subsequent conditions read.event.type, which won’t exist if.eventis just the CloudEventdatapayload. Additionally, thestationErrortype string doesn’t match the scheduled event (charging-station.faulted.v1vscharging.station-faulted.v1). Finally, placingthen: raiseUnsupportedEventErroron the switch means the workflow will proceed toraiseUnsupportedEventErroreven after a matched branch; use adefaultbranch inside theswitchinstead.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1initializestores only$workflow.input[0].datainto.event, but the subsequent conditions read.event.type, which won’t exist if.eventis just the CloudEventdatapayload. Additionally, thestationErrortype string doesn’t match the scheduled event (charging-station.faulted.v1vscharging.station-faulted.v1). Finally, placingthen: raiseUnsupportedEventErroron the switch means the workflow will proceed toraiseUnsupportedEventErroreven after a matched branch; use adefaultbranch inside theswitchinstead.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/managing-ev-charging-stations.yaml:1- Typo in task name:
tryAquireSlotshould betryAcquireSlotfor correct spelling and readability.
packages/serverless-workflow-diagram-editor/stories/use-cases/workflows/multi-agent-ai-content-generation.yaml:1 reevaluatereferences.refined_textand.refined_image, but neitherrefineTextnorrefineImageexports those fields (or updates.text/.image). As written, reevaluation will run with missing inputs; export the refined outputs from each refinement task into context (either overwrite.text/.imageor set.refined_text/.refined_image) and keep the reevaluate body consistent with that choice.
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Closes #89
Summary
This PR adds the following collapsible sections to Storybook:
These sections showcase example workflows and use cases from the Serverless Workflow Specification.