diff --git a/app/graphql/types/flow_type.rb b/app/graphql/types/flow_type.rb index 6afaeee7..9e0bedd6 100644 --- a/app/graphql/types/flow_type.rb +++ b/app/graphql/types/flow_type.rb @@ -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' diff --git a/app/graphql/types/input/flow_input_type.rb b/app/graphql/types/input/flow_input_type.rb index 48750c1d..321f5cf9 100644 --- a/app/graphql/types/input/flow_input_type.rb +++ b/app/graphql/types/input/flow_input_type.rb @@ -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 diff --git a/app/models/flow.rb b/app/models/flow.rb index 7c451750..3871aec4 100644 --- a/app/models/flow.rb +++ b/app/models/flow.rb @@ -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) } @@ -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 diff --git a/app/services/namespaces/projects/flows/create_service.rb b/app/services/namespaces/projects/flows/create_service.rb index 838c9e94..b2470f6c 100644 --- a/app/services/namespaces/projects/flows/create_service.rb +++ b/app/services/namespaces/projects/flows/create_service.rb @@ -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 diff --git a/app/services/namespaces/projects/flows/update_service.rb b/app/services/namespaces/projects/flows/update_service.rb index 639b9b65..4ec3d656 100644 --- a/app/services/namespaces/projects/flows/update_service.rb +++ b/app/services/namespaces/projects/flows/update_service.rb @@ -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 diff --git a/db/migrate/20260629120000_remove_signature_from_flows.rb b/db/migrate/20260629120000_remove_signature_from_flows.rb new file mode 100644 index 00000000..28036220 --- /dev/null +++ b/db/migrate/20260629120000_remove_signature_from_flows.rb @@ -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 diff --git a/db/schema_migrations/20260629120000 b/db/schema_migrations/20260629120000 new file mode 100644 index 00000000..0e03ce5f --- /dev/null +++ b/db/schema_migrations/20260629120000 @@ -0,0 +1 @@ +68074a1fb7f8bdf3087c3b6823eaef35175c480f05d4bc73c190ef7b2811cf68 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 8ddde1a7..ece51e27 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -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 diff --git a/docs/graphql/input_object/flowinput.md b/docs/graphql/input_object/flowinput.md index 6c4809e5..c1774a17 100644 --- a/docs/graphql/input_object/flowinput.md +++ b/docs/graphql/input_object/flowinput.md @@ -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 | diff --git a/docs/graphql/object/flow.md b/docs/graphql/object/flow.md index d9491cc1..05128149 100644 --- a/docs/graphql/object/flow.md +++ b/docs/graphql/object/flow.md @@ -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 | diff --git a/spec/factories/flows.rb b/spec/factories/flows.rb index 9ddb18f0..71971eb9 100644 --- a/spec/factories/flows.rb +++ b/spec/factories/flows.rb @@ -9,7 +9,6 @@ validation_status { :unvalidated } starting_node { nil } flow_settings { [] } - signature { '(): undefined' } name { generate(:flow_name) } end end diff --git a/spec/models/flow_spec.rb b/spec/models/flow_spec.rb index c943dcf4..b8941970 100644 --- a/spec/models/flow_spec.rb +++ b/spec/models/flow_spec.rb @@ -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 @@ -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( @@ -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, diff --git a/spec/requests/graphql/mutation/namespace/projects/flows/create_mutation_spec.rb b/spec/requests/graphql/mutation/namespace/projects/flows/create_mutation_spec.rb index 45dec25b..7cd7dfbd 100644 --- a/spec/requests/graphql/mutation/namespace/projects/flows/create_mutation_spec.rb +++ b/spec/requests/graphql/mutation/namespace/projects/flows/create_mutation_spec.rb @@ -14,7 +14,6 @@ #{error_query} flow { id - signature startingNodeId nodes { count @@ -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) diff --git a/spec/requests/graphql/mutation/namespace/projects/flows/update_mutation_spec.rb b/spec/requests/graphql/mutation/namespace/projects/flows/update_mutation_spec.rb index b467eb1d..a9652f29 100644 --- a/spec/requests/graphql/mutation/namespace/projects/flows/update_mutation_spec.rb +++ b/spec/requests/graphql/mutation/namespace/projects/flows/update_mutation_spec.rb @@ -14,7 +14,6 @@ #{error_query} flow { id - signature startingNodeId nodes { count @@ -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: { @@ -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 diff --git a/spec/services/namespaces/projects/flows/create_service_spec.rb b/spec/services/namespaces/projects/flows/create_service_spec.rb index e827a1a8..4fc6b9bc 100644 --- a/spec/services/namespaces/projects/flows/create_service_spec.rb +++ b/spec/services/namespaces/projects/flows/create_service_spec.rb @@ -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( @@ -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( diff --git a/spec/services/namespaces/projects/flows/update_service_spec.rb b/spec/services/namespaces/projects/flows/update_service_spec.rb index 5cf7e45c..e9e43161 100644 --- a/spec/services/namespaces/projects/flows/update_service_spec.rb +++ b/spec/services/namespaces/projects/flows/update_service_spec.rb @@ -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(