Skip to content

support sub flows#980

Open
raphael-goetz wants to merge 8 commits into
mainfrom
#931-support-sub-flows
Open

support sub flows#980
raphael-goetz wants to merge 8 commits into
mainfrom
#931-support-sub-flows

Conversation

@raphael-goetz
Copy link
Copy Markdown
Member

Resolves: #931

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

GitLab Pipeline Action

General information

Link to pipeline: https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2549035058

Status: Passed
Duration: 6 minutes

Job summaries

rspec: [cloud]

Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14519395676/artifacts/tmp/coverage/index.html
Test summary available at https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2549035058/test_report
Finished in 25.83 seconds (files took 13.99 seconds to load)
1476 examples, 0 failures
Line Coverage: 92.7% (5051 / 5449)
[TEST PROF INFO] Time spent in factories: 00:15.895 (46.61% of total time)

rspec: [ee]

Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14519395675/artifacts/tmp/coverage/index.html
Test summary available at https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2549035058/test_report
Finished in 22.88 seconds (files took 9.42 seconds to load)
1440 examples, 0 failures
Line Coverage: 92.91% (4898 / 5272)
[TEST PROF INFO] Time spent in factories: 00:13.847 (48.11% of total time)

rspec: [ce]

Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14519395674/artifacts/tmp/coverage/index.html
Test summary available at https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2549035058/test_report
Finished in 23.87 seconds (files took 12.01 seconds to load)
1390 examples, 0 failures
Line Coverage: 92.41% (4722 / 5110)
[TEST PROF INFO] Time spent in factories: 00:14.438 (46.82% of total time)

docs:preview

Documentation preview available at https://code0-tech.gitlab.io/-/development/telescopium/-/jobs/14519403951/artifacts/out/index.html

rubocop

841 files inspected, no offenses detected

@raphael-goetz raphael-goetz marked this pull request as ready for review May 21, 2026 19:17
Copilot AI review requested due to automatic review settings May 21, 2026 19:17
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 replaces the old “function value” (NodeFunctionIdWrapper / node_functions.value_of_node_parameter) mechanism with a first-class SubFlow model that can be used as a node-parameter value, and wires it through GraphQL, persistence, and gRPC serialization. It also adds an optional cast field to flow settings and node parameters.

Changes:

  • Introduces SubFlow + SubFlowSetting models, tables, factories, and specs; updates NodeParameter to use sub_flow instead of function_value.
  • Updates Flow create/update GraphQL inputs and response unions to accept/return subFlow values (and removes NodeFunctionIdWrapper).
  • Adds cast to flow_settings and node_parameters (GraphQL + persistence + gRPC), plus docs updates.

Reviewed changes

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

Show a summary per file
File Description
spec/requests/graphql/mutation/namespace/projects/flows/update_mutation_spec.rb Updates mutation spec to send/expect subFlow parameter values
spec/requests/graphql/mutation/namespace/projects/flows/create_mutation_spec.rb Updates mutation spec to send/expect subFlow parameter values
spec/models/sub_flow_spec.rb New model spec for SubFlow associations/validation
spec/models/sub_flow_setting_spec.rb New model spec for SubFlowSetting associations/validation
spec/models/node_parameter_spec.rb Replaces function_value expectations with sub_flow
spec/models/node_function_spec.rb Removes value_of_node_parameter association expectations
spec/factories/sub_flows.rb Adds factory for SubFlow
spec/factories/sub_flow_settings.rb Adds factory for SubFlowSetting
spec/factories/node_parameters.rb Removes function_value factory attribute
spec/factories/node_functions.rb Removes value_of_node_parameter factory attribute
docs/graphql/union/nodeparametervalue.md Documents FlowSubFlow as a possible union type
docs/graphql/object/nodeparameter.md Documents new cast field on NodeParameter
docs/graphql/object/nodefunctionidwrapper.md Removes docs for deprecated NodeFunctionIdWrapper
docs/graphql/object/flowsubflowsetting.md Adds docs for FlowSubFlowSetting
docs/graphql/object/flowsubflow.md Adds docs for FlowSubFlow
docs/graphql/object/flowsetting.md Documents new cast field on FlowSetting
docs/graphql/input_object/nodeparametervalueinput.md Replaces nodeFunctionId with subFlow input
docs/graphql/input_object/nodeparameterinput.md Documents new cast input
docs/graphql/input_object/flowsubflowsettinginput.md Adds docs for FlowSubFlowSettingInput
docs/graphql/input_object/flowsubflowinput.md Adds docs for FlowSubFlowInput
docs/graphql/input_object/flowsettinginput.md Documents new cast input on FlowSettingInput
docs/graphql/enum/errorcodeenum.md Removes FUNCTION_VALUE_NOT_FOUND from documented error codes
db/structure.sql Reflects schema changes: new tables + cast columns + removed FK/index
db/schema_migrations/20260520120000 Adds checksum entry for the new migration
db/migrate/20260520120000_add_tucana_shared_flow_sub_flows.rb Adds cast columns, creates sub_flow tables, removes old reference
app/services/namespaces/projects/flows/update_service.rb Implements cast handling and subFlow update/clear logic
app/services/error_code.rb Removes obsolete function_value_not_found error code
app/models/sub_flow.rb New SubFlow model with gRPC conversion + validation
app/models/sub_flow_setting.rb New SubFlowSetting model with gRPC conversion
app/models/node_parameter.rb Switches from function_value to sub_flow; adds cast to gRPC
app/models/node_function.rb Removes value_of_node_parameter association
app/models/flow_setting.rb Adds cast to gRPC serialization
app/graphql/types/node_parameter_value_type.rb Updates union to include FlowSubFlow and resolve SubFlow
app/graphql/types/node_parameter_type.rb Adds cast field; returns sub_flow as the parameter value
app/graphql/types/node_function_id_wrapper_type.rb Removes deprecated GraphQL type
app/graphql/types/input/node_parameter_value_input_type.rb Replaces nodeFunctionId with subFlow; updates one-of validation
app/graphql/types/input/node_parameter_input_type.rb Adds cast input
app/graphql/types/input/flow_sub_flow_setting_input_type.rb Adds input type for sub-flow settings
app/graphql/types/input/flow_sub_flow_input_type.rb Adds input type for sub-flow values
app/graphql/types/input/flow_setting_input_type.rb Adds cast input for flow settings
app/graphql/types/flow_sub_flow_type.rb Adds GraphQL object type for FlowSubFlow
app/graphql/types/flow_sub_flow_setting_type.rb Adds GraphQL object type for FlowSubFlowSetting
app/graphql/types/flow_setting_type.rb Adds cast field to FlowSetting GraphQL type

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

Comment thread app/services/namespaces/projects/flows/update_service.rb Outdated
Comment thread app/services/namespaces/projects/flows/update_service.rb Outdated
Comment thread db/migrate/20260520120000_add_tucana_shared_flow_sub_flows.rb
Comment thread db/migrate/20260520120000_add_tucana_shared_flow_sub_flows.rb
Comment thread app/graphql/types/input/flow_sub_flow_setting_input_type.rb
Comment thread app/graphql/types/input/flow_sub_flow_setting_input_type.rb
Comment thread app/graphql/types/input/flow_sub_flow_setting_input_type.rb
Comment thread app/graphql/types/input/flow_sub_flow_input_type.rb
Comment thread app/models/node_parameter.rb Outdated
Comment thread db/migrate/20260520120000_add_tucana_shared_flow_sub_flows.rb Outdated
Comment thread db/migrate/20260520120000_add_tucana_shared_flow_sub_flows.rb
Comment thread db/migrate/20260520120000_add_tucana_shared_flow_sub_flows.rb Outdated
Comment thread db/migrate/20260520120000_add_tucana_shared_flow_sub_flows.rb Outdated
Comment thread db/migrate/20260520120000_add_tucana_shared_flow_sub_flows.rb
raphael-goetz and others added 4 commits May 24, 2026 10:24
Co-authored-by: Niklas van Schrick <mc.taucher2003@gmail.com>
Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
Co-authored-by: Niklas van Schrick <mc.taucher2003@gmail.com>
Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
Co-authored-by: Niklas van Schrick <mc.taucher2003@gmail.com>
Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
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 43 out of 43 changed files in this pull request and generated 2 comments.

Comment thread app/services/namespaces/projects/flows/update_service.rb Outdated
Comment on lines +4 to +8
factory :sub_flow do
node_parameter
starting_node factory: :node_function
function_definition { nil }
signature { '(): VOID' }
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
class FlowSubFlowType < Types::BaseObject
description 'Represents a sub-flow parameter value.'

field :function_identifier, String,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While the input type should take the function_identifier, this should provide the resolved FunctionDefinition.

def to_grpc
Tucana::Shared::SubFlowSetting.new(
identifier: identifier,
default_value: default_value.nil? ? nil : Tucana::Shared::Value.from_ruby(default_value),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure if that is important for you on the runtime side, but Tucana::Shared::Value.from_ruby(nil) creates a proper NULL_VALUE while using nil is basically that the field is not set.


sub_flow = node_parameter.sub_flow || node_parameter.build_sub_flow
sub_flow.assign_attributes(
starting_node_id: starting_node_id,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would expect that you don't need the persistence of new nodes if you assign the starting_node instead of the starting_node_id

foreign_key: { to_table: :node_parameters, on_delete: :cascade }
t.references :starting_node, null: true, foreign_key: { to_table: :node_functions, on_delete: :restrict }
t.references :function_definition, null: true, foreign_key: { on_delete: :restrict }
t.text :signature, null: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Forgot this one, it should also have a limit

Suggested change
t.text :signature, null: false
t.text :signature, null: false, limit: 500

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.

Replacing NodeFunctionIdWrapper with SubFlow

3 participants