From 56b3925584320c4406b7cb961fbe19ff9f9c41d4 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 10 May 2022 18:08:27 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop_todo.yml | 5 - .rubocop_todo/rails/squished_sql_heredocs.yml | 217 ++++++++++++++++++ GITALY_SERVER_VERSION | 2 +- .../base.rb | 35 +++ .../on_direct_membership_finder.rb | 28 +-- .../on_transfer_finder.rb | 17 ++ app/graphql/mutations/award_emojis/base.rb | 6 - app/graphql/mutations/base_mutation.rb | 1 - app/graphql/mutations/boards/update.rb | 3 - app/graphql/mutations/ci/job/base.rb | 3 - app/graphql/mutations/ci/pipeline/base.rb | 3 - app/graphql/mutations/ci/runner/delete.rb | 4 - app/graphql/mutations/ci/runner/update.rb | 4 - .../mutations/clusters/agent_tokens/create.rb | 3 - .../mutations/clusters/agent_tokens/revoke.rb | 3 - .../mutations/clusters/agents/delete.rb | 3 - .../container_repositories/destroy_base.rb | 3 - .../customer_relations/contacts/create.rb | 2 +- .../mutations/design_management/move.rb | 3 - .../mutations/discussions/toggle_resolve.rb | 3 - .../environments/canary_ingress/update.rb | 2 - .../mutations/merge_requests/set_labels.rb | 3 - .../metrics/dashboard/annotations/create.rb | 11 +- app/graphql/mutations/notes/base.rb | 3 - app/graphql/mutations/notes/create/base.rb | 3 - app/graphql/mutations/notes/create/note.rb | 7 +- app/graphql/mutations/packages/destroy.rb | 3 - .../mutations/packages/destroy_file.rb | 3 - .../mutations/release_asset_links/delete.rb | 4 - .../mutations/release_asset_links/update.rb | 4 - app/graphql/mutations/saved_replies/base.rb | 4 - app/graphql/mutations/timelogs/delete.rb | 2 - app/graphql/mutations/todos/base.rb | 3 - app/graphql/mutations/todos/create.rb | 3 +- app/graphql/mutations/todos/mark_all_done.rb | 2 +- app/graphql/mutations/todos/restore_many.rb | 3 - app/graphql/mutations/work_items/create.rb | 3 - .../mutations/work_items/create_from_task.rb | 2 - app/graphql/mutations/work_items/delete.rb | 2 - app/graphql/mutations/work_items/update.rb | 2 - .../http_integrations_resolver.rb | 3 +- app/graphql/resolvers/base_resolver.rb | 1 - app/graphql/resolvers/boards_resolver.rb | 3 - .../resolvers/concerns/resolves_ids.rb | 5 +- .../resolvers/concerns/resolves_snippets.rb | 2 +- .../design_at_version_resolver.rb | 3 - .../design_management/design_resolver.rb | 4 - .../design_management/designs_resolver.rb | 27 +-- .../version/design_at_version_resolver.rb | 5 - .../version/designs_at_version_resolver.rb | 3 - .../version_in_collection_resolver.rb | 4 - .../design_management/version_resolver.rb | 4 - .../design_management/versions_resolver.rb | 3 - .../sentry_detailed_error_resolver.rb | 4 - .../sentry_error_stack_trace_resolver.rb | 4 - .../resolvers/package_details_resolver.rb | 3 - app/graphql/resolvers/snippets_resolver.rb | 6 +- app/graphql/resolvers/timelog_resolver.rb | 6 +- .../user_merge_requests_resolver_base.rb | 3 - app/graphql/resolvers/work_item_resolver.rb | 3 - app/graphql/subscriptions/issuable_updated.rb | 4 - app/graphql/types/ci/pipeline_type.rb | 1 - app/graphql/types/query_type.rb | 16 +- .../work_items/convert_task_input_type.rb | 4 - .../project_access_changed_service.rb | 2 + app/services/groups/transfer_service.rb | 13 +- ...measure_service_ping_metric_collection.yml | 2 +- doc/.vale/gitlab/VersionText.yml | 2 +- doc/administration/job_logs.md | 2 +- doc/api/plan_limits.md | 4 +- doc/development/fe_guide/style/html.md | 6 +- doc/development/service_ping/index.md | 81 +++++-- doc/install/installation.md | 2 +- doc/user/admin_area/index.md | 2 +- doc/user/packages/maven_repository/index.md | 2 +- doc/user/project/members/index.md | 4 +- doc/user/ssh.md | 8 +- lib/api/admin/plan_limits.rb | 1 + lib/api/entities/plan_limit.rb | 1 + .../on_transfer_finder_spec.rb | 59 +++++ spec/graphql/mutations/boards/update_spec.rb | 8 - .../mutations/ci/runner/delete_spec.rb | 8 - .../mutations/ci/runner/update_spec.rb | 8 - .../clusters/agent_tokens/create_spec.rb | 8 - .../clusters/agent_tokens/revoke_spec.rb | 10 - .../mutations/clusters/agents/delete_spec.rb | 9 - .../container_repositories/destroy_spec.rb | 6 - .../discussions/toggle_resolve_spec.rb | 11 - .../canary_ingress/update_spec.rb | 8 - .../release_asset_links/delete_spec.rb | 8 - .../release_asset_links/update_spec.rb | 8 - spec/graphql/mutations/todos/create_spec.rb | 15 +- .../graphql/mutations/todos/mark_done_spec.rb | 9 - .../mutations/todos/restore_many_spec.rb | 7 - spec/graphql/mutations/todos/restore_spec.rb | 9 - .../resolvers/concerns/resolves_ids_spec.rb | 5 +- .../design_management/design_resolver_spec.rb | 9 - .../version_in_collection_resolver_spec.rb | 9 - .../sentry_detailed_error_resolver_spec.rb | 8 - .../package_pipelines_resolver_spec.rb | 12 +- .../projects/snippets_resolver_spec.rb | 6 - .../resolvers/snippets_resolver_spec.rb | 22 -- .../resolvers/users/snippets_resolver_spec.rb | 10 - .../subscriptions/issuable_updated_spec.rb | 8 - .../types/current_user_todos_type_spec.rb | 22 +- spec/graphql/types/duration_type_spec.rb | 5 - spec/lib/api/entities/plan_limit_spec.rb | 3 +- spec/requests/api/admin/plan_limits_spec.rb | 12 +- spec/requests/api/graphql/users_spec.rb | 2 +- spec/services/groups/transfer_service_spec.rb | 2 +- spec/support/helpers/graphql_helpers.rb | 6 +- ...nd_project_boards_query_shared_examples.rb | 8 +- .../api/graphql/noteable_shared_examples.rb | 2 +- .../helpers/graphql_helpers_spec.rb | 8 +- spec/tooling/danger/specs_spec.rb | 5 +- tooling/danger/specs.rb | 2 +- 116 files changed, 505 insertions(+), 522 deletions(-) create mode 100644 .rubocop_todo/rails/squished_sql_heredocs.yml create mode 100644 app/finders/groups/projects_requiring_authorizations_refresh/base.rb create mode 100644 app/finders/groups/projects_requiring_authorizations_refresh/on_transfer_finder.rb create mode 100644 spec/finders/groups/projects_requiring_authorizations_refresh/on_transfer_finder_spec.rb diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 53b59d09df9..d0e08e04927 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -152,11 +152,6 @@ Rails/NegateInclude: Rails/RakeEnvironment: Enabled: false -# Offense count: 278 -# Cop supports --auto-correct. -Rails/SquishedSQLHeredocs: - Enabled: false - # Offense count: 44 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. diff --git a/.rubocop_todo/rails/squished_sql_heredocs.yml b/.rubocop_todo/rails/squished_sql_heredocs.yml new file mode 100644 index 00000000000..dc71b7b32ce --- /dev/null +++ b/.rubocop_todo/rails/squished_sql_heredocs.yml @@ -0,0 +1,217 @@ +--- +# Cop supports --auto-correct. +Rails/SquishedSQLHeredocs: + # Offense count: 356 + # Temporarily disabled due to too many offenses + Enabled: false + Exclude: + - 'app/finders/members_finder.rb' + - 'app/models/analytics/cycle_analytics/stage_event_hash.rb' + - 'app/models/ci/resource_group.rb' + - 'app/models/clusters/clusters_hierarchy.rb' + - 'app/models/concerns/analytics/cycle_analytics/stage_event_model.rb' + - 'app/models/concerns/has_environment_scope.rb' + - 'app/models/customer_relations/contact.rb' + - 'app/models/customer_relations/organization.rb' + - 'app/models/deployment.rb' + - 'app/models/issue/metrics.rb' + - 'app/models/merge_request/metrics.rb' + - 'app/models/namespace/traversal_hierarchy.rb' + - 'app/models/namespaces/traversal/linear.rb' + - 'app/models/project.rb' + - 'app/models/user.rb' + - 'app/services/issuable/destroy_label_links_service.rb' + - 'app/services/issues/relative_position_rebalancing_service.rb' + - 'app/services/projects/fetch_statistics_increment_service.rb' + - 'app/services/todos/destroy/destroyed_issuable_service.rb' + - 'app/workers/users/deactivate_dormant_users_worker.rb' + - 'db/migrate/20210323155010_populate_dismissal_information_for_vulnerabilities.rb' + - 'db/migrate/20210601080039_group_protected_environments_add_index_and_constraint.rb' + - 'db/migrate/20210611100359_rebuild_index_for_cadence_iterations_automation.rb' + - 'db/migrate/20210617022324_create_incident_management_pending_alert_escalations.rb' + - 'db/migrate/20210621043337_rename_services_to_integrations.rb' + - 'db/migrate/20210621044000_rename_services_indexes_to_integrations.rb' + - 'db/migrate/20210706152139_add_index_type_to_postgres_indexes_view.rb' + - 'db/migrate/20210719145532_add_foreign_keys_view.rb' + - 'db/migrate/20210721135638_add_triggers_to_integrations_type_new.rb' + - 'db/migrate/20210721174453_remove_schedule_and_status_null_constraints_from_pending_escalations_alert.rb' + - 'db/migrate/20210722150102_operations_feature_flags_correct_flexible_rollout_values.rb' + - 'db/migrate/20210730194555_create_incident_management_pending_issue_escalations.rb' + - 'db/migrate/20210818175949_update_integrations_trigger_type_new_on_insert.rb' + - 'db/migrate/20210825104656_create_analytics_cycle_analytics_merge_request_stage_events.rb' + - 'db/migrate/20210825110016_create_analytics_cycle_analytics_issue_stage_events.rb' + - 'db/migrate/20210826122748_create_loose_foreign_keys_deleted_records.rb' + - 'db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb' + - 'db/migrate/20210903054158_recreate_stage_issue_events_table_with_bigints.rb' + - 'db/migrate/20210906100021_delete_project_namespace_trigger.rb' + - 'db/migrate/20210929032555_create_verification_codes.rb' + - 'db/migrate/20211005092428_drop_time_range_partitioned_loose_fk.rb' + - 'db/migrate/20211005093558_add_range_partitioned_loose_fk_table.rb' + - 'db/migrate/20211005100112_recreate_loose_fk_insert_function.rb' + - 'db/migrate/20211007090229_create_issue_search_table.rb' + - 'db/migrate/20211011141242_create_namespaces_sync_trigger.rb' + - 'db/migrate/20211011141243_create_projects_sync_trigger.rb' + - 'db/migrate/20211012015903_next_traversal_ids_sibling_function.rb' + - 'db/migrate/20211018161447_fix_double_entries_in_postgres_index_view.rb' + - 'db/migrate/20211112155416_populate_default_value_for_personal_access_tokens_prefix.rb' + - 'db/migrate/20211118103439_remove_hardcoded_partition_from_loose_fk_trigger_function.rb' + - 'db/migrate/20211123135255_create_batched_background_migration_job_transition_logs.rb' + - 'db/migrate/20220106111958_add_insert_or_update_vulnerability_reads_trigger.rb' + - 'db/migrate/20220106112043_add_update_vulnerability_reads_trigger.rb' + - 'db/migrate/20220106112085_add_update_vulnerability_reads_location_trigger.rb' + - 'db/migrate/20220106163326_add_has_issues_on_vulnerability_reads_trigger.rb' + - 'db/migrate/20220208171826_update_default_scan_method_of_dast_site_profile.rb' + - 'db/migrate/20220211214605_update_integrations_trigger_type_new_on_insert_null_safe.rb' + - 'db/migrate/20220213100000_remove_integration_type_triggers.rb' + - 'db/migrate/20220304052335_remove_not_null_contraint_on_title_from_sprints.rb' + - 'db/migrate/20220321234317_remove_all_issuable_escalation_statuses.rb' + - 'db/migrate/20220329110630_add_ci_namespace_mirrors_unnest_index_on_traversal_ids.rb' + - 'db/migrate/20220412060931_add_nullify_build_data_trigger_on_merge_request_metrics.rb' + - 'db/migrate/20220413124200_add_view_for_per_table_autovacuum_status.rb' + - 'db/migrate/20220415015143_replace_iterations_cadence_date_range_constraint.rb' + - 'db/migrate/20220422200633_fix_view_for_per_table_autovacuum_status.rb' + - 'db/migrate/20220422220507_remove_tmp_index_supporting_leaky_regex_cleanup.rb' + - 'db/post_migrate/20210302074524_backfill_namespace_statistics_with_wiki_size.rb' + - 'db/post_migrate/20210311045138_set_traversal_ids_for_gitlab_org_group_staging.rb' + - 'db/post_migrate/20210311045139_set_traversal_ids_for_gitlab_org_group_com.rb' + - 'db/post_migrate/20210311093723_add_partial_index_on_ci_pipelines_by_cancelable_status_and_users.rb' + - 'db/post_migrate/20210317104032_set_iteration_cadence_automatic_to_false.rb' + - 'db/post_migrate/20210331105335_drop_non_partitioned_audit_events.rb' + - 'db/post_migrate/20210430134202_copy_adoption_snapshot_namespace.rb' + - 'db/post_migrate/20210430135954_copy_adoption_segments_namespace.rb' + - 'db/post_migrate/20210525075724_clean_up_pending_builds_table.rb' + - 'db/post_migrate/20210609125005_drop_non_partitioned_web_hook_logs.rb' + - 'db/post_migrate/20210610102413_migrate_protected_attribute_to_pending_builds.rb' + - 'db/post_migrate/20210610141711_disable_expiration_policies_linked_to_no_container_images.rb' + - 'db/post_migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb' + - 'db/post_migrate/20210721174521_add_non_null_constraint_for_escalation_rule_on_pending_alert_escalations.rb' + - 'db/post_migrate/20210812013042_remove_duplicate_project_authorizations.rb' + - 'db/post_migrate/20210907211557_finalize_ci_builds_bigint_conversion.rb' + - 'db/post_migrate/20210910194952_update_report_type_for_existing_approval_project_rules.rb' + - 'db/post_migrate/20211105135157_drop_ci_build_trace_sections.rb' + - 'db/post_migrate/20211112113300_remove_ci_pipeline_chat_data_fk_on_chat_names.rb' + - 'db/post_migrate/20211130165043_backfill_sequence_column_for_sprints_table.rb' + - 'db/post_migrate/20211206161271_add_indexes_for_primary_email_cleanup_migration.rb' + - 'db/post_migrate/20211220064757_drop_temporary_indexes_for_primary_email_migration.rb' + - 'db/post_migrate/20220128155251_remove_dangling_running_builds.rb' + - 'db/post_migrate/20220204095121_backfill_namespace_statistics_with_dependency_proxy_size.rb' + - 'db/post_migrate/20220204110725_backfill_cycle_analytics_aggregations.rb' + - 'db/post_migrate/20220213103859_remove_integrations_type.rb' + - 'db/post_migrate/20220309084954_remove_leftover_external_pull_request_deletions.rb' + - 'db/post_migrate/20220318111040_add_indexes_for_primary_email_second_cleanup_migration.rb' + - 'db/post_migrate/20220318111949_drop_temporary_indexes_for_primary_email_migration_second_cleanup.rb' + - 'db/post_migrate/20220329175119_remove_leftover_ci_job_artifact_deletions.rb' + - 'db/post_migrate/20220420135946_update_batched_background_migration_arguments.rb' + - 'ee/app/models/dora/daily_metrics.rb' + - 'ee/app/models/ee/group.rb' + - 'ee/app/models/ee/issue.rb' + - 'ee/app/models/iterations/cadence.rb' + - 'ee/app/models/vulnerabilities/statistic.rb' + - 'ee/app/services/analytics/cycle_analytics/consistency_check_service.rb' + - 'ee/app/services/security/ingestion/bulk_updatable_task.rb' + - 'ee/app/services/security/ingestion/tasks/ingest_vulnerability_statistics.rb' + - 'ee/app/services/vulnerabilities/historical_statistics/adjustment_service.rb' + - 'ee/app/services/vulnerabilities/statistics/adjustment_service.rb' + - 'ee/app/services/vulnerabilities/statistics/update_service.rb' + - 'ee/db/geo/migrate/20170906174622_remove_duplicates_from_project_registry.rb' + - 'ee/db/geo/migrate/20180510223634_set_resync_flag_for_retried_projects.rb' + - 'ee/db/geo/post_migrate/20210217020154_add_unique_index_on_container_repository_registry.rb' + - 'ee/db/geo/post_migrate/20210217020156_add_unique_index_on_terraform_state_version_registry.rb' + - 'ee/lib/ee/gitlab/background_migration/backfill_iteration_cadence_id_for_boards.rb' + - 'ee/lib/ee/gitlab/background_migration/create_security_setting.rb' + - 'ee/lib/ee/gitlab/background_migration/populate_latest_pipeline_ids.rb' + - 'ee/lib/ee/gitlab/background_migration/populate_resolved_on_default_branch_column.rb' + - 'ee/lib/ee/gitlab/background_migration/populate_status_column_of_security_scans.rb' + - 'ee/lib/ee/gitlab/background_migration/populate_test_reports_issue_id.rb' + - 'ee/lib/ee/gitlab/background_migration/update_vulnerability_occurrences_location.rb' + - 'ee/lib/ee/gitlab/usage_data.rb' + - 'ee/lib/gitlab/geo/base_batcher.rb' + - 'ee/spec/models/ee/user_spec.rb' + - 'lib/gitlab/background_migration/backfill_ci_namespace_mirrors.rb' + - 'lib/gitlab/background_migration/backfill_ci_project_mirrors.rb' + - 'lib/gitlab/background_migration/backfill_group_features.rb' + - 'lib/gitlab/background_migration/backfill_integrations_type_new.rb' + - 'lib/gitlab/background_migration/backfill_issue_search_data.rb' + - 'lib/gitlab/background_migration/backfill_namespace_id_for_project_route.rb' + - 'lib/gitlab/background_migration/backfill_namespace_traversal_ids_children.rb' + - 'lib/gitlab/background_migration/backfill_project_settings.rb' + - 'lib/gitlab/background_migration/backfill_projects_with_coverage.rb' + - 'lib/gitlab/background_migration/backfill_upvotes_count_on_issues.rb' + - 'lib/gitlab/background_migration/copy_ci_builds_columns_to_security_scans.rb' + - 'lib/gitlab/background_migration/disable_expiration_policies_linked_to_no_container_images.rb' + - 'lib/gitlab/background_migration/encrypt_static_object_token.rb' + - 'lib/gitlab/background_migration/fix_duplicate_project_name_and_path.rb' + - 'lib/gitlab/background_migration/fix_first_mentioned_in_commit_at.rb' + - 'lib/gitlab/background_migration/fix_projects_without_project_feature.rb' + - 'lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb' + - 'lib/gitlab/background_migration/move_container_registry_enabled_to_project_feature.rb' + - 'lib/gitlab/background_migration/populate_container_repository_migration_plan.rb' + - 'lib/gitlab/background_migration/populate_topics_non_private_projects_count.rb' + - 'lib/gitlab/background_migration/populate_topics_total_projects_count_cache.rb' + - 'lib/gitlab/background_migration/populate_vulnerability_reads.rb' + - 'lib/gitlab/background_migration/project_namespaces/backfill_project_namespaces.rb' + - 'lib/gitlab/background_migration/update_timelogs_null_spent_at.rb' + - 'lib/gitlab/background_migration/update_timelogs_project_id.rb' + - 'lib/gitlab/background_migration/update_users_where_two_factor_auth_required_from_group.rb' + - 'lib/gitlab/database/bulk_update.rb' + - 'lib/gitlab/database/count/tablesample_count_strategy.rb' + - 'lib/gitlab/database/load_balancing/load_balancer.rb' + - 'lib/gitlab/database/migration_helpers.rb' + - 'lib/gitlab/database/migration_helpers/loose_foreign_key_helpers.rb' + - 'lib/gitlab/database/migration_helpers/v2.rb' + - 'lib/gitlab/database/migrations/batched_background_migration_helpers.rb' + - 'lib/gitlab/database/migrations/observers/query_statistics.rb' + - 'lib/gitlab/database/partitioning/replace_table.rb' + - 'lib/gitlab/database/partitioning/single_numeric_list_partition.rb' + - 'lib/gitlab/database/partitioning/sliding_list_strategy.rb' + - 'lib/gitlab/database/partitioning/time_partition.rb' + - 'lib/gitlab/database/partitioning_migration_helpers/backfill_partitioned_table.rb' + - 'lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb' + - 'lib/gitlab/database/postgres_hll/batch_distinct_counter.rb' + - 'lib/gitlab/database/schema_helpers.rb' + - 'lib/gitlab/database/schema_migrations/migrations.rb' + - 'lib/gitlab/database/unidirectional_copy_trigger.rb' + - 'lib/gitlab/graphql/pagination/keyset/conditions/not_null_condition.rb' + - 'lib/gitlab/graphql/pagination/keyset/conditions/null_condition.rb' + - 'lib/gitlab/pagination/keyset/in_operator_optimization/query_builder.rb' + - 'lib/gitlab/sql/glob.rb' + - 'lib/tasks/dev.rake' + - 'qa/qa/service/praefect_manager.rb' + - 'spec/db/schema_spec.rb' + - 'spec/initializers/00_rails_disable_joins_spec.rb' + - 'spec/lib/gitlab/background_migration/copy_column_using_background_migration_job_spec.rb' + - 'spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb' + - 'spec/lib/gitlab/database/migration_helpers_spec.rb' + - 'spec/lib/gitlab/database/migrations/observers/query_statistics_spec.rb' + - 'spec/lib/gitlab/database/partitioning/detached_partition_dropper_spec.rb' + - 'spec/lib/gitlab/database/partitioning/monthly_strategy_spec.rb' + - 'spec/lib/gitlab/database/partitioning/partition_manager_spec.rb' + - 'spec/lib/gitlab/database/partitioning/replace_table_spec.rb' + - 'spec/lib/gitlab/database/partitioning/sliding_list_strategy_spec.rb' + - 'spec/lib/gitlab/database/partitioning/time_partition_spec.rb' + - 'spec/lib/gitlab/database/partitioning_migration_helpers/backfill_partitioned_table_spec.rb' + - 'spec/lib/gitlab/database/partitioning_migration_helpers/foreign_key_helpers_spec.rb' + - 'spec/lib/gitlab/database/partitioning_migration_helpers/index_helpers_spec.rb' + - 'spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb' + - 'spec/lib/gitlab/database/partitioning_spec.rb' + - 'spec/lib/gitlab/database/postgres_foreign_key_spec.rb' + - 'spec/lib/gitlab/database/postgres_index_bloat_estimate_spec.rb' + - 'spec/lib/gitlab/database/postgres_index_spec.rb' + - 'spec/lib/gitlab/database/postgres_partition_spec.rb' + - 'spec/lib/gitlab/database/postgres_partitioned_table_spec.rb' + - 'spec/lib/gitlab/database/reindexing/reindex_concurrently_spec.rb' + - 'spec/lib/gitlab/database/reindexing_spec.rb' + - 'spec/lib/gitlab/database/schema_migrations/migrations_spec.rb' + - 'spec/lib/gitlab/database/similarity_score_spec.rb' + - 'spec/lib/gitlab/database/unidirectional_copy_trigger_spec.rb' + - 'spec/lib/gitlab/graphql/pagination/keyset/conditions/not_null_condition_spec.rb' + - 'spec/lib/gitlab/graphql/pagination/keyset/conditions/null_condition_spec.rb' + - 'spec/lib/gitlab/pagination/keyset/in_operator_optimization/strategies/record_loader_strategy_spec.rb' + - 'spec/lib/gitlab/pagination/keyset/order_spec.rb' + - 'spec/models/application_record_spec.rb' + - 'spec/models/concerns/after_commit_queue_spec.rb' + - 'spec/support/db_cleaner.rb' + - 'spec/support/helpers/database/partitioning_helpers.rb' + - 'spec/support/helpers/database/table_schema_helpers.rb' + - 'spec/support/helpers/database/trigger_helpers.rb' + - 'spec/support/shared_examples/loose_foreign_keys/have_loose_foreign_key.rb' diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index f56dc2e2ba9..c189d8d9d89 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -6aeaf165b7624e55e418cf29f634076658cb28bc +4729c4575139660a3aa945bd6df3c66996e26e0f diff --git a/app/finders/groups/projects_requiring_authorizations_refresh/base.rb b/app/finders/groups/projects_requiring_authorizations_refresh/base.rb new file mode 100644 index 00000000000..c719e6ba903 --- /dev/null +++ b/app/finders/groups/projects_requiring_authorizations_refresh/base.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module Groups + module ProjectsRequiringAuthorizationsRefresh + class Base + def initialize(group) + @group = group + end + + private + + def ids_of_projects_in_hierarchy_and_project_shares(group) + project_ids = Set.new + + ids_of_projects_in_hierarchy = group.all_projects.pluck(:id) # rubocop: disable CodeReuse/ActiveRecord + ids_of_projects_in_project_shares = ids_of_projects_shared_with_self_and_descendant_groups(group) + + project_ids.merge(ids_of_projects_in_hierarchy) + project_ids.merge(ids_of_projects_in_project_shares) + + project_ids + end + + def ids_of_projects_shared_with_self_and_descendant_groups(group, batch_size: 50) + project_ids = Set.new + + group.self_and_descendants_ids.each_slice(batch_size) do |group_ids| + project_ids.merge(ProjectGroupLink.in_group(group_ids).pluck(:project_id)) # rubocop: disable CodeReuse/ActiveRecord + end + + project_ids + end + end + end +end diff --git a/app/finders/groups/projects_requiring_authorizations_refresh/on_direct_membership_finder.rb b/app/finders/groups/projects_requiring_authorizations_refresh/on_direct_membership_finder.rb index 909a896d77c..f6b8b999b99 100644 --- a/app/finders/groups/projects_requiring_authorizations_refresh/on_direct_membership_finder.rb +++ b/app/finders/groups/projects_requiring_authorizations_refresh/on_direct_membership_finder.rb @@ -8,11 +8,7 @@ module Groups module ProjectsRequiringAuthorizationsRefresh - class OnDirectMembershipFinder - def initialize(group) - @group = group - end - + class OnDirectMembershipFinder < Base def execute project_ids = Set.new @@ -24,28 +20,6 @@ module Groups private - def ids_of_projects_in_hierarchy_and_project_shares(group) - project_ids = Set.new - - ids_of_projects_in_hierarchy = group.all_projects.pluck(:id) # rubocop: disable CodeReuse/ActiveRecord - ids_of_projects_in_project_shares = ids_of_projects_shared_with_self_and_descendant_groups(group) - - project_ids.merge(ids_of_projects_in_hierarchy) - project_ids.merge(ids_of_projects_in_project_shares) - - project_ids - end - - def ids_of_projects_shared_with_self_and_descendant_groups(group, batch_size: 50) - project_ids = Set.new - - group.self_and_descendants_ids.each_slice(batch_size) do |group_ids| - project_ids.merge(ProjectGroupLink.in_group(group_ids).pluck(:project_id)) # rubocop: disable CodeReuse/ActiveRecord - end - - project_ids - end - def ids_of_projects_in_hierarchy_and_project_shares_of_shared_groups(group, batch_size: 10) project_ids = Set.new diff --git a/app/finders/groups/projects_requiring_authorizations_refresh/on_transfer_finder.rb b/app/finders/groups/projects_requiring_authorizations_refresh/on_transfer_finder.rb new file mode 100644 index 00000000000..781e1222287 --- /dev/null +++ b/app/finders/groups/projects_requiring_authorizations_refresh/on_transfer_finder.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# Groups::ProjectsRequiringAuthorizationsRefresh::OnTransferFinder +# +# Given a group, this finder can be used to obtain a list of Project IDs of projects +# that requires their `project_authorizations` records to be refreshed in the event where +# the group has been transferred. + +module Groups + module ProjectsRequiringAuthorizationsRefresh + class OnTransferFinder < Base + def execute + ids_of_projects_in_hierarchy_and_project_shares(@group).to_a + end + end + end +end diff --git a/app/graphql/mutations/award_emojis/base.rb b/app/graphql/mutations/award_emojis/base.rb index ce73f2083f2..dc2d46269e6 100644 --- a/app/graphql/mutations/award_emojis/base.rb +++ b/app/graphql/mutations/award_emojis/base.rb @@ -26,12 +26,6 @@ module Mutations private - # TODO: remove this method when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - def find_object(id:) - super(id: ::Types::GlobalIDType[::Awardable].coerce_isolated_input(id)) - end - def authorize!(object) super raise_resource_not_available_error!(NOT_EMOJI_AWARDABLE) unless object.emoji_awardable? diff --git a/app/graphql/mutations/base_mutation.rb b/app/graphql/mutations/base_mutation.rb index 5de042f78d6..d57a097a9e2 100644 --- a/app/graphql/mutations/base_mutation.rb +++ b/app/graphql/mutations/base_mutation.rb @@ -4,7 +4,6 @@ module Mutations class BaseMutation < GraphQL::Schema::RelayClassicMutation include Gitlab::Graphql::Authorize::AuthorizeResource prepend Gitlab::Graphql::CopyFieldDescription - prepend ::Gitlab::Graphql::GlobalIDCompatibility ERROR_MESSAGE = 'You cannot perform write operations on a read-only instance' diff --git a/app/graphql/mutations/boards/update.rb b/app/graphql/mutations/boards/update.rb index 40ab5a5ba7d..7cfce9d2d91 100644 --- a/app/graphql/mutations/boards/update.rb +++ b/app/graphql/mutations/boards/update.rb @@ -33,9 +33,6 @@ module Mutations private def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Board].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/ci/job/base.rb b/app/graphql/mutations/ci/job/base.rb index a9fe26226d9..6ea8e25a58d 100644 --- a/app/graphql/mutations/ci/job/base.rb +++ b/app/graphql/mutations/ci/job/base.rb @@ -11,9 +11,6 @@ module Mutations description: 'ID of the job to mutate.' def find_object(id: ) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = JobID.coerce_isolated_input(id) GlobalID::Locator.locate(id) end end diff --git a/app/graphql/mutations/ci/pipeline/base.rb b/app/graphql/mutations/ci/pipeline/base.rb index aed8035a52a..503cf6c005f 100644 --- a/app/graphql/mutations/ci/pipeline/base.rb +++ b/app/graphql/mutations/ci/pipeline/base.rb @@ -13,9 +13,6 @@ module Mutations private def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = PipelineID.coerce_isolated_input(id) GlobalID::Locator.locate(id) end end diff --git a/app/graphql/mutations/ci/runner/delete.rb b/app/graphql/mutations/ci/runner/delete.rb index 1713ec0bf6d..db68914a4eb 100644 --- a/app/graphql/mutations/ci/runner/delete.rb +++ b/app/graphql/mutations/ci/runner/delete.rb @@ -23,10 +23,6 @@ module Mutations end def find_object(id) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = RunnerID.coerce_isolated_input(id) - GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/ci/runner/update.rb b/app/graphql/mutations/ci/runner/update.rb index 3432840f60f..faccd1273e5 100644 --- a/app/graphql/mutations/ci/runner/update.rb +++ b/app/graphql/mutations/ci/runner/update.rb @@ -61,10 +61,6 @@ module Mutations end def find_object(id) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = RunnerID.coerce_isolated_input(id) - GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/clusters/agent_tokens/create.rb b/app/graphql/mutations/clusters/agent_tokens/create.rb index 07bf2536065..a99a54fa5ed 100644 --- a/app/graphql/mutations/clusters/agent_tokens/create.rb +++ b/app/graphql/mutations/clusters/agent_tokens/create.rb @@ -58,9 +58,6 @@ module Mutations private def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ClusterAgentID.coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/clusters/agent_tokens/revoke.rb b/app/graphql/mutations/clusters/agent_tokens/revoke.rb index ca570792296..974db976f1d 100644 --- a/app/graphql/mutations/clusters/agent_tokens/revoke.rb +++ b/app/graphql/mutations/clusters/agent_tokens/revoke.rb @@ -24,9 +24,6 @@ module Mutations private def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = TokenID.coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/clusters/agents/delete.rb b/app/graphql/mutations/clusters/agents/delete.rb index 9ada1f31f60..fb482e02794 100644 --- a/app/graphql/mutations/clusters/agents/delete.rb +++ b/app/graphql/mutations/clusters/agents/delete.rb @@ -28,9 +28,6 @@ module Mutations private def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = AgentID.coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/container_repositories/destroy_base.rb b/app/graphql/mutations/container_repositories/destroy_base.rb index ddaa6c52121..1c2c4d87a5f 100644 --- a/app/graphql/mutations/container_repositories/destroy_base.rb +++ b/app/graphql/mutations/container_repositories/destroy_base.rb @@ -8,9 +8,6 @@ module Mutations private def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::ContainerRepository].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/customer_relations/contacts/create.rb b/app/graphql/mutations/customer_relations/contacts/create.rb index 96dc047c3db..ea6304f9d81 100644 --- a/app/graphql/mutations/customer_relations/contacts/create.rb +++ b/app/graphql/mutations/customer_relations/contacts/create.rb @@ -59,7 +59,7 @@ module Mutations def set_organization!(args) return unless args[:organization_id] - args[:organization_id] = resolve_ids(args[:organization_id], ::Types::GlobalIDType[::CustomerRelations::Organization])[0] + args[:organization_id] = args[:organization_id].model_id end end end diff --git a/app/graphql/mutations/design_management/move.rb b/app/graphql/mutations/design_management/move.rb index 1ca03f22880..b19d9b4ce61 100644 --- a/app/graphql/mutations/design_management/move.rb +++ b/app/graphql/mutations/design_management/move.rb @@ -35,9 +35,6 @@ module Mutations end def find_design(id) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = DesignID.coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end diff --git a/app/graphql/mutations/discussions/toggle_resolve.rb b/app/graphql/mutations/discussions/toggle_resolve.rb index 2005c9e54e0..fce6e4f416f 100644 --- a/app/graphql/mutations/discussions/toggle_resolve.rb +++ b/app/graphql/mutations/discussions/toggle_resolve.rb @@ -54,9 +54,6 @@ module Mutations end def find_object(id:) - # TODO: remove explicit coercion once compatibility layer has been removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = Types::GlobalIDType[Discussion].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end diff --git a/app/graphql/mutations/environments/canary_ingress/update.rb b/app/graphql/mutations/environments/canary_ingress/update.rb index b5633f49809..1cddfdd815b 100644 --- a/app/graphql/mutations/environments/canary_ingress/update.rb +++ b/app/graphql/mutations/environments/canary_ingress/update.rb @@ -36,8 +36,6 @@ module Mutations end def find_object(id:) - # TODO: remove as part of https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Environment].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end diff --git a/app/graphql/mutations/merge_requests/set_labels.rb b/app/graphql/mutations/merge_requests/set_labels.rb index 0b40d6c5c5e..f80fcd0f1ac 100644 --- a/app/graphql/mutations/merge_requests/set_labels.rb +++ b/app/graphql/mutations/merge_requests/set_labels.rb @@ -23,9 +23,6 @@ module Mutations merge_request = authorized_find!(project_path: project_path, iid: iid) project = merge_request.project - # TODO: remove this line when the compatibility layer is removed: - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - label_ids = label_ids.map { |id| ::Types::GlobalIDType[::Label].coerce_isolated_input(id) } # MergeRequests::UpdateService expects integers label_ids = label_ids.compact.map(&:model_id) diff --git a/app/graphql/mutations/metrics/dashboard/annotations/create.rb b/app/graphql/mutations/metrics/dashboard/annotations/create.rb index 2eb48c9029d..2e7c0c5a2f9 100644 --- a/app/graphql/mutations/metrics/dashboard/annotations/create.rb +++ b/app/graphql/mutations/metrics/dashboard/annotations/create.rb @@ -96,16 +96,7 @@ module Mutations end def annotation_source(args) - # TODO: remove these lines when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - annotation_source_id = if args[:cluster_id] - ::Types::GlobalIDType[::Clusters::Cluster].coerce_isolated_input(args[:cluster_id]) - else - ::Types::GlobalIDType[::Environment].coerce_isolated_input(args[:environment_id]) - end - - # TODO: uncomment following line once lines above are removed - # annotation_source_id = args[:cluster_id] || args[:environment_id] + annotation_source_id = args[:cluster_id] || args[:environment_id] authorized_find!(id: annotation_source_id) end end diff --git a/app/graphql/mutations/notes/base.rb b/app/graphql/mutations/notes/base.rb index 65bb9e4644c..fb74805db17 100644 --- a/app/graphql/mutations/notes/base.rb +++ b/app/graphql/mutations/notes/base.rb @@ -17,9 +17,6 @@ module Mutations private def find_object(id:) - # TODO: remove explicit coercion once compatibility layer has been removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Note].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/notes/create/base.rb b/app/graphql/mutations/notes/create/base.rb index e13a51c6862..1b673204213 100644 --- a/app/graphql/mutations/notes/create/base.rb +++ b/app/graphql/mutations/notes/create/base.rb @@ -42,9 +42,6 @@ module Mutations private def find_object(id:) - # TODO: remove explicit coercion once compatibility layer has been removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Noteable].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end diff --git a/app/graphql/mutations/notes/create/note.rb b/app/graphql/mutations/notes/create/note.rb index 1cfc11c6b11..4d6f056de09 100644 --- a/app/graphql/mutations/notes/create/note.rb +++ b/app/graphql/mutations/notes/create/note.rb @@ -22,11 +22,8 @@ module Mutations def create_note_params(noteable, args) discussion_id = nil - if args[:discussion_id] - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - discussion_gid = ::Types::GlobalIDType[::Discussion].coerce_isolated_input(args[:discussion_id]) - discussion = GitlabSchema.find_by_gid(discussion_gid) + if gid = args[:discussion_id] + discussion = GitlabSchema.find_by_gid(gid) authorize_discussion!(discussion) diff --git a/app/graphql/mutations/packages/destroy.rb b/app/graphql/mutations/packages/destroy.rb index 81fa53fc116..a398b1ff9dc 100644 --- a/app/graphql/mutations/packages/destroy.rb +++ b/app/graphql/mutations/packages/destroy.rb @@ -27,9 +27,6 @@ module Mutations private def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Packages::Package].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/packages/destroy_file.rb b/app/graphql/mutations/packages/destroy_file.rb index 4aa33b3504c..f2a8f2b853a 100644 --- a/app/graphql/mutations/packages/destroy_file.rb +++ b/app/graphql/mutations/packages/destroy_file.rb @@ -25,9 +25,6 @@ module Mutations private def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Packages::PackageFile].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/release_asset_links/delete.rb b/app/graphql/mutations/release_asset_links/delete.rb index d8f0946670b..91fa74859f6 100644 --- a/app/graphql/mutations/release_asset_links/delete.rb +++ b/app/graphql/mutations/release_asset_links/delete.rb @@ -29,10 +29,6 @@ module Mutations end def find_object(id) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ReleaseAssetLinkID.coerce_isolated_input(id) - GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/release_asset_links/update.rb b/app/graphql/mutations/release_asset_links/update.rb index 18d92cd82ae..f9368927371 100644 --- a/app/graphql/mutations/release_asset_links/update.rb +++ b/app/graphql/mutations/release_asset_links/update.rb @@ -54,10 +54,6 @@ module Mutations end def find_object(id) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ReleaseAssetLinkID.coerce_isolated_input(id) - GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/saved_replies/base.rb b/app/graphql/mutations/saved_replies/base.rb index d7256119d2b..4923fcb7851 100644 --- a/app/graphql/mutations/saved_replies/base.rb +++ b/app/graphql/mutations/saved_replies/base.rb @@ -28,10 +28,6 @@ module Mutations end def find_object(id) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Users::SavedReply].coerce_isolated_input(id) - GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/timelogs/delete.rb b/app/graphql/mutations/timelogs/delete.rb index 3fd5f4477c1..8fd41c27b88 100644 --- a/app/graphql/mutations/timelogs/delete.rb +++ b/app/graphql/mutations/timelogs/delete.rb @@ -26,8 +26,6 @@ module Mutations end def find_object(id:) - # TODO: Remove coercion when working on https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Timelog].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/todos/base.rb b/app/graphql/mutations/todos/base.rb index 4dab3bbc3f4..9a94c5d1e6d 100644 --- a/app/graphql/mutations/todos/base.rb +++ b/app/graphql/mutations/todos/base.rb @@ -6,9 +6,6 @@ module Mutations private def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Todo].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/todos/create.rb b/app/graphql/mutations/todos/create.rb index ccc3d0b61e4..489d2f490ff 100644 --- a/app/graphql/mutations/todos/create.rb +++ b/app/graphql/mutations/todos/create.rb @@ -17,8 +17,7 @@ module Mutations description: 'To-do item created.' def resolve(target_id:) - id = ::Types::GlobalIDType[Todoable].coerce_isolated_input(target_id) - target = authorized_find!(id) + target = authorized_find!(target_id) todo = TodoService.new.mark_todo(target, current_user)&.first errors = errors_on_object(todo) if todo diff --git a/app/graphql/mutations/todos/mark_all_done.rb b/app/graphql/mutations/todos/mark_all_done.rb index 67a822c1067..fe4023515a4 100644 --- a/app/graphql/mutations/todos/mark_all_done.rb +++ b/app/graphql/mutations/todos/mark_all_done.rb @@ -39,7 +39,7 @@ module Mutations if args[:target_id].present? target = Gitlab::Graphql::Lazy.force( - GitlabSchema.find_by_gid(TodoableID.coerce_isolated_input(args[:target_id])) + GitlabSchema.find_by_gid(args[:target_id]) ) raise Gitlab::Graphql::Errors::ResourceNotAvailable, "Resource not available: #{args[:target_id]}" if target.nil? diff --git a/app/graphql/mutations/todos/restore_many.rb b/app/graphql/mutations/todos/restore_many.rb index 3453645000b..fe0ad6df65b 100644 --- a/app/graphql/mutations/todos/restore_many.rb +++ b/app/graphql/mutations/todos/restore_many.rb @@ -33,9 +33,6 @@ module Mutations def model_ids_of(ids) ids.map do |gid| - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - gid = ::Types::GlobalIDType[::Todo].coerce_isolated_input(gid) gid.model_id.to_i end.compact end diff --git a/app/graphql/mutations/work_items/create.rb b/app/graphql/mutations/work_items/create.rb index c29dbb899b5..2e136d409ab 100644 --- a/app/graphql/mutations/work_items/create.rb +++ b/app/graphql/mutations/work_items/create.rb @@ -53,9 +53,6 @@ module Mutations private def global_id_compatibility_params(params) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - params[:work_item_type_id] = ::Types::GlobalIDType[::WorkItems::Type].coerce_isolated_input(params[:work_item_type_id]) if params[:work_item_type_id] params[:work_item_type_id] = params[:work_item_type_id]&.model_id params diff --git a/app/graphql/mutations/work_items/create_from_task.rb b/app/graphql/mutations/work_items/create_from_task.rb index 278c1bc65a9..4da709401a6 100644 --- a/app/graphql/mutations/work_items/create_from_task.rb +++ b/app/graphql/mutations/work_items/create_from_task.rb @@ -55,8 +55,6 @@ module Mutations private def find_object(id:) - # TODO: Remove coercion when working on https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::WorkItem].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/work_items/delete.rb b/app/graphql/mutations/work_items/delete.rb index 3d72ebbd95d..1830ab5443c 100644 --- a/app/graphql/mutations/work_items/delete.rb +++ b/app/graphql/mutations/work_items/delete.rb @@ -38,8 +38,6 @@ module Mutations private def find_object(id:) - # TODO: Remove coercion when working on https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::WorkItem].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/mutations/work_items/update.rb b/app/graphql/mutations/work_items/update.rb index 091237d6fa0..20319301482 100644 --- a/app/graphql/mutations/work_items/update.rb +++ b/app/graphql/mutations/work_items/update.rb @@ -52,8 +52,6 @@ module Mutations private def find_object(id:) - # TODO: Remove coercion when working on https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::WorkItem].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/resolvers/alert_management/http_integrations_resolver.rb b/app/graphql/resolvers/alert_management/http_integrations_resolver.rb index abc54614a59..225e20bab83 100644 --- a/app/graphql/resolvers/alert_management/http_integrations_resolver.rb +++ b/app/graphql/resolvers/alert_management/http_integrations_resolver.rb @@ -26,8 +26,7 @@ module Resolvers private def integrations_by(gid:) - id = Types::GlobalIDType[::AlertManagement::HttpIntegration].coerce_isolated_input(gid) - object = GitlabSchema.find_by_gid(id) + object = GitlabSchema.find_by_gid(gid) defer { object }.then do |integration| ret = integration if project == integration&.project diff --git a/app/graphql/resolvers/base_resolver.rb b/app/graphql/resolvers/base_resolver.rb index dbded8f60a0..2b54a3fdd55 100644 --- a/app/graphql/resolvers/base_resolver.rb +++ b/app/graphql/resolvers/base_resolver.rb @@ -4,7 +4,6 @@ module Resolvers class BaseResolver < GraphQL::Schema::Resolver extend ::Gitlab::Utils::Override include ::Gitlab::Utils::StrongMemoize - include ::Gitlab::Graphql::GlobalIDCompatibility argument_class ::Types::BaseArgument diff --git a/app/graphql/resolvers/boards_resolver.rb b/app/graphql/resolvers/boards_resolver.rb index 679f2b4cceb..91cd15f615d 100644 --- a/app/graphql/resolvers/boards_resolver.rb +++ b/app/graphql/resolvers/boards_resolver.rb @@ -26,9 +26,6 @@ module Resolvers def extract_board_id(id) return unless id.present? - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = Types::GlobalIDType[Board].coerce_isolated_input(id) id.model_id end end diff --git a/app/graphql/resolvers/concerns/resolves_ids.rb b/app/graphql/resolvers/concerns/resolves_ids.rb index 8bf2a6b2ac9..3e248c40562 100644 --- a/app/graphql/resolvers/concerns/resolves_ids.rb +++ b/app/graphql/resolvers/concerns/resolves_ids.rb @@ -3,13 +3,10 @@ module ResolvesIds extend ActiveSupport::Concern - def resolve_ids(ids, type) + def resolve_ids(ids) Array.wrap(ids).map do |id| next unless id.present? - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = type.coerce_isolated_input(id) id.model_id end.compact end diff --git a/app/graphql/resolvers/concerns/resolves_snippets.rb b/app/graphql/resolvers/concerns/resolves_snippets.rb index 46d78a6a8c8..8274b5cc49f 100644 --- a/app/graphql/resolvers/concerns/resolves_snippets.rb +++ b/app/graphql/resolvers/concerns/resolves_snippets.rb @@ -28,7 +28,7 @@ module ResolvesSnippets def snippet_finder_params(args) { - ids: resolve_ids(args[:ids], ::Types::GlobalIDType[::Snippet]), + ids: resolve_ids(args[:ids]), scope: args[:visibility] }.merge(options_by_type(args[:type])) end diff --git a/app/graphql/resolvers/design_management/design_at_version_resolver.rb b/app/graphql/resolvers/design_management/design_at_version_resolver.rb index c87670bc24c..5ba23b5d1ed 100644 --- a/app/graphql/resolvers/design_management/design_at_version_resolver.rb +++ b/app/graphql/resolvers/design_management/design_at_version_resolver.rb @@ -18,9 +18,6 @@ module Resolvers end def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::DesignManagement::DesignAtVersion].coerce_isolated_input(id) dav = GitlabSchema.find_by_gid(id) return unless consistent?(dav) diff --git a/app/graphql/resolvers/design_management/design_resolver.rb b/app/graphql/resolvers/design_management/design_resolver.rb index d9e5203ef0e..eaa11d2fd9d 100644 --- a/app/graphql/resolvers/design_management/design_resolver.rb +++ b/app/graphql/resolvers/design_management/design_resolver.rb @@ -54,10 +54,6 @@ module Resolvers end def parse_gid(gid) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - gid = ::Types::GlobalIDType[::DesignManagement::Design].coerce_isolated_input(gid) - gid.model_id end end diff --git a/app/graphql/resolvers/design_management/designs_resolver.rb b/app/graphql/resolvers/design_management/designs_resolver.rb index 50e3b64448c..9993368715f 100644 --- a/app/graphql/resolvers/design_management/designs_resolver.rb +++ b/app/graphql/resolvers/design_management/designs_resolver.rb @@ -24,17 +24,17 @@ module Resolvers end def resolve(ids: nil, filenames: nil, at_version: nil) - # TODO: remove the coercion when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 context.scoped_set!(:at_version_argument, VersionID.coerce_isolated_input(at_version)) if at_version - ::DesignManagement::DesignsFinder.new( - issue, - current_user, - ids: design_ids(ids), - filenames: filenames, - visible_at_version: version(at_version) - ).execute + ::Gitlab::Graphql::Lazy.with_value(version(at_version)) do |visible_at| + ::DesignManagement::DesignsFinder.new( + issue, + current_user, + ids: design_ids(ids), + filenames: filenames, + visible_at_version: visible_at + ).execute + end end private @@ -42,19 +42,12 @@ module Resolvers def version(at_version) return unless at_version - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - at_version = VersionID.coerce_isolated_input(at_version) - # TODO: when we get promises use this to make resolve lazy - Gitlab::Graphql::Lazy.force(GitlabSchema.find_by_gid(at_version)) + GitlabSchema.find_by_gid(at_version) end def design_ids(gids) return if gids.nil? - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - gids = gids.map { |id| DesignID.coerce_isolated_input(id) } gids.map(&:model_id) end diff --git a/app/graphql/resolvers/design_management/version/design_at_version_resolver.rb b/app/graphql/resolvers/design_management/version/design_at_version_resolver.rb index 76e365c40b1..30d2865ae85 100644 --- a/app/graphql/resolvers/design_management/version/design_at_version_resolver.rb +++ b/app/graphql/resolvers/design_management/version/design_at_version_resolver.rb @@ -34,11 +34,6 @@ module Resolvers def resolve(design_id: nil, filename: nil, design_at_version_id: nil) validate_arguments(design_id, filename, design_at_version_id) - # TODO: remove this when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - design_id &&= DesignID.coerce_isolated_input(design_id) - design_at_version_id &&= DesignAtVersionID.coerce_isolated_input(design_at_version_id) - return unless Ability.allowed?(current_user, :read_design, issue) return specific_design_at_version(design_at_version_id) if design_at_version_id diff --git a/app/graphql/resolvers/design_management/version/designs_at_version_resolver.rb b/app/graphql/resolvers/design_management/version/designs_at_version_resolver.rb index 97cc7554ba8..9f98762b519 100644 --- a/app/graphql/resolvers/design_management/version/designs_at_version_resolver.rb +++ b/app/graphql/resolvers/design_management/version/designs_at_version_resolver.rb @@ -41,9 +41,6 @@ module Resolvers def design_ids(gids) return if gids.nil? - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - gids = gids.map { |id| DesignID.coerce_isolated_input(id) } gids.map(&:model_id) end diff --git a/app/graphql/resolvers/design_management/version_in_collection_resolver.rb b/app/graphql/resolvers/design_management/version_in_collection_resolver.rb index 2682ce6b3b1..f29cd30c36f 100644 --- a/app/graphql/resolvers/design_management/version_in_collection_resolver.rb +++ b/app/graphql/resolvers/design_management/version_in_collection_resolver.rb @@ -24,10 +24,6 @@ module Resolvers description: "SHA256 of a specific version." def resolve(version_id: nil, sha: nil) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - version_id &&= VersionID.coerce_isolated_input(version_id) - check_args(version_id, sha) ::DesignManagement::VersionsFinder diff --git a/app/graphql/resolvers/design_management/version_resolver.rb b/app/graphql/resolvers/design_management/version_resolver.rb index a6403fbd69f..7895981d67c 100644 --- a/app/graphql/resolvers/design_management/version_resolver.rb +++ b/app/graphql/resolvers/design_management/version_resolver.rb @@ -18,10 +18,6 @@ module Resolvers end def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::DesignManagement::Version].coerce_isolated_input(id) - GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/resolvers/design_management/versions_resolver.rb b/app/graphql/resolvers/design_management/versions_resolver.rb index df283104821..de636655087 100644 --- a/app/graphql/resolvers/design_management/versions_resolver.rb +++ b/app/graphql/resolvers/design_management/versions_resolver.rb @@ -25,9 +25,6 @@ module Resolvers end def resolve(id: nil, sha: nil) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id &&= VersionID.coerce_isolated_input(id) version = cutoff(id, sha) raise ::Gitlab::Graphql::Errors::ResourceNotAvailable, 'cutoff not found' unless version.present? diff --git a/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb b/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb index 7032af46221..27bba6c8144 100644 --- a/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb +++ b/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb @@ -10,10 +10,6 @@ module Resolvers description: 'ID of the Sentry issue.' def resolve(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Gitlab::ErrorTracking::DetailedError].coerce_isolated_input(id) - # Get data from Sentry response = ::ErrorTracking::IssueDetailsService.new( project, diff --git a/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb b/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb index 8876f8badcd..3867634dd8b 100644 --- a/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb +++ b/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb @@ -10,10 +10,6 @@ module Resolvers description: 'ID of the Sentry issue.' def resolve(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Gitlab::ErrorTracking::DetailedError].coerce_isolated_input(id) - # Get data from Sentry response = ::ErrorTracking::IssueLatestEventService.new( project, diff --git a/app/graphql/resolvers/package_details_resolver.rb b/app/graphql/resolvers/package_details_resolver.rb index 42cb23e701d..705d3900cd2 100644 --- a/app/graphql/resolvers/package_details_resolver.rb +++ b/app/graphql/resolvers/package_details_resolver.rb @@ -17,9 +17,6 @@ module Resolvers end def resolve(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Packages::Package].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/resolvers/snippets_resolver.rb b/app/graphql/resolvers/snippets_resolver.rb index 149bd8fa1ce..90f5f2cb534 100644 --- a/app/graphql/resolvers/snippets_resolver.rb +++ b/app/graphql/resolvers/snippets_resolver.rb @@ -38,11 +38,9 @@ module Resolvers private def snippet_finder_params(args) - # TODO: remove the type arguments when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 super - .merge(author: resolve_ids(args[:author_id], ::Types::GlobalIDType[::User]), - project: resolve_ids(args[:project_id], ::Types::GlobalIDType[::Project]), + .merge(author: resolve_ids(args[:author_id]), + project: resolve_ids(args[:project_id]), explore: args[:explore]) end end diff --git a/app/graphql/resolvers/timelog_resolver.rb b/app/graphql/resolvers/timelog_resolver.rb index 14831a29d90..52c4508003a 100644 --- a/app/graphql/resolvers/timelog_resolver.rb +++ b/app/graphql/resolvers/timelog_resolver.rb @@ -3,7 +3,6 @@ module Resolvers class TimelogResolver < BaseResolver include LooksAhead - include ResolvesIds type ::Types::TimelogType.connection_type, null: false @@ -100,14 +99,13 @@ module Resolvers def apply_project_filter(timelogs, args) return timelogs unless args[:project_id] - project = resolve_ids(args[:project_id], ::Types::GlobalIDType[::Project]) - timelogs.in_project(project) + timelogs.in_project(args[:project_id].model_id) end def apply_group_filter(timelogs, args) return timelogs unless args[:group_id] - group = Group.find_by_id(resolve_ids(args[:group_id], ::Types::GlobalIDType[::Group])) + group = Group.find_by_id(args[:group_id].model_id) timelogs.in_group(group) end diff --git a/app/graphql/resolvers/user_merge_requests_resolver_base.rb b/app/graphql/resolvers/user_merge_requests_resolver_base.rb index e0201e45664..b2d85307c49 100644 --- a/app/graphql/resolvers/user_merge_requests_resolver_base.rb +++ b/app/graphql/resolvers/user_merge_requests_resolver_base.rb @@ -57,9 +57,6 @@ module Resolvers end def load_project(project_path, project_id) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - project_id &&= ::Types::GlobalIDType[::Project].coerce_isolated_input(project_id) @project = ::Gitlab::Graphql::Lazy.force(resolve_project(full_path: project_path, project_id: project_id)) end diff --git a/app/graphql/resolvers/work_item_resolver.rb b/app/graphql/resolvers/work_item_resolver.rb index ad510849f31..9eb7d6bc693 100644 --- a/app/graphql/resolvers/work_item_resolver.rb +++ b/app/graphql/resolvers/work_item_resolver.rb @@ -20,9 +20,6 @@ module Resolvers private def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::WorkItem].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/subscriptions/issuable_updated.rb b/app/graphql/subscriptions/issuable_updated.rb index c1d82bfcf9c..ad78fd4b4a1 100644 --- a/app/graphql/subscriptions/issuable_updated.rb +++ b/app/graphql/subscriptions/issuable_updated.rb @@ -15,10 +15,6 @@ module Subscriptions end def authorized?(issuable_id:) - # TODO: remove this check when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - raise Gitlab::Graphql::Errors::ArgumentError, 'Invalid IssuableID' unless issuable_id.is_a?(GlobalID) - issuable = force(GitlabSchema.find_by_gid(issuable_id)) unauthorized! unless issuable && Ability.allowed?(current_user, :"read_#{issuable.to_ability_name}", issuable) diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb index 537b8e42ad1..81afc7f0f42 100644 --- a/app/graphql/types/ci/pipeline_type.rb +++ b/app/graphql/types/ci/pipeline_type.rb @@ -195,7 +195,6 @@ module Types raise ::Gitlab::Graphql::Errors::ArgumentError, 'One of id or name is required' unless id || name if id - id = ::Types::GlobalIDType[::CommitStatus].coerce_isolated_input(id) if id pipeline.statuses.id_in(id.model_id) else pipeline.statuses.by_name(name) diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index a1e73670bc9..67b3280c689 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -149,30 +149,22 @@ module Types end def issue(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::Issue].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end def merge_request(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::MergeRequest].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end def milestone(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[Milestone].coerce_isolated_input(id) + # This field coerces its ID, and thus allows the use of ID typed values. + # This should be removed when app/graphql/queries/burndown_chart/burnup.query.graphql + # has been fixed/removed and as part of !83457 + id = ::Types::GlobalIDType[Milestone].coerce_input(id, context) GitlabSchema.find_by_gid(id) end def container_repository(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = ::Types::GlobalIDType[::ContainerRepository].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end diff --git a/app/graphql/types/work_items/convert_task_input_type.rb b/app/graphql/types/work_items/convert_task_input_type.rb index 1f142c6815c..2e66c1c1b3f 100644 --- a/app/graphql/types/work_items/convert_task_input_type.rb +++ b/app/graphql/types/work_items/convert_task_input_type.rb @@ -24,10 +24,6 @@ module Types class << self def work_item_type_global_id(global_id) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - global_id = ::Types::GlobalIDType[::WorkItems::Type].coerce_isolated_input(global_id) - global_id&.model_id end end diff --git a/app/services/authorized_project_update/project_access_changed_service.rb b/app/services/authorized_project_update/project_access_changed_service.rb index 62bf4ced1ae..dafec1fef59 100644 --- a/app/services/authorized_project_update/project_access_changed_service.rb +++ b/app/services/authorized_project_update/project_access_changed_service.rb @@ -7,6 +7,8 @@ module AuthorizedProjectUpdate end def execute(blocking: true) + return if @project_ids.empty? + bulk_args = @project_ids.map { |id| [id] } if blocking diff --git a/app/services/groups/transfer_service.rb b/app/services/groups/transfer_service.rb index f2e959396bc..a0021ae2ccb 100644 --- a/app/services/groups/transfer_service.rb +++ b/app/services/groups/transfer_service.rb @@ -191,18 +191,9 @@ module Groups end def refresh_project_authorizations - projects_to_update = Set.new + project_ids = Groups::ProjectsRequiringAuthorizationsRefresh::OnTransferFinder.new(@group).execute - # All projects in this hierarchy need to have their project authorizations recalculated - @group.all_projects.each_batch { |prjs| projects_to_update.merge(prjs.ids) } # rubocop: disable CodeReuse/ActiveRecord - - # When a group is transferred, it also affects who gets access to the projects shared to - # the subgroups within its hierarchy, so we also schedule jobs that refresh authorizations for all such shared projects. - ProjectGroupLink.in_group(@group.self_and_descendants.select(:id)).each_batch do |project_group_links| - projects_to_update.merge(project_group_links.pluck(:project_id)) # rubocop: disable CodeReuse/ActiveRecord - end - - AuthorizedProjectUpdate::ProjectAccessChangedService.new(projects_to_update.to_a).execute unless projects_to_update.empty? + AuthorizedProjectUpdate::ProjectAccessChangedService.new(project_ids).execute end def raise_transfer_error(message) diff --git a/config/feature_flags/development/measure_service_ping_metric_collection.yml b/config/feature_flags/development/measure_service_ping_metric_collection.yml index f6af99220cf..c480bdedae6 100644 --- a/config/feature_flags/development/measure_service_ping_metric_collection.yml +++ b/config/feature_flags/development/measure_service_ping_metric_collection.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/358128 milestone: '15.0' type: development group: group::product intelligence -default_enabled: false +default_enabled: true diff --git a/doc/.vale/gitlab/VersionText.yml b/doc/.vale/gitlab/VersionText.yml index 0d8131f99a5..68753de60aa 100644 --- a/doc/.vale/gitlab/VersionText.yml +++ b/doc/.vale/gitlab/VersionText.yml @@ -16,7 +16,7 @@ # For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles extends: existence message: 'This introduced-in line is not formatted correctly.' -link: https://docs.gitlab.com/ee/development/documentation/styleguide/versions.html +link: https://docs.gitlab.com/ee/development/documentation/versions.html level: error scope: raw raw: diff --git a/doc/administration/job_logs.md b/doc/administration/job_logs.md index 5c6ea7f52eb..d2837bfa96e 100644 --- a/doc/administration/job_logs.md +++ b/doc/administration/job_logs.md @@ -177,7 +177,7 @@ Here is the detailed data flow: ### Limitations -- [Redis cluster is not supported](https://gitlab.com/gitlab-org/gitlab/-/issues/224171). +- [Redis Cluster is not supported](https://gitlab.com/gitlab-org/gitlab/-/issues/224171). - You must configure [object storage for CI/CD artifacts, logs, and builds](job_artifacts.md#object-storage-settings) before you enable the feature flag. After the flag is enabled, files cannot be written to disk, and there is no protection against misconfiguration. diff --git a/doc/api/plan_limits.md b/doc/api/plan_limits.md index 760f64894bb..0b6f89675d0 100644 --- a/doc/api/plan_limits.md +++ b/doc/api/plan_limits.md @@ -50,7 +50,8 @@ Example response: "npm_max_file_size": 524288000, "nuget_max_file_size": 524288000, "pypi_max_file_size": 3221225472, - "terraform_module_max_file_size": 1073741824 + "terraform_module_max_file_size": 1073741824, + "storage_size_limit": 15000 } ``` @@ -81,6 +82,7 @@ PUT /application/plan_limits | `nuget_max_file_size` | integer | no | Maximum NuGet package file size in bytes. | | `pypi_max_file_size` | integer | no | Maximum PyPI package file size in bytes. | | `terraform_module_max_file_size` | integer | no | Maximum Terraform Module package file size in bytes. | +| `storage_size_limit` | integer | no | Maximum storage size for the root namespace in megabytes. | ```shell curl --request PUT --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/application/plan_limits?plan_name=default&conan_max_file_size=3221225472" diff --git a/doc/development/fe_guide/style/html.md b/doc/development/fe_guide/style/html.md index 72492d56ee4..90ff88bc975 100644 --- a/doc/development/fe_guide/style/html.md +++ b/doc/development/fe_guide/style/html.md @@ -58,11 +58,9 @@ Button tags requires a `type` attribute according to the [W3C HTML specification ### Blank target -Avoid forcing links to open in a new window as this reduces the control the user has over the link. -However, it might be a good idea to use a blank target when replacing the current page with -the link makes the user lose content or progress. +Arbitrarily opening links in a new tab is not recommended, so refer to the [Pajamas guidelines on links](https://design.gitlab.com/product-foundations/interaction/#links) when considering adding `target="_blank"` to links. -Use `rel="noopener noreferrer"` whenever your links open in a new window, that is, `target="_blank"`. This prevents a security vulnerability [documented by JitBit](https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/). +When using `target="_blank"` with `a` tags, you must also add the `rel="noopener noreferrer"` attribute. This prevents a security vulnerability [documented by JitBit](https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/). When using `gl-link`, using `target="_blank"` is sufficient as it automatically adds `rel="noopener noreferrer"` to the link. diff --git a/doc/development/service_ping/index.md b/doc/development/service_ping/index.md index 8ba418767cb..585d65889c4 100644 --- a/doc/development/service_ping/index.md +++ b/doc/development/service_ping/index.md @@ -93,23 +93,53 @@ sequenceDiagram the required URL is . 1. In case of an error, it will be reported to the Version application along with following pieces of information: -- `uuid` - GitLab instance unique identifier -- `hostname` - GitLab instance hostname -- `version` - GitLab instance current versions -- `elapsed` - Amount of time which passed since Service Ping report process started and moment of error occurrence -- `message` - Error message + - `uuid` - GitLab instance unique identifier + - `hostname` - GitLab instance hostname + - `version` - GitLab instance current versions + - `elapsed` - Amount of time which passed since Service Ping report process started and moment of error occurrence + - `message` - Error message -
-
-{
-  "uuid"=>"02333324-1cd7-4c3b-a45b-a4993f05fb1d",
-  "hostname"=>"127.0.0.1",
-  "version"=>"14.7.0-pre",
-  "elapsed"=>0.006946,
-  "message"=>'PG::UndefinedColumn: ERROR:  column \"non_existent_attribute\" does not exist\nLINE 1: SELECT COUNT(non_existent_attribute) FROM \"issues\" /*applica...'
-}
-
-
+
+    
+    {
+      "uuid"=>"02333324-1cd7-4c3b-a45b-a4993f05fb1d",
+      "hostname"=>"127.0.0.1",
+      "version"=>"14.7.0-pre",
+      "elapsed"=>0.006946,
+      "message"=>'PG::UndefinedColumn: ERROR:  column \"non_existent_attribute\" does not exist\nLINE 1: SELECT COUNT(non_existent_attribute) FROM \"issues\" /*applica...'
+    }
+    
+    
+ +1. Finally, the timing metadata information that is used for diagnostic purposes is submitted to the Versions application. It consists of a list of metric identifiers and the time it took to calculate the metrics: + + > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37911) in GitLab 15.0 [with a flag(../../user/feature_flags.md), enabled by default. + +FLAG: +On self-managed GitLab, by default this feature is available. To hide the feature, ask an administrator to [disable the feature flag](../../administration/feature_flags.md) named `measure_service_ping_metric_collection`. +On GitLab.com, this feature is available. + +```ruby + {"metadata"=> + {"metrics"=> + [{"name"=>"version", "time_elapsed"=>1.1811964213848114e-05}, + {"name"=>"installation_type", "time_elapsed"=>0.00017242692410945892}, + {"name"=>"license_billable_users", "time_elapsed"=>0.009520471096038818}, + .... + {"name"=>"counts.clusters_platforms_eks", + "time_elapsed"=>0.05638605775311589}, + {"name"=>"counts.clusters_platforms_gke", + "time_elapsed"=>0.40995341585949063}, + {"name"=>"counts.clusters_platforms_user", + "time_elapsed"=>0.06410990096628666}, + {"name"=>"counts.clusters_management_project", + "time_elapsed"=>0.24020783510059118}, + {"name"=>"counts.clusters_integrations_elastic_stack", + "time_elapsed"=>0.03484998410567641} + ] + } + } + ``` ### On a Geo secondary site @@ -133,6 +163,25 @@ We also collect metrics specific to [Geo](../../administration/geo/index.md) sec ] ``` +### Enable or disable service ping metadata reporting + +Service Ping timing metadata reporting is under development but ready for production use. +It is deployed behind a feature flag that is **enabled by default**. +[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md) +can opt to disable it. + +To enable it: + +```ruby +Feature.enable(:measure_service_ping_metric_collection) +``` + +To disable it: + +```ruby +Feature.disable(:measure_service_ping_metric_collection) +``` + ## Implementing Service Ping See the [implement Service Ping](implement.md) guide. diff --git a/doc/install/installation.md b/doc/install/installation.md index b848417dce8..3d07d6d5320 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -197,7 +197,7 @@ can install it with: sudo apt-get install -y postfix ``` -Then select 'Internet Site' and press enter to confirm the hostname. +Then select 'Internet Site' and press Enter to confirm the hostname. diff --git a/doc/user/admin_area/index.md b/doc/user/admin_area/index.md index de36018e194..dc78229787c 100644 --- a/doc/user/admin_area/index.md +++ b/doc/user/admin_area/index.md @@ -326,7 +326,7 @@ To search runners' descriptions: 1. In the **Search or filter results...** field, type the description of the runner you want to find. -1. Press Enter. +1. Press Enter. You can also filter runners by status, type, and tag. To filter: diff --git a/doc/user/packages/maven_repository/index.md b/doc/user/packages/maven_repository/index.md index 6a515b78fc1..053548d545e 100644 --- a/doc/user/packages/maven_repository/index.md +++ b/doc/user/packages/maven_repository/index.md @@ -184,7 +184,7 @@ published to the GitLab Package Registry. Project name (default: test): ``` -1. Enter a project name or press Enter to use the directory name as project name. +1. Enter a project name or press Enter to use the directory name as project name. ## Authenticate to the Package Registry with Maven diff --git a/doc/user/project/members/index.md b/doc/user/project/members/index.md index ff4677eddde..28bd353d8cc 100644 --- a/doc/user/project/members/index.md +++ b/doc/user/project/members/index.md @@ -189,7 +189,7 @@ You can filter and sort members in a project. 1. On the top bar, select **Menu > Projects** and find your project. 1. On the left sidebar, select **Project information > Members**. 1. In the **Filter members** box, select `Membership` `=` `Inherited`. -1. Press Enter. +1. Press Enter. ![Project members filter inherited](img/project_members_filter_inherited_v14_4.png) @@ -198,7 +198,7 @@ You can filter and sort members in a project. 1. On the top bar, select **Menu > Projects** and find your project. 1. On the left sidebar, select **Project information > Members**. 1. In the **Filter members** box, select `Membership` `=` `Direct`. -1. Press Enter. +1. Press Enter. ![Project members filter direct](img/project_members_filter_direct_v14_4.png) diff --git a/doc/user/ssh.md b/doc/user/ssh.md index 78ba77fcc88..41f2d294e57 100644 --- a/doc/user/ssh.md +++ b/doc/user/ssh.md @@ -106,7 +106,7 @@ If you do not have an existing SSH key pair, generate a new one: ssh-keygen -t rsa -b 2048 -C "" ``` -1. Press Enter. Output similar to the following is displayed: +1. Press Enter. Output similar to the following is displayed: ```plaintext Generating public/private ed25519 key pair. @@ -172,7 +172,7 @@ You can update the passphrase for your SSH key: ssh-keygen -p -f /path/to/ssh_key ``` -1. At the prompts, enter the passphrase and then press Enter. +1. At the prompts, enter the passphrase and then press Enter. ### Upgrade your RSA key pair to a more secure format @@ -225,7 +225,7 @@ To generate ED25519_SK or ECDSA_SK SSH keys, you must use OpenSSH 8.2 or later: from the security key by [`ssh-add -K`](https://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/ssh-add.1#K) or [`ssh-keygen -K`](https://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/ssh-keygen#K). -1. Press Enter. Output similar to the following is displayed: +1. Press Enter. Output similar to the following is displayed: ```plaintext Generating public/private ed25519-sk key pair. @@ -325,7 +325,7 @@ The following commands use the example hostname `gitlab.example.com`. Replace th Warning: Permanently added 'gitlab.example.com' (ECDSA) to the list of known hosts. ``` - Type `yes` and press Enter. + Type `yes` and press Enter. 1. Run the `ssh -T git@gitlab.example.com` command again. You should receive a _Welcome to GitLab, `@username`!_ message. diff --git a/lib/api/admin/plan_limits.rb b/lib/api/admin/plan_limits.rb index 1dbcf812085..7ce70d85d46 100644 --- a/lib/api/admin/plan_limits.rb +++ b/lib/api/admin/plan_limits.rb @@ -51,6 +51,7 @@ module API optional :nuget_max_file_size, type: Integer, desc: 'Maximum NuGet package file size in bytes' optional :pypi_max_file_size, type: Integer, desc: 'Maximum PyPI package file size in bytes' optional :terraform_module_max_file_size, type: Integer, desc: 'Maximum Terraform Module package file size in bytes' + optional :storage_size_limit, type: Integer, desc: 'Maximum storage size for the root namespace in megabytes' end put "application/plan_limits" do params = declared_params(include_missing: false) diff --git a/lib/api/entities/plan_limit.rb b/lib/api/entities/plan_limit.rb index 33d59a4207c..94e50f19b35 100644 --- a/lib/api/entities/plan_limit.rb +++ b/lib/api/entities/plan_limit.rb @@ -19,6 +19,7 @@ module API expose :nuget_max_file_size expose :pypi_max_file_size expose :terraform_module_max_file_size + expose :storage_size_limit end end end diff --git a/spec/finders/groups/projects_requiring_authorizations_refresh/on_transfer_finder_spec.rb b/spec/finders/groups/projects_requiring_authorizations_refresh/on_transfer_finder_spec.rb new file mode 100644 index 00000000000..103cef44c94 --- /dev/null +++ b/spec/finders/groups/projects_requiring_authorizations_refresh/on_transfer_finder_spec.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Groups::ProjectsRequiringAuthorizationsRefresh::OnTransferFinder do + # rubocop:disable Layout/LineLength + + # Group X Group A ------shared with-------------> Group B Group C + # | Group X_subgroup_1 | | | + # | | Project X_subgroup_1 ---shared with----->| Group A_subgroup_1 | Group B_subgroup_1 <--shared with--------- | Group C_subgroup_1 + # | | | Project A_subgroup_1 | | Project B_subgroup_1 | | Project C_subgroup_1 + # | Group A_subgroup_2 | Group B_subgroup_2 <----shared with ------- Project C + # | |Project A_subgroup_2 | | Project B_subgroup_2 + + # rubocop:enable Layout/LineLength + + let_it_be(:group_x) { create(:group) } + let_it_be(:group_a) { create(:group) } + let_it_be(:group_b) { create(:group) } + let_it_be(:group_c) { create(:group) } + let_it_be(:group_x_subgroup_1) { create(:group, parent: group_x) } + let_it_be(:group_a_subgroup_1) { create(:group, parent: group_a) } + let_it_be(:group_a_subgroup_2) { create(:group, parent: group_a) } + let_it_be(:group_b_subgroup_1) { create(:group, parent: group_b) } + let_it_be(:group_b_subgroup_2) { create(:group, parent: group_b) } + let_it_be(:group_c_subgroup_1) { create(:group, parent: group_c) } + let_it_be(:project_x_subgroup_1) { create(:project, group: group_x_subgroup_1, name: 'project_x_subgroup_1') } + let_it_be(:project_a_subgroup_1) { create(:project, group: group_a_subgroup_1, name: 'project_a_subgroup_1') } + let_it_be(:project_a_subgroup_2) { create(:project, group: group_a_subgroup_2, name: 'project_a_subgroup_2') } + let_it_be(:project_b_subgroup_1) { create(:project, group: group_b_subgroup_1, name: 'project_b_subgroup_1') } + let_it_be(:project_b_subgroup_2) { create(:project, group: group_b_subgroup_2, name: 'project_b_subgroup_2') } + let_it_be(:project_c_subgroup_1) { create(:project, group: group_c_subgroup_1, name: 'project_c_subgroup_1') } + let_it_be(:project_c) { create(:project, group: group_c, name: 'project_c') } + + describe '#execute' do + context 'projects requiring authorizations refresh when a group is transferred (here, `Group B`)' do + subject(:result) { described_class.new(group_b).execute } + + before do + create(:project_group_link, project: project_x_subgroup_1, group: group_a_subgroup_1) + create(:project_group_link, project: project_c, group: group_b_subgroup_2) + create(:group_group_link, shared_group: group_a, shared_with_group: group_b) + create(:group_group_link, shared_group: group_c_subgroup_1, shared_with_group: group_b_subgroup_1) + end + + it 'includes only the expected projects' do + expected_projects = Project.id_in( + [ + project_b_subgroup_1, + project_b_subgroup_2, + project_c + ] + ) + + expect(result).to match_array(expected_projects.ids) + end + end + end +end diff --git a/spec/graphql/mutations/boards/update_spec.rb b/spec/graphql/mutations/boards/update_spec.rb index da3dfeecd4d..4785bc94624 100644 --- a/spec/graphql/mutations/boards/update_spec.rb +++ b/spec/graphql/mutations/boards/update_spec.rb @@ -29,14 +29,6 @@ RSpec.describe Mutations::Boards::Update do end end - context 'with invalid params' do - it 'raises an error' do - mutation_params[:id] = project.to_global_id - - expect { subject }.to raise_error(::GraphQL::CoercionError) - end - end - context 'when user can update board' do before do board.resource_parent.add_reporter(user) diff --git a/spec/graphql/mutations/ci/runner/delete_spec.rb b/spec/graphql/mutations/ci/runner/delete_spec.rb index ee640b21918..06d360430f8 100644 --- a/spec/graphql/mutations/ci/runner/delete_spec.rb +++ b/spec/graphql/mutations/ci/runner/delete_spec.rb @@ -44,14 +44,6 @@ RSpec.describe Mutations::Ci::Runner::Delete do end end - context 'with invalid params' do - let(:mutation_params) { { id: "invalid-id" } } - - it 'raises an error' do - expect { subject }.to raise_error(::GraphQL::CoercionError) - end - end - context 'when required arguments are missing' do let(:mutation_params) { {} } diff --git a/spec/graphql/mutations/ci/runner/update_spec.rb b/spec/graphql/mutations/ci/runner/update_spec.rb index 0b3489d37dc..75e9b57e60a 100644 --- a/spec/graphql/mutations/ci/runner/update_spec.rb +++ b/spec/graphql/mutations/ci/runner/update_spec.rb @@ -33,14 +33,6 @@ RSpec.describe Mutations::Ci::Runner::Update do end end - context 'with invalid params' do - it 'raises an error' do - mutation_params[:id] = "invalid-id" - - expect { subject }.to raise_error(::GraphQL::CoercionError) - end - end - context 'when required arguments are missing' do let(:mutation_params) { {} } diff --git a/spec/graphql/mutations/clusters/agent_tokens/create_spec.rb b/spec/graphql/mutations/clusters/agent_tokens/create_spec.rb index fc025c8e3d3..45d421509d0 100644 --- a/spec/graphql/mutations/clusters/agent_tokens/create_spec.rb +++ b/spec/graphql/mutations/clusters/agent_tokens/create_spec.rb @@ -48,14 +48,6 @@ RSpec.describe Mutations::Clusters::AgentTokens::Create do expect(token.description).to eq(description) expect(token.name).to eq(name) end - - context 'invalid params' do - subject { mutation.resolve(cluster_agent_id: cluster_agent.id) } - - it 'generates an error message when id invalid', :aggregate_failures do - expect { subject }.to raise_error(::GraphQL::CoercionError) - end - end end end end diff --git a/spec/graphql/mutations/clusters/agent_tokens/revoke_spec.rb b/spec/graphql/mutations/clusters/agent_tokens/revoke_spec.rb index f5f4c0cefad..1dd4eece246 100644 --- a/spec/graphql/mutations/clusters/agent_tokens/revoke_spec.rb +++ b/spec/graphql/mutations/clusters/agent_tokens/revoke_spec.rb @@ -40,16 +40,6 @@ RSpec.describe Mutations::Clusters::AgentTokens::Revoke do expect(token.reload).to be_revoked end - - context 'supplied ID is invalid' do - let(:global_id) { token.id } - - it 'raises a coercion error' do - expect { subject }.to raise_error(::GraphQL::CoercionError) - - expect(token.reload).not_to be_revoked - end - end end end end diff --git a/spec/graphql/mutations/clusters/agents/delete_spec.rb b/spec/graphql/mutations/clusters/agents/delete_spec.rb index 0aabf53391a..e0ecff5fe44 100644 --- a/spec/graphql/mutations/clusters/agents/delete_spec.rb +++ b/spec/graphql/mutations/clusters/agents/delete_spec.rb @@ -38,14 +38,5 @@ RSpec.describe Mutations::Clusters::Agents::Delete do expect { cluster_agent.reload }.to raise_error(ActiveRecord::RecordNotFound) end end - - context 'with invalid params' do - subject { mutation.resolve(id: cluster_agent.id) } - - it 'raises an error if the cluster agent id is invalid', :aggregate_failures do - expect { subject }.to raise_error(::GraphQL::CoercionError) - expect { cluster_agent.reload }.not_to raise_error - end - end end end diff --git a/spec/graphql/mutations/container_repositories/destroy_spec.rb b/spec/graphql/mutations/container_repositories/destroy_spec.rb index 7c674dddb15..97da7846339 100644 --- a/spec/graphql/mutations/container_repositories/destroy_spec.rb +++ b/spec/graphql/mutations/container_repositories/destroy_spec.rb @@ -57,11 +57,5 @@ RSpec.describe Mutations::ContainerRepositories::Destroy do it_behaves_like params[:shared_examples_name] end end - - context 'with invalid id' do - let(:id) { 'gid://gitlab/ContainerRepository/5555' } - - it_behaves_like 'denying access to container respository' - end end end diff --git a/spec/graphql/mutations/discussions/toggle_resolve_spec.rb b/spec/graphql/mutations/discussions/toggle_resolve_spec.rb index e5dc6f85c2a..3f7347798e5 100644 --- a/spec/graphql/mutations/discussions/toggle_resolve_spec.rb +++ b/spec/graphql/mutations/discussions/toggle_resolve_spec.rb @@ -48,17 +48,6 @@ RSpec.describe Mutations::Discussions::ToggleResolve do end end - context 'when discussion is not a Discussion' do - let(:discussion) { create(:note, noteable: noteable, project: project) } - - it 'raises an error' do - expect { subject }.to raise_error( - GraphQL::CoercionError, - "\"#{global_id_of(discussion)}\" does not represent an instance of Discussion" - ) - end - end - shared_examples 'returns a resolved discussion without errors' do it 'returns a resolved discussion' do expect(mutated_discussion).to be_resolved diff --git a/spec/graphql/mutations/environments/canary_ingress/update_spec.rb b/spec/graphql/mutations/environments/canary_ingress/update_spec.rb index e719ca050a8..b93fb36a8ff 100644 --- a/spec/graphql/mutations/environments/canary_ingress/update_spec.rb +++ b/spec/graphql/mutations/environments/canary_ingress/update_spec.rb @@ -62,14 +62,6 @@ RSpec.describe Mutations::Environments::CanaryIngress::Update do end end - context 'when environment is not found' do - let(:environment_id) { non_existing_record_id.to_s } - - it 'raises an error' do - expect { subject }.to raise_error(GraphQL::CoercionError) - end - end - context 'when user is reporter who does not have permission to access the environment' do let(:user) { reporter } diff --git a/spec/graphql/mutations/release_asset_links/delete_spec.rb b/spec/graphql/mutations/release_asset_links/delete_spec.rb index 67576bdda57..cca7bd2ba38 100644 --- a/spec/graphql/mutations/release_asset_links/delete_spec.rb +++ b/spec/graphql/mutations/release_asset_links/delete_spec.rb @@ -60,14 +60,6 @@ RSpec.describe Mutations::ReleaseAssetLinks::Delete do expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable) end end - - context "when the provided ID is invalid" do - let(:mutation_arguments) { super().merge(id: 'not-a-valid-gid') } - - it 'raises an error' do - expect { subject }.to raise_error(::GraphQL::CoercionError) - end - end end context 'when the current user does not have access to delete the link' do diff --git a/spec/graphql/mutations/release_asset_links/update_spec.rb b/spec/graphql/mutations/release_asset_links/update_spec.rb index cb7474123ad..e119cf9cc77 100644 --- a/spec/graphql/mutations/release_asset_links/update_spec.rb +++ b/spec/graphql/mutations/release_asset_links/update_spec.rb @@ -194,13 +194,5 @@ RSpec.describe Mutations::ReleaseAssetLinks::Update do expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable) end end - - context "when the provided ID is invalid" do - let(:mutation_arguments) { super().merge(id: 'not-a-valid-gid') } - - it 'raises an error' do - expect { subject }.to raise_error(::GraphQL::CoercionError) - end - end end end diff --git a/spec/graphql/mutations/todos/create_spec.rb b/spec/graphql/mutations/todos/create_spec.rb index bbb033e2f33..8c6dca98bad 100644 --- a/spec/graphql/mutations/todos/create_spec.rb +++ b/spec/graphql/mutations/todos/create_spec.rb @@ -10,12 +10,19 @@ RSpec.describe Mutations::Todos::Create do context 'when target does not support todos' do it 'raises error' do current_user = create(:user) - mutation = described_class.new(object: nil, context: { current_user: current_user }, field: nil) - target = create(:milestone) - expect { mutation.resolve(target_id: global_id_of(target)) } - .to raise_error(GraphQL::CoercionError) + ctx = { current_user: current_user } + input = { target_id: global_id_of(target).to_s } + mutation = graphql_mutation(described_class, input) + + response = GitlabSchema.execute(mutation.query, context: ctx, variables: mutation.variables).to_h + + expect(response).to include( + 'errors' => contain_exactly( + include('message' => /invalid value for targetId/) + ) + ) end end diff --git a/spec/graphql/mutations/todos/mark_done_spec.rb b/spec/graphql/mutations/todos/mark_done_spec.rb index 9723ac8af42..51df2032cf1 100644 --- a/spec/graphql/mutations/todos/mark_done_spec.rb +++ b/spec/graphql/mutations/todos/mark_done_spec.rb @@ -56,15 +56,6 @@ RSpec.describe Mutations::Todos::MarkDone do expect(todo2.reload.state).to eq('done') expect(other_user_todo.reload.state).to eq('pending') end - - it 'ignores invalid GIDs' do - expect { mutation.resolve(id: author.to_global_id.to_s) } - .to raise_error(::GraphQL::CoercionError) - - expect(todo1.reload.state).to eq('pending') - expect(todo2.reload.state).to eq('done') - expect(other_user_todo.reload.state).to eq('pending') - end end def mark_done_mutation(todo) diff --git a/spec/graphql/mutations/todos/restore_many_spec.rb b/spec/graphql/mutations/todos/restore_many_spec.rb index dc10355ef22..d43f1c8a2e9 100644 --- a/spec/graphql/mutations/todos/restore_many_spec.rb +++ b/spec/graphql/mutations/todos/restore_many_spec.rb @@ -49,13 +49,6 @@ RSpec.describe Mutations::Todos::RestoreMany do expect_states_were_not_changed end - it 'raises an error with invalid or non-Todo GIDs' do - expect { mutation.resolve(ids: [author.to_global_id.to_s]) } - .to raise_error(GraphQL::CoercionError) - - expect_states_were_not_changed - end - it 'restores multiple todos' do todo4 = create(:todo, user: current_user, author: author, state: :done) diff --git a/spec/graphql/mutations/todos/restore_spec.rb b/spec/graphql/mutations/todos/restore_spec.rb index 954bb3db668..fad9d6c08a6 100644 --- a/spec/graphql/mutations/todos/restore_spec.rb +++ b/spec/graphql/mutations/todos/restore_spec.rb @@ -56,15 +56,6 @@ RSpec.describe Mutations::Todos::Restore do expect(todo2.reload.state).to eq('pending') expect(other_user_todo.reload.state).to eq('done') end - - it 'raises error for invalid GID' do - expect { mutation.resolve(id: author.to_global_id.to_s) } - .to raise_error(::GraphQL::CoercionError) - - expect(todo1.reload.state).to eq('done') - expect(todo2.reload.state).to eq('pending') - expect(other_user_todo.reload.state).to eq('done') - end end def restore_mutation(todo) diff --git a/spec/graphql/resolvers/concerns/resolves_ids_spec.rb b/spec/graphql/resolvers/concerns/resolves_ids_spec.rb index 732b7cd2bbc..84741b7a603 100644 --- a/spec/graphql/resolvers/concerns/resolves_ids_spec.rb +++ b/spec/graphql/resolvers/concerns/resolves_ids_spec.rb @@ -10,7 +10,6 @@ RSpec.describe ResolvesIds do # gid://gitlab/Project/6 gid://gitlab/Issue/6 context 'with a single project' do let(:ids) { global_id_of(model_name: 'Project', id: 6) } - let(:type) { ::Types::GlobalIDType[::Project] } it 'returns the correct array' do expect(resolve_ids).to contain_exactly('6') @@ -19,7 +18,6 @@ RSpec.describe ResolvesIds do context 'with a single issue' do let(:ids) { global_id_of(model_name: 'Issue', id: 9) } - let(:type) { ::Types::GlobalIDType[::Issue] } it 'returns the correct array' do expect(resolve_ids).to contain_exactly('9') @@ -28,7 +26,6 @@ RSpec.describe ResolvesIds do context 'with multiple users' do let(:ids) { [7, 13, 21].map { global_id_of(model_name: 'User', id: _1) } } - let(:type) { ::Types::GlobalIDType[::User] } it 'returns the correct array' do expect(resolve_ids).to eq %w[7 13 21] @@ -40,6 +37,6 @@ RSpec.describe ResolvesIds do end def resolve_ids - mock_resolver.resolve_ids(ids, type) + mock_resolver.resolve_ids(ids) end end diff --git a/spec/graphql/resolvers/design_management/design_resolver_spec.rb b/spec/graphql/resolvers/design_management/design_resolver_spec.rb index 5b530b68a5b..0915dddf438 100644 --- a/spec/graphql/resolvers/design_management/design_resolver_spec.rb +++ b/spec/graphql/resolvers/design_management/design_resolver_spec.rb @@ -71,15 +71,6 @@ RSpec.describe Resolvers::DesignManagement::DesignResolver do expect(resolve_design).to be_nil end end - - context 'the ID does not belong to a design at all' do - let(:args) { { id: global_id_of(issue) } } - let(:msg) { /does not represent an instance of DesignManagement::Design/ } - - it 'complains meaningfully' do - expect { resolve_design }.to raise_error(msg) - end - end end context 'by filename' do diff --git a/spec/graphql/resolvers/design_management/version_in_collection_resolver_spec.rb b/spec/graphql/resolvers/design_management/version_in_collection_resolver_spec.rb index 8b9874c3580..00f37a8e5f6 100644 --- a/spec/graphql/resolvers/design_management/version_in_collection_resolver_spec.rb +++ b/spec/graphql/resolvers/design_management/version_in_collection_resolver_spec.rb @@ -50,15 +50,6 @@ RSpec.describe Resolvers::DesignManagement::VersionInCollectionResolver do it { is_expected.to be_nil } end - - context 'we pass the id of something that is not a design_version' do - let(:params) { { id: global_id_of(project) } } - let(:appropriate_error) { ::GraphQL::CoercionError } - - it 'raises an appropriate error' do - expect { result }.to raise_error(appropriate_error) - end - end end def resolve_version(obj, context = { current_user: current_user }) diff --git a/spec/graphql/resolvers/error_tracking/sentry_detailed_error_resolver_spec.rb b/spec/graphql/resolvers/error_tracking/sentry_detailed_error_resolver_spec.rb index 4b34a750883..f80b33e644e 100644 --- a/spec/graphql/resolvers/error_tracking/sentry_detailed_error_resolver_spec.rb +++ b/spec/graphql/resolvers/error_tracking/sentry_detailed_error_resolver_spec.rb @@ -57,14 +57,6 @@ RSpec.describe Resolvers::ErrorTracking::SentryDetailedErrorResolver do expect(result).to be_nil end end - - context 'with blank id' do - let(:args) { { id: '' } } - - it 'responds with an error' do - expect { resolve_error(args) }.to raise_error(::GraphQL::CoercionError) - end - end end private diff --git a/spec/graphql/resolvers/package_pipelines_resolver_spec.rb b/spec/graphql/resolvers/package_pipelines_resolver_spec.rb index 2fbe07b4465..26ed4ba8990 100644 --- a/spec/graphql/resolvers/package_pipelines_resolver_spec.rb +++ b/spec/graphql/resolvers/package_pipelines_resolver_spec.rb @@ -11,7 +11,7 @@ RSpec.describe Resolvers::PackagePipelinesResolver do let(:user) { package.project.first_owner } describe '#resolve' do - let(:returned_pipeline_ids) { graphql_dig_at(subject, 'data', 'package', 'pipelines', 'nodes', 'id') } + let(:returned_pipelines) { graphql_dig_at(subject, 'data', 'package', 'pipelines', 'nodes') } let(:returned_errors) { graphql_dig_at(subject, 'errors', 'message') } let(:pagination_args) { {} } let(:query) do @@ -90,7 +90,7 @@ RSpec.describe Resolvers::PackagePipelinesResolver do let_it_be(:user) { create(:user) } it 'returns nothing' do - expect(returned_pipeline_ids).to eq(nil) + expect(returned_pipelines).to be_nil end end @@ -98,8 +98,8 @@ RSpec.describe Resolvers::PackagePipelinesResolver do let_it_be_with_reload(:other_package) { create(:package, project: package.project) } let_it_be(:other_pipelines) { create_list(:ci_pipeline, 3, project: package.project) } - let(:returned_pipeline_ids) do - graphql_dig_at(subject, 'data', 'project', 'packages', 'nodes', 'pipelines', 'nodes', 'id') + let(:returned_pipelines) do + graphql_dig_at(subject, 'data', 'project', 'packages', 'nodes', 'pipelines', 'nodes') end let(:query) do @@ -175,8 +175,8 @@ RSpec.describe Resolvers::PackagePipelinesResolver do end def expect_to_contain_exactly(*pipelines) - ids = pipelines.map { |pipeline| global_id_of(pipeline) } - expect(returned_pipeline_ids).to contain_exactly(*ids) + entities = pipelines.map { |pipeline| a_graphql_entity_for(pipeline) } + expect(returned_pipelines).to match_array(entities) end def expect_detect_mode(modes) diff --git a/spec/graphql/resolvers/projects/snippets_resolver_spec.rb b/spec/graphql/resolvers/projects/snippets_resolver_spec.rb index b963f2509db..1d04db3ea6e 100644 --- a/spec/graphql/resolvers/projects/snippets_resolver_spec.rb +++ b/spec/graphql/resolvers/projects/snippets_resolver_spec.rb @@ -58,12 +58,6 @@ RSpec.describe Resolvers::Projects::SnippetsResolver do expect(snippets).to contain_exactly(project_snippet, other_project_snippet) end - - it 'returns an error if the gid is invalid' do - expect do - resolve_snippets(args: { ids: ['foo'] }) - end.to raise_error(GraphQL::CoercionError) - end end context 'when no project is provided' do diff --git a/spec/graphql/resolvers/snippets_resolver_spec.rb b/spec/graphql/resolvers/snippets_resolver_spec.rb index f9feb8901cd..ee9a6e67243 100644 --- a/spec/graphql/resolvers/snippets_resolver_spec.rb +++ b/spec/graphql/resolvers/snippets_resolver_spec.rb @@ -40,12 +40,6 @@ RSpec.describe Resolvers::SnippetsResolver do expect(snippets).to contain_exactly(personal_snippet, project_snippet) end - - it 'returns an error if the param id is invalid' do - expect do - resolve_snippets(args: { author_id: 'foo' }) - end.to raise_error(GraphQL::CoercionError) - end end it 'returns the snippets by type' do @@ -61,12 +55,6 @@ RSpec.describe Resolvers::SnippetsResolver do expect(snippets).to contain_exactly(project_snippet, other_project_snippet) end - - it 'returns an error if the param id is invalid' do - expect do - resolve_snippets(args: { project_id: 'foo' }) - end.to raise_error(GraphQL::CoercionError) - end end it 'returns the snippets by visibility' do @@ -98,16 +86,6 @@ RSpec.describe Resolvers::SnippetsResolver do expect(found).to match_array(snippets) end - it 'returns an error if the id cannot be coerced' do - args = { - ids: [personal_snippet.to_global_id, 'foo'] - } - - expect do - resolve_snippets(args: args) - end.to raise_error(GraphQL::CoercionError, '"foo" is not a valid Global ID') - end - it 'generates an error if both project and author are provided' do expect_graphql_error_to_be_created(Gitlab::Graphql::Errors::ArgumentError) do args = { diff --git a/spec/graphql/resolvers/users/snippets_resolver_spec.rb b/spec/graphql/resolvers/users/snippets_resolver_spec.rb index 04fe3213a99..12baed2560e 100644 --- a/spec/graphql/resolvers/users/snippets_resolver_spec.rb +++ b/spec/graphql/resolvers/users/snippets_resolver_spec.rb @@ -64,16 +64,6 @@ RSpec.describe Resolvers::Users::SnippetsResolver do expect(found).to match_array(snippets) end - - it 'returns an error if the gid is invalid' do - args = { - ids: [global_id_of(private_personal_snippet), 'foo'] - } - - expect do - resolve_snippets(args: args) - end.to raise_error(GraphQL::CoercionError) - end end context 'when user profile is private' do diff --git a/spec/graphql/subscriptions/issuable_updated_spec.rb b/spec/graphql/subscriptions/issuable_updated_spec.rb index c15b4f532ef..0b8fcf67513 100644 --- a/spec/graphql/subscriptions/issuable_updated_spec.rb +++ b/spec/graphql/subscriptions/issuable_updated_spec.rb @@ -39,14 +39,6 @@ RSpec.describe Subscriptions::IssuableUpdated do expect { subject }.to raise_error(GraphQL::ExecutionError) end end - - context 'when a GraphQL::Types::ID is provided' do - let(:issuable_id) { issue.to_gid.to_s } - - it 'raises an exception' do - expect { subject }.to raise_error(Gitlab::Graphql::Errors::ArgumentError) - end - end end context 'subscription updates' do diff --git a/spec/graphql/types/current_user_todos_type_spec.rb b/spec/graphql/types/current_user_todos_type_spec.rb index 91628077c19..4ce97e1c006 100644 --- a/spec/graphql/types/current_user_todos_type_spec.rb +++ b/spec/graphql/types/current_user_todos_type_spec.rb @@ -178,22 +178,22 @@ RSpec.describe GitlabSchema.types['CurrentUserTodos'] do raise_on_error: true).to_h expect(result.dig('data', 'a', 'todos', 'nodes')).to contain_exactly( - { "id" => global_id_of(todo_a) }, - { "id" => global_id_of(todo_b) } + a_graphql_entity_for(todo_a), + a_graphql_entity_for(todo_b) ) expect(result.dig('data', 'b', 'todos', 'nodes')).to contain_exactly( - { "id" => global_id_of(todo_c) }, - { "id" => global_id_of(todo_d) } + a_graphql_entity_for(todo_c), + a_graphql_entity_for(todo_d) ) expect(result.dig('data', 'c', 'todos', 'nodes')).to contain_exactly( - { "id" => global_id_of(todo_e) } + a_graphql_entity_for(todo_e) ) expect(result.dig('data', 'd', 'todos', 'nodes')).to contain_exactly( - { "id" => global_id_of(todo_e) } + a_graphql_entity_for(todo_e) ) expect(result.dig('data', 'e', 'todos', 'nodes')).to contain_exactly( - { "id" => global_id_of(todo_a) }, - { "id" => global_id_of(todo_b) } + a_graphql_entity_for(todo_a), + a_graphql_entity_for(todo_b) ) end @@ -203,13 +203,13 @@ RSpec.describe GitlabSchema.types['CurrentUserTodos'] do graphql: with_state_arguments).to_h expect(result.dig('data', 'a', 'todos', 'nodes')).to contain_exactly( - include("id" => global_id_of(todo_a)) + a_graphql_entity_for(todo_a) ) expect(result.dig('data', 'b', 'todos', 'nodes')).to contain_exactly( - include("id" => global_id_of(todo_d)) + a_graphql_entity_for(todo_d) ) expect(result.dig('data', 'c', 'todos', 'nodes')).to contain_exactly( - include("id" => global_id_of(todo_e)) + a_graphql_entity_for(todo_e) ) end end diff --git a/spec/graphql/types/duration_type_spec.rb b/spec/graphql/types/duration_type_spec.rb index 5b88819f157..4199e6cc41b 100644 --- a/spec/graphql/types/duration_type_spec.rb +++ b/spec/graphql/types/duration_type_spec.rb @@ -17,11 +17,6 @@ RSpec.describe GitlabSchema.types['Duration'] do expect(described_class.coerce_isolated_input(0.5)).to eq(0.5) end - it 'rejects invalid input' do - expect { described_class.coerce_isolated_input('not valid') } - .to raise_error(GraphQL::CoercionError) - end - it 'rejects nil' do expect { described_class.coerce_isolated_input(nil) } .to raise_error(GraphQL::CoercionError) diff --git a/spec/lib/api/entities/plan_limit_spec.rb b/spec/lib/api/entities/plan_limit_spec.rb index 0f38d119088..a88ea3f4cad 100644 --- a/spec/lib/api/entities/plan_limit_spec.rb +++ b/spec/lib/api/entities/plan_limit_spec.rb @@ -24,7 +24,8 @@ RSpec.describe API::Entities::PlanLimit do :npm_max_file_size, :nuget_max_file_size, :pypi_max_file_size, - :terraform_module_max_file_size + :terraform_module_max_file_size, + :storage_size_limit ) end diff --git a/spec/requests/api/admin/plan_limits_spec.rb b/spec/requests/api/admin/plan_limits_spec.rb index 855a0ae0c0a..74ea3b0973f 100644 --- a/spec/requests/api/admin/plan_limits_spec.rb +++ b/spec/requests/api/admin/plan_limits_spec.rb @@ -39,6 +39,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do expect(json_response['nuget_max_file_size']).to eq(Plan.default.actual_limits.nuget_max_file_size) expect(json_response['pypi_max_file_size']).to eq(Plan.default.actual_limits.pypi_max_file_size) expect(json_response['terraform_module_max_file_size']).to eq(Plan.default.actual_limits.terraform_module_max_file_size) + expect(json_response['storage_size_limit']).to eq(Plan.default.actual_limits.storage_size_limit) end end @@ -68,6 +69,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do expect(json_response['nuget_max_file_size']).to eq(Plan.default.actual_limits.nuget_max_file_size) expect(json_response['pypi_max_file_size']).to eq(Plan.default.actual_limits.pypi_max_file_size) expect(json_response['terraform_module_max_file_size']).to eq(Plan.default.actual_limits.terraform_module_max_file_size) + expect(json_response['storage_size_limit']).to eq(Plan.default.actual_limits.storage_size_limit) end end @@ -115,7 +117,8 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do 'npm_max_file_size': 40, 'nuget_max_file_size': 50, 'pypi_max_file_size': 60, - 'terraform_module_max_file_size': 70 + 'terraform_module_max_file_size': 70, + 'storage_size_limit': 80 } expect(response).to have_gitlab_http_status(:ok) @@ -136,6 +139,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do expect(json_response['nuget_max_file_size']).to eq(50) expect(json_response['pypi_max_file_size']).to eq(60) expect(json_response['terraform_module_max_file_size']).to eq(70) + expect(json_response['storage_size_limit']).to eq(80) end it 'updates single plan limits' do @@ -178,7 +182,8 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do 'npm_max_file_size': 'd', 'nuget_max_file_size': 'e', 'pypi_max_file_size': 'f', - 'terraform_module_max_file_size': 'g' + 'terraform_module_max_file_size': 'g', + 'storage_size_limit': 'j' } expect(response).to have_gitlab_http_status(:bad_request) @@ -198,7 +203,8 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do 'npm_max_file_size is invalid', 'nuget_max_file_size is invalid', 'pypi_max_file_size is invalid', - 'terraform_module_max_file_size is invalid' + 'terraform_module_max_file_size is invalid', + 'storage_size_limit is invalid' ) end end diff --git a/spec/requests/api/graphql/users_spec.rb b/spec/requests/api/graphql/users_spec.rb index a6bbfc75451..79ee3c2cb57 100644 --- a/spec/requests/api/graphql/users_spec.rb +++ b/spec/requests/api/graphql/users_spec.rb @@ -114,7 +114,7 @@ RSpec.describe 'Users' do end context 'when sorting by created_at' do - let_it_be(:ascending_users) { [user3, user2, user1, user0].map { |u| global_id_of(u) } } + let_it_be(:ascending_users) { [user3, user2, user1, user0].map { |u| global_id_of(u).to_s } } context 'when ascending' do it_behaves_like 'sorted paginated query' do diff --git a/spec/services/groups/transfer_service_spec.rb b/spec/services/groups/transfer_service_spec.rb index 1c4b7aac87e..20ea8b2bf1b 100644 --- a/spec/services/groups/transfer_service_spec.rb +++ b/spec/services/groups/transfer_service_spec.rb @@ -574,7 +574,7 @@ RSpec.describe Groups::TransferService, :sidekiq_inline do context 'resets project authorizations' do let_it_be(:old_parent_group) { create(:group) } - let_it_be_with_reload(:group) { create(:group, :private, parent: old_parent_group) } + let_it_be_with_refind(:group) { create(:group, :private, parent: old_parent_group) } let_it_be(:new_group_member) { create(:user) } let_it_be(:old_group_member) { create(:user) } let_it_be(:unique_subgroup_member) { create(:user) } diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb index eb0e5a25733..34383b363d2 100644 --- a/spec/support/helpers/graphql_helpers.rb +++ b/spec/support/helpers/graphql_helpers.rb @@ -663,9 +663,9 @@ module GraphqlHelpers def global_id_of(model = nil, id: nil, model_name: nil) if id || model_name - ::Gitlab::GlobalId.as_global_id(id || model.id, model_name: model_name || model.class.name).to_s + ::Gitlab::GlobalId.as_global_id(id || model.id, model_name: model_name || model.class.name) else - model.to_global_id.to_s + model.to_global_id end end @@ -776,7 +776,7 @@ module GraphqlHelpers raise ArgumentError, 'model is nil' if model.nil? && fields.any? attrs.transform_keys! { GraphqlHelpers.fieldnamerize(_1) } - attrs['id'] = global_id_of(model) if model + attrs['id'] = global_id_of(model).to_s if model fields.each do |name| attrs[GraphqlHelpers.fieldnamerize(name)] = model.public_send(name) end diff --git a/spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb b/spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb index da9d254039b..e534a02e562 100644 --- a/spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb @@ -67,11 +67,15 @@ RSpec.shared_examples 'group and project boards query' do let(:sort_param) { } let(:first_param) { 2 } + def pagination_results_data(nodes) + nodes + end + let(:all_records) do if board_parent.multiple_issue_boards_available? - boards.map { |board| global_id_of(board) } + boards.map { |board| a_graphql_entity_for(board) } else - [global_id_of(boards.first)] + [a_graphql_entity_for(boards.first)] end end end diff --git a/spec/support/shared_examples/requests/api/graphql/noteable_shared_examples.rb b/spec/support/shared_examples/requests/api/graphql/noteable_shared_examples.rb index 31f2519a132..9033a8b4d3a 100644 --- a/spec/support/shared_examples/requests/api/graphql/noteable_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/graphql/noteable_shared_examples.rb @@ -14,7 +14,7 @@ RSpec.shared_examples 'a noteable graphql type we can query' do noteable.discussions.map do |discussion| a_graphql_entity_for( discussion, - 'replyId' => global_id_of(discussion, id: discussion.reply_id), + 'replyId' => global_id_of(discussion, id: discussion.reply_id).to_s, 'createdAt' => discussion.created_at.iso8601, 'notes' => include( 'nodes' => have_attributes(size: discussion.notes.size) diff --git a/spec/support_specs/helpers/graphql_helpers_spec.rb b/spec/support_specs/helpers/graphql_helpers_spec.rb index 0f9918351e2..f567097af6f 100644 --- a/spec/support_specs/helpers/graphql_helpers_spec.rb +++ b/spec/support_specs/helpers/graphql_helpers_spec.rb @@ -41,7 +41,7 @@ RSpec.describe GraphqlHelpers do context 'with just a model' do it 'only considers the ID' do user = build_stubbed(:user) - response = { 'username' => 'foo', 'id' => global_id_of(user) } + response = { 'username' => 'foo', 'id' => global_id_of(user).to_s } expect(response).to match a_graphql_entity_for(user) end @@ -50,7 +50,7 @@ RSpec.describe GraphqlHelpers do context 'with a model and some method names' do it 'also considers the method names' do user = build_stubbed(:user) - response = { 'username' => user.username, 'id' => global_id_of(user) } + response = { 'username' => user.username, 'id' => global_id_of(user).to_s } expect(response).to match a_graphql_entity_for(user, :username) expect(response).not_to match a_graphql_entity_for(user, :name) @@ -60,7 +60,7 @@ RSpec.describe GraphqlHelpers do context 'with a model and some other properties' do it 'behaves like the superset' do user = build_stubbed(:user) - response = { 'username' => 'foo', 'id' => global_id_of(user) } + response = { 'username' => 'foo', 'id' => global_id_of(user).to_s } expect(response).to match a_graphql_entity_for(user, username: 'foo') expect(response).not_to match a_graphql_entity_for(user, name: 'foo') @@ -75,7 +75,7 @@ RSpec.describe GraphqlHelpers do 'name' => user.name, 'foo' => 'bar', 'baz' => 'fop', - 'id' => global_id_of(user) + 'id' => global_id_of(user).to_s } expect(response).to match a_graphql_entity_for(user, :username, :name, foo: 'bar') diff --git a/spec/tooling/danger/specs_spec.rb b/spec/tooling/danger/specs_spec.rb index b2454960a7b..6c1fbbb903d 100644 --- a/spec/tooling/danger/specs_spec.rb +++ b/spec/tooling/danger/specs_spec.rb @@ -118,7 +118,8 @@ RSpec.describe Tooling::Danger::Specs do "- expect(foo).to match(['bar'])", "- expect(foo).to match ['bar']", "- expect(foo).to eq(['bar'])", - "- expect(foo).to eq ['bar']" + "- expect(foo).to eq ['bar']", + "+ expect(foo).to eq([])" ] + matching_lines end @@ -126,7 +127,7 @@ RSpec.describe Tooling::Danger::Specs do allow(specs.helper).to receive(:changed_lines).with(filename).and_return(changed_lines) end - it 'returns added, modified, and renamed_after files by default' do + it 'returns all lines using an array equality matcher' do expect(specs.added_line_matching_match_with_array(filename)).to match_array(matching_lines) end end diff --git a/tooling/danger/specs.rb b/tooling/danger/specs.rb index 466230bb86b..36ec83dd7d2 100644 --- a/tooling/danger/specs.rb +++ b/tooling/danger/specs.rb @@ -5,7 +5,7 @@ module Tooling module Specs SPEC_FILES_REGEX = 'spec/' EE_PREFIX = 'ee/' - MATCH_WITH_ARRAY_REGEX = /(?to\(?\s*)(?match|eq)(?[( ]?\[)/.freeze + MATCH_WITH_ARRAY_REGEX = /(?to\(?\s*)(?match|eq)(?[( ]?\[[^\]]+)/.freeze SUGGEST_MR_COMMENT = <<~SUGGEST_COMMENT ```suggestion %s