add removed at to flow type settings#954
Conversation
GitLab Pipeline ActionGeneral informationLink to pipeline: https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2512792580 Status: Passed Job summariesrspec: [cloud]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14292447336/artifacts/tmp/coverage/index.html rspec: [ee]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14292447335/artifacts/tmp/coverage/index.html rspec: [ce]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14292447334/artifacts/tmp/coverage/index.html docs:previewDocumentation preview available at https://code0-tech.gitlab.io/-/development/telescopium/-/jobs/14292458283/artifacts/out/index.html rubocop777 files inspected, no offenses detected |
There was a problem hiding this comment.
Pull request overview
Adds soft-deletion support (removed_at) to FlowTypeSetting so settings can be retired without immediate deletion (avoiding dangling FlowSetting references), aligning with existing “removed_at” patterns used for other runtime-defined entities.
Changes:
- Add
removed_atcolumn via migration + update DB structure tracking. - Update runtime flow type update logic to soft-remove missing settings and restore existing ones; add
active/removedscopes and useactivesettings when updating flows. - Expose
removedAtvia GraphQL and update documentation/tests accordingly.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/requests/grpc/sagittarius/flow_type_service_spec.rb | Asserts flow type settings are soft-removed instead of deleted during runtime updates. |
| spec/models/flow_type_setting_spec.rb | Adds coverage for active and removed scopes. |
| spec/graphql/types/flow_type_setting_spec.rb | Verifies GraphQL type includes the new removedAt field. |
| docs/graphql/object/flowtypesetting.md | Documents the new removedAt field. |
| db/structure.sql | Reflects new removed_at column on flow_type_settings. |
| db/schema_migrations/20260504131123 | Adds migration checksum entry. |
| db/migrate/20260504131123_add_removed_at_to_flow_type_settings.rb | Migration adding removed_at to flow_type_settings. |
| app/services/runtimes/grpc/flow_types/update_service.rb | Changes flow type settings update behavior to soft-remove missing settings and upsert by identifier. |
| app/services/namespaces/projects/flows/update_service.rb | Uses only active flow type settings when mapping positional flow inputs. |
| app/models/flow_type_setting.rb | Adds active / removed scopes. |
| app/graphql/types/flow_type_setting_type.rb | Exposes removedAt on the GraphQL object type. |
Comments suppressed due to low confidence (1)
app/services/namespaces/projects/flows/update_service.rb:62
- Flow settings are applied positionally from
flow_input.settings, but the mapping to identifiers depends onflow_type_settings.active.order(:id). With soft-deleted settings and identifier-based upserts,idordering may not match the runtime setting order (especially when inserting new settings), which can assign values to the wrongflow_setting_id. Consider ordering by a persisted position/index that reflects the runtime order.
db_settings = flow.flow_settings.first(flow_input.settings.length)
flow_type_settings = flow.flow_type.flow_type_settings.active.order(:id)
flow_input.settings.each_with_index do |setting, index|
db_settings[index] ||= flow.flow_settings.build
db_settings[index].flow_setting_id = flow_type_settings[index]&.identifier
db_settings[index].object = setting.value
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Niklas van Schrick <mc.taucher2003@gmail.com> Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
Resolves: #812