Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/graphql/types/flow_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ class FlowType < Types::BaseObject
null: false,
method: :flow_settings,
description: 'The settings of the flow'
field :signature, String,
null: false,
description: 'The signature of the flow'
field :starting_node_id, Types::GlobalIdType[::NodeFunction],
null: true,
description: 'The ID of the starting node of the flow'
Expand Down
2 changes: 0 additions & 2 deletions app/graphql/types/input/flow_input_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class FlowInputType < Types::BaseInputObject

argument :type, Types::GlobalIdType[::FlowType], required: true,
description: 'The identifier of the flow type'

argument :signature, String, required: false, description: 'The signature of the flow'
end
end
end
4 changes: 1 addition & 3 deletions app/models/flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class Flow < ApplicationRecord
allow_blank: false,
uniqueness: { case_sensitive: false, scope: :project_id }

validates :signature, presence: true, length: { maximum: 500 }

scope :enabled, -> { where(disabled_reason: nil) }
scope :disabled, -> { where.not(disabled_reason: nil) }

Expand All @@ -61,7 +59,7 @@ def to_grpc
settings: flow_settings.map(&:to_grpc),
starting_node_id: starting_node&.id,
node_functions: node_functions.map(&:to_grpc),
signature: signature
signature: flow_type.signature
)
end

Expand Down
3 changes: 1 addition & 2 deletions app/services/namespaces/projects/flows/create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def execute
flow = Flow.new(
project: namespace_project,
name: flow_input.name,
flow_type: flow_type,
signature: flow_input.signature.presence || flow_type.signature
flow_type: flow_type
)

unless flow.save
Expand Down
1 change: 0 additions & 1 deletion app/services/namespaces/projects/flows/update_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def update_flow(t)

def update_flow_attributes
flow.name = flow_input.name
flow.signature = flow_input.signature if flow_input.signature.present?
flow.validation_status = :unvalidated
end

Expand Down
11 changes: 11 additions & 0 deletions db/migrate/20260629120000_remove_signature_from_flows.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

class RemoveSignatureFromFlows < Code0::ZeroTrack::Database::Migration[1.0]
def up
remove_column :flows, :signature
end

def down
add_column :flows, :signature, :text, null: false, default: '', limit: 500
end
end
1 change: 1 addition & 0 deletions db/schema_migrations/20260629120000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
68074a1fb7f8bdf3087c3b6823eaef35175c480f05d4bc73c190ef7b2811cf68
4 changes: 1 addition & 3 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,7 @@ CREATE TABLE flows (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
validation_status integer DEFAULT 0 NOT NULL,
disabled_reason integer,
signature text DEFAULT ''::text NOT NULL,
CONSTRAINT check_8c731c24ec CHECK ((char_length(signature) <= 500))
disabled_reason integer
);

CREATE SEQUENCE flows_id_seq
Expand Down
1 change: 0 additions & 1 deletion docs/graphql/input_object/flowinput.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ Input type for creating or updating a flow
| `name` | [`String!`](../scalar/string.md) | The name of the flow |
| `nodes` | [`[NodeFunctionInput!]!`](../input_object/nodefunctioninput.md) | The node functions of the flow |
| `settings` | [`[FlowSettingInput!]`](../input_object/flowsettinginput.md) | The settings of the flow |
| `signature` | [`String`](../scalar/string.md) | The signature of the flow |
| `startingNodeId` | [`NodeFunctionID`](../scalar/nodefunctionid.md) | The starting node of the flow |
| `type` | [`FlowTypeID!`](../scalar/flowtypeid.md) | The identifier of the flow type |
1 change: 0 additions & 1 deletion docs/graphql/object/flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Represents a flow
| `nodes` | [`NodeFunctionConnection!`](../object/nodefunctionconnection.md) | Nodes of the flow |
| `project` | [`NamespaceProject!`](../object/namespaceproject.md) | The project the flow belongs to |
| `settings` | [`FlowSettingConnection!`](../object/flowsettingconnection.md) | The settings of the flow |
| `signature` | [`String!`](../scalar/string.md) | The signature of the flow |
| `startingNodeId` | [`NodeFunctionID`](../scalar/nodefunctionid.md) | The ID of the starting node of the flow |
| `type` | [`FlowType!`](../object/flowtype.md) | The flow type of the flow |
| `updatedAt` | [`Time!`](../scalar/time.md) | Time when this Flow was last updated |
Expand Down
1 change: 0 additions & 1 deletion spec/factories/flows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
validation_status { :unvalidated }
starting_node { nil }
flow_settings { [] }
signature { '(): undefined' }
name { generate(:flow_name) }
end
end
12 changes: 6 additions & 6 deletions spec/models/flow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@

it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_uniqueness_of(:name).case_insensitive.scoped_to(:project_id) }

it { is_expected.to validate_presence_of(:signature) }
it { is_expected.to validate_length_of(:signature).is_at_most(500) }
end

describe 'scopes' do
Expand All @@ -46,8 +43,11 @@
let(:flow) do
create(
:flow,
flow_type: create(:flow_type, identifier: 'HTTP'),
signature: '(input: REST_ADAPTER_INPUT): HTTP_RESPONSE',
flow_type: create(
:flow_type,
identifier: 'HTTP',
signature: '(input: REST_ADAPTER_INPUT): HTTP_RESPONSE'
),
disabled_reason: 0,
flow_settings: [
create(
Expand Down Expand Up @@ -100,7 +100,7 @@
project_id: flow.project.id,
project_slug: flow.project.slug,
type: flow.flow_type.identifier,
signature: flow.signature,
signature: flow.flow_type.signature,
node_functions: [
{
database_id: starting_node.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#{error_query}
flow {
id
signature
startingNodeId
nodes {
count
Expand Down Expand Up @@ -180,12 +179,9 @@
graphql_data_at(:namespaces_projects_flows_create, :flow)
).to match a_graphql_entity_for(
flow,
:signature,
starting_node_id: flow.starting_node.to_global_id.to_s
)

expect(flow.signature).to eq(flow_type.signature)

expect(graphql_data_at(:namespaces_projects_flows_create, :flow, :settings).size).to eq(1)

nodes = graphql_data_at(:namespaces_projects_flows_create, :flow, :nodes, :nodes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#{error_query}
flow {
id
signature
startingNodeId
nodes {
count
Expand Down Expand Up @@ -92,7 +91,6 @@
flowInput: {
name: generate(:flow_name),
type: flow_type.to_global_id.to_s,
signature: 'updated_signature',
startingNodeId: 'gid://sagittarius/NodeFunction/1000',
settings: {
value: {
Expand Down Expand Up @@ -185,12 +183,9 @@
graphql_data_at(:namespaces_projects_flows_update, :flow)
).to match a_graphql_entity_for(
flow,
:signature,
starting_node_id: flow.starting_node.to_global_id.to_s
)

expect(flow.signature).to eq(input[:flowInput][:signature])

expect(graphql_data_at(:namespaces_projects_flows_update, :flow, :settings).size).to eq(1)
expect(
graphql_data_at(:namespaces_projects_flows_update, :flow, :settings, :nodes).first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
let(:namespace_project) { create(:namespace_project, primary_runtime: runtime) }

let(:flow_input) do
Struct.new(:settings, :type, :signature, :starting_node_id, :nodes, :name, keyword_init: true).new(
Struct.new(:settings, :type, :starting_node_id, :nodes, :name, keyword_init: true).new(
settings: [],
type: create(:flow_type, runtime: runtime).to_global_id,
signature: nil,
starting_node_id: 'gid://sagittarius/NodeFunction/12345',
nodes: [
Struct.new(:id, :function_definition_id, :next_node_id, :parameters).new(
Expand Down Expand Up @@ -54,10 +53,9 @@
context 'when starting node is nil' do
let(:current_user) { create(:user) }
let(:flow_input) do
Struct.new(:settings, :type, :signature, :starting_node_id, :nodes, :name, keyword_init: true).new(
Struct.new(:settings, :type, :starting_node_id, :nodes, :name, keyword_init: true).new(
settings: [],
type: create(:flow_type, runtime: runtime).to_global_id,
signature: nil,
starting_node_id: nil,
nodes: [
Struct.new(:id, :function_definition_id, :next_node_id, :parameters).new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
end
let(:flow) { create(:flow, project: namespace_project, flow_type: create(:flow_type, runtime: runtime)) }
let(:flow_input) do
Struct.new(:settings, :signature, :starting_node_id, :nodes, :name, keyword_init: true).new(
Struct.new(:settings, :starting_node_id, :nodes, :name, keyword_init: true).new(
settings: [],
signature: '(input: STRING): NUMBER',
starting_node_id: starting_node.to_global_id,
nodes: [
Struct.new(:id, :function_definition_id, :next_node_id, :parameters).new(
Expand Down