Skip to content

Conversation

@michael-0acf4
Copy link
Contributor

@michael-0acf4 michael-0acf4 commented Oct 7, 2024

Support for child workflows.

Solves MET-689 and MET-668.

Migration notes

Previously

    sub = SubstantialRuntime(backend)
    hello = sub.deno(file="workflow.ts", name="sayHello", deps=[])

    g.expose(
      # each function start, stop, result, ... holds a copy of the workflow data
       start_hello = hello.start(...),
       stop_hello = hello.stop()
    )

This approach relied on workflow files being referenced in each materializer, but the constructs were too restrictive to support something like mutation { results(name: "nameManuallyGiven") }.

We now have instead

    file = (
       WorkflowFile
           .deno(file="workflow.ts", deps=[])
           .import_(["sayHello"])
           .build()
    )

    # workflow data are refered only once
    sub = SubstantialRuntime(backend, [file])
    g.expose(
      start_hello = sub.start(...).reduce({ "name": "sayHello" }),
      stop = sub.stop()
    )
  • The change comes with new or modified tests
  • Hard-to-understand functions have explanatory comments
  • End-user documentation is updated to reflect the change

@codecov
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 86.23188% with 57 lines in your changes missing coverage. Please review.

Project coverage is 77.09%. Comparing base (defae4c) to head (d7f5461).

Files with missing lines Patch % Lines
src/typegate/src/runtimes/substantial/agent.ts 67.54% 37 Missing ⚠️
src/typegate/src/runtimes/substantial.ts 87.50% 18 Missing ⚠️
tests/runtimes/substantial/common.ts 98.34% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #867      +/-   ##
==========================================
+ Coverage   77.01%   77.09%   +0.07%     
==========================================
  Files         149      149              
  Lines       17867    18129     +262     
  Branches     1737     1756      +19     
==========================================
+ Hits        13761    13976     +215     
- Misses       4083     4130      +47     
  Partials       23       23              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@michael-0acf4 michael-0acf4 changed the title feat(subs): child workflow feat(subs): child workflows Oct 10, 2024
@michael-0acf4 michael-0acf4 marked this pull request as ready for review October 11, 2024 17:35
Yohe-Am
Yohe-Am previously approved these changes Oct 14, 2024
@michael-0acf4 michael-0acf4 changed the title feat(subs): child workflows feat(subs): child workflows + docs Oct 14, 2024
@michael-0acf4 michael-0acf4 force-pushed the child-workflow branch 4 times, most recently from 687f759 to 1554d7c Compare October 16, 2024 11:46
@michael-0acf4 michael-0acf4 requested a review from Yohe-Am October 16, 2024 17:19
@michael-0acf4 michael-0acf4 merged commit 1a2b58d into main Oct 18, 2024
11 of 12 checks passed
@michael-0acf4 michael-0acf4 deleted the child-workflow branch October 18, 2024 10:42
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.

3 participants