Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2025-06-06 12:20:49 +00:00
parent 5be8f95312
commit 6e562b7010
50 changed files with 243 additions and 252 deletions

View File

@ -16,7 +16,7 @@ variables:
# Retry failed specs in separate process
QA_RETRY_FAILED_SPECS: "true"
# Helm chart ref used by test-on-cng pipeline
GITLAB_HELM_CHART_REF: "6a57444ebbb2654d8f65e3abc581db204e3331c9"
GITLAB_HELM_CHART_REF: "4073ca4932209fc3d64d20ef48dd6f1e6c58cb15"
# Specific ref for cng-mirror project to trigger builds for
GITLAB_CNG_MIRROR_REF: "df7aafcccafdbab732a7cf757efb3b7b74c851dd"
# Makes sure some of the common scripts from pipeline-common use bundler to execute commands

View File

@ -1314,6 +1314,12 @@ Database/AvoidUsingPluckWithoutLimit:
- 'ee/spec/**/*.rb'
- 'qa/qa/specs/**/*.rb'
Database/AvoidUsingConnectionExecute:
Enabled: true
Include:
- '{,ee/}app/models/**/*'
- '{,ee/}lib/**/*'
Style/SymbolProc:
AllowedMethods:
- define_method

View File

@ -0,0 +1,42 @@
---
Database/AvoidUsingConnectionExecute:
Details: grace period
Exclude:
- 'app/models/analytics/cycle_analytics/stage_event_hash.rb'
- 'app/models/concerns/analytics/cycle_analytics/stage_event_model.rb'
- 'app/models/concerns/legacy_bulk_insert.rb'
- 'app/models/issue/metrics.rb'
- 'app/models/lfs_objects_project.rb'
- 'app/models/merge_request/metrics.rb'
- 'app/models/namespaces/descendants.rb'
- 'app/models/packages/maven/package.rb'
- 'app/models/postgresql/replication_slot.rb'
- 'app/models/project_group_link.rb'
- 'app/models/trending_project.rb'
- 'ee/app/models/concerns/geo/verification_state.rb'
- 'ee/app/models/dora/daily_metrics.rb'
- 'ee/app/models/iterations/cadence.rb'
- 'ee/app/models/vulnerabilities/statistic.rb'
- 'ee/app/models/work_items/weights_source.rb'
- 'ee/lib/gitlab/ingestion/bulk_updatable_task.rb'
- 'lib/click_house/migration.rb'
- 'lib/click_house/migration_support/schema_migration.rb'
- 'lib/gitlab/database/alter_cell_sequences_range.rb'
- 'lib/gitlab/database/async_constraints/validators/base.rb'
- 'lib/gitlab/database/async_indexes/index_base.rb'
- 'lib/gitlab/database/async_indexes/index_creator.rb'
- 'lib/gitlab/database/health_status/indicators/write_ahead_log.rb'
- 'lib/gitlab/database/lock_writes_manager.rb'
- 'lib/gitlab/database/migrations/observers/query_statistics.rb'
- 'lib/gitlab/database/migrations/observers/total_database_size_change.rb'
- 'lib/gitlab/database/partitioning/detached_partition_dropper.rb'
- 'lib/gitlab/database/partitioning/partition_manager.rb'
- 'lib/gitlab/database/partitioning_migration_helpers/bulk_copy.rb'
- 'lib/gitlab/database/partitioning_migration_helpers/index_helpers.rb'
- 'lib/gitlab/database/reflection.rb'
- 'lib/gitlab/database/reindexing/coordinator.rb'
- 'lib/gitlab/database/sos/base_db_stats_handler.rb'
- 'lib/gitlab/database/stat_activity_sampler.rb'
- 'lib/gitlab/database/tables_truncate.rb'
- 'lib/gitlab/database/unidirectional_copy_trigger.rb'
- 'lib/gitlab/database/with_lock_retries.rb'

View File

@ -69,6 +69,10 @@ export function initMergeRequestDashboard(el) {
keyArgs,
merge: true,
},
authoredMergeRequests: {
keyArgs,
merge: true,
},
},
},
MergeRequestConnection: {

View File

@ -173,7 +173,7 @@ export function toggleLoader(state) {
}
export function getActionFromHref(pathName) {
let action = pathName.match(/\/(\d+)\/(commits|diffs|pipelines|reports).*$/);
let action = pathName.match(/\/(\d+|new)\/(commits|diffs|pipelines|reports).*$/);
if (action) {
action = action.at(-1).replace(/(^\/|\.html)/g, '');

View File

@ -91,7 +91,7 @@ export default {
size="small"
category="tertiary"
data-testid="wiki-list-create-child-button"
:href="`${page.path}/{new_page_title}`"
:href="`${page.path}/{new_page_title}?view=create`"
class="wiki-list-create-child-button has-tooltip gl-ml-3"
:title="plusButtonTooltip"
:aria-label="plusButtonTooltip"

View File

@ -212,8 +212,14 @@ export default {
return actions;
},
allowlist() {
// Show the current project at the top of the allowlist for better UX
const { groups, projects } = this.groupsAndProjectsWithAccess;
return [...groups, ...projects].sort((a, b) => a.fullPath.localeCompare(b.fullPath));
const allItems = [...groups, ...projects];
const currentProject = allItems.find((item) => item.fullPath === this.fullPath);
const otherItems = allItems
.filter((item) => item !== currentProject)
.sort((a, b) => a.fullPath.localeCompare(b.fullPath));
return currentProject ? [currentProject, ...otherItems] : otherItems;
},
disclosureDropdownOptions() {
return [

View File

@ -119,18 +119,11 @@ module DraftNotes
end
def handle_notifications(current_user, merge_request, review)
pub_sub_flag = Feature.enabled?(:notification_event_store_migration_draft_published, current_user)
if pub_sub_flag
create_draft_published_event(merge_request, current_user, review)
else
todo_service.new_review(merge_request, current_user)
notification_service.async.new_review(review) if review
end
create_draft_published_event(merge_request, current_user, review)
MergeRequests::ResolvedDiscussionNotificationService
.new(project: project, current_user: current_user)
.execute(merge_request, send_notifications: !pub_sub_flag)
.execute(merge_request, send_notifications: false)
end
def create_draft_published_event(merge_request, current_user, review)

View File

@ -64,6 +64,10 @@
8,
99
]
},
"version": {
"description": "Version of registration flow",
"type": "integer"
}
},
"additionalProperties": false

View File

@ -1,10 +0,0 @@
---
name: notification_event_store_migration_draft_published
description:
feature_issue_url:
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190667
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/541124
milestone: '18.0'
group: group::personal productivity
type: gitlab_com_derisk
default_enabled: false

View File

@ -1,20 +0,0 @@
---
key_path: redis_hll_counters.code_review.i_code_review_user_searches_diff_monthly
description: Count of users who search merge request diffs
product_group: code_review
product_categories:
- code_review_workflow
value_type: number
status: active
milestone: '14.2'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66522
time_frame: 28d
data_source: internal_events
events:
- name: i_code_review_user_searches_diff
unique: user.id
data_category: optional
tiers:
- free
- premium
- ultimate

View File

@ -1,19 +0,0 @@
---
key_path: redis_hll_counters.analytics.p_analytics_ci_cd_pipelines_monthly
description: Count of unique visits to the project level CI CD Analytics pipelines tab
product_group: optimize
value_type: number
status: active
milestone: '14.6'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75187
time_frame: 28d
data_source: internal_events
data_category: optional
performance_indicator_type: []
events:
- name: p_analytics_ci_cd_pipelines
unique: user.id
tiers:
- free
- premium
- ultimate

View File

@ -1,18 +0,0 @@
---
key_path: redis_hll_counters.work_items.users_creating_work_items_monthly
description: Unique users creating work items
product_group: project_management
value_type: number
status: active
milestone: '14.9'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/81201
time_frame: 28d
data_source: internal_events
data_category: optional
events:
- name: users_creating_work_items
unique: user.id
tiers:
- free
- premium
- ultimate

View File

@ -1,18 +0,0 @@
---
key_path: redis_hll_counters.analytics.p_analytics_ci_cd_time_to_restore_service_monthly
description: Count of unique visits to the project level CI/CD Analytics Time to restore service tab
product_group: optimize
value_type: number
status: active
milestone: "15.2"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90856
time_frame: 28d
data_source: internal_events
data_category: operational
performance_indicator_type: []
tiers:
- premium
- ultimate
events:
- name: visit_ci_cd_time_to_restore_service_tab
unique: user.id

View File

@ -1,18 +0,0 @@
---
key_path: redis_hll_counters.analytics.p_analytics_ci_cd_change_failure_rate_monthly
description: Count of unique visits to the project level CI/CD Analytics Change failure rate tab
product_group: optimize
value_type: number
status: active
milestone: "15.2"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/91726
time_frame: 28d
data_source: internal_events
data_category: operational
performance_indicator_type: []
tiers:
- premium
- ultimate
events:
- name: visit_ci_cd_failure_rate_tab
unique: user.id

View File

@ -1,5 +1,5 @@
---
key_path: redis_hll_counters.code_review.i_code_review_user_searches_diff_weekly
key_path: redis_hll_counters.code_review.i_code_review_user_searches_diff
description: Count of users who search merge request diffs
product_group: code_review
product_categories:
@ -8,7 +8,9 @@ value_type: number
status: active
milestone: '14.2'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66522
time_frame: 7d
time_frame:
- 28d
- 7d
data_source: internal_events
events:
- name: i_code_review_user_searches_diff

View File

@ -1,12 +1,14 @@
---
key_path: redis_hll_counters.analytics.p_analytics_ci_cd_change_failure_rate_weekly
key_path: redis_hll_counters.analytics.p_analytics_ci_cd_change_failure_rate
description: Count of unique visits to the project level CI/CD Analytics Change failure rate tab
product_group: optimize
value_type: number
status: active
milestone: "15.2"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/91726
time_frame: 7d
time_frame:
- 28d
- 7d
data_source: internal_events
data_category: operational
performance_indicator_type: []

View File

@ -1,12 +1,14 @@
---
key_path: redis_hll_counters.analytics.p_analytics_ci_cd_pipelines_weekly
key_path: redis_hll_counters.analytics.p_analytics_ci_cd_pipelines
description: Count of unique visits to the project level CI CD Analytics pipelines tab
product_group: optimize
value_type: number
status: active
milestone: '14.6'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75187
time_frame: 7d
time_frame:
- 28d
- 7d
data_source: internal_events
data_category: optional
performance_indicator_type: []

View File

@ -1,12 +1,14 @@
---
key_path: redis_hll_counters.analytics.p_analytics_ci_cd_time_to_restore_service_weekly
key_path: redis_hll_counters.analytics.p_analytics_ci_cd_time_to_restore_service
description: Count of unique visits to the project level CI/CD Analytics Time to restore service tab
product_group: optimize
value_type: number
status: active
milestone: "15.2"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90856
time_frame: 7d
time_frame:
- 28d
- 7d
data_source: internal_events
data_category: operational
performance_indicator_type: []

View File

@ -1,12 +1,14 @@
---
key_path: redis_hll_counters.work_items.users_creating_work_items_weekly
key_path: redis_hll_counters.work_items.users_creating_work_items
description: Unique users creating work items
product_group: project_management
value_type: number
status: active
milestone: '14.9'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/81201
time_frame: 7d
time_frame:
- 28d
- 7d
data_source: internal_events
data_category: optional
events:

View File

@ -4,7 +4,7 @@ class DropTableCatalogResourceComponentUsages < Gitlab::Database::Migration[2.3]
milestone '18.1'
def up
drop_table :p_catalog_resource_component_usages, if_exists: true
drop_table :p_catalog_resource_component_usages, if_exists: true, cascade: true
end
def down

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddEachBatchIndexToSbomGraphPaths < Gitlab::Database::Migration[2.3]
disable_ddl_transaction!
milestone '18.1'
INDEX_NAME = "index_sbom_graph_paths_on_project_id_and_id"
def up
add_concurrent_index :sbom_graph_paths, %i[project_id id], name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :sbom_graph_paths, INDEX_NAME
end
end

View File

@ -0,0 +1 @@
59a0696d354eaa0472075fa476902ab94ac97288988e76af00fbd65f26c0cec7

View File

@ -37264,6 +37264,8 @@ CREATE INDEX index_sbom_graph_paths_on_descendant_id ON sbom_graph_paths USING b
CREATE INDEX index_sbom_graph_paths_on_project_id_and_descendant_id ON sbom_graph_paths USING btree (project_id, descendant_id);
CREATE INDEX index_sbom_graph_paths_on_project_id_and_id ON sbom_graph_paths USING btree (project_id, id);
CREATE INDEX index_sbom_occurr_on_project_id_and_component_version_id_and_id ON sbom_occurrences USING btree (project_id, component_version_id, id);
CREATE INDEX index_sbom_occurrences_on_component_id_and_id ON sbom_occurrences USING btree (component_id, id);

View File

@ -201,10 +201,22 @@ include:
- local: '/ci/security-scan.yml' # Verified and stored in the repository
```
### Automatic SLSA attestation generation
### SLSA provenance generation
GitLab offers a SLSA Level 1 compliant attestation that can be [automatically generated for all build artifacts produced by the GitLab Runner](../runners/configure_runners.md#artifact-provenance-metadata).
This attestation is produced by the runner itself.
GitLab offers a SLSA Level 1 compliant provenance statement that can be
[automatically generated for all build artifacts produced by the GitLab Runner](../runners/configure_runners.md#artifact-provenance-metadata).
This provenance statement is produced by the runner itself.
#### Sign and verify SLSA provenance with a CI/CD Component
The [GitLab SLSA CI/CD component](https://gitlab.com/explore/catalog/components/slsa)
provides configurations for:
- Signing runner-generated provenance statements.
- Generating [Verification Summary Attestations (VSA)](https://slsa.dev/spec/v1.0/verification_summary)
for job artifacts.
For more information and example configurations, see the [SLSA Component documentation](https://gitlab.com/components/slsa#slsa-supply-chain-levels-for-software-artifacts).
### Related topics

View File

@ -164,3 +164,6 @@ Rake/TopLevelMethodDefinition:
Scalability/RandomCronSchedule:
Enabled: false
Database/AvoidUsingConnectionExecute:
Enabled: false

View File

@ -931,7 +931,6 @@ excluded_attributes:
- :artifacts_size
- :commands
- :runner_id
- :trigger_request_id
- :erased_by_id
- :auto_canceled_by_id
- :stage_id

View File

@ -40,6 +40,10 @@ module Gitlab
return @app.call(env) unless path_traversal_attempt?(request, log_params)
log_params[:request_rejected] = true
# TODO Remove this when https://gitlab.com/gitlab-org/ruby/gems/labkit-ruby/-/issues/41 is implemented
log_params[:remote_ip] = request.remote_ip
log(log_params)
REJECT_RESPONSE

View File

@ -146,7 +146,7 @@
"deckar01-task_list": "^2.3.1",
"dexie": "^3.2.3",
"diff": "^3.4.0",
"dompurify": "^3.2.5",
"dompurify": "^3.2.6",
"dropzone": "^4.2.0",
"editorconfig": "^0.15.3",
"emoji-regex": "^10.3.0",

View File

@ -0,0 +1,41 @@
# frozen_string_literal: true
module RuboCop
module Cop
module Database
# Avoid using connection.execute for read-only queries.
#
# @example
#
# # bad
# class MyClass < ApplicationRecord
# def all
# connection.execute('SELECT * FROM my_table') # This goes to the primary db node
# end
# end
#
# # good
# class MyClass < ApplicationRecord
# def all
# connection.select_all('SELECT * FROM my_table') # This goes to a read replica
# end
# end
class AvoidUsingConnectionExecute < RuboCop::Cop::Base
MSG = "The `connection.execute` method always runs SQL statements on the primary database node. " \
"To ensure queries are routed to the appropriate node (replica or primary), use operations like " \
"`.select_all` or `.select_rows` for reads and `.insert` or `.update` for write operations."
# @!method connection_execute?(node)
def_node_matcher :connection_execute?, <<~PATTERN
(send (send nil? :connection) :execute ...)
PATTERN
def on_send(node)
add_offense(node) if connection_execute?(node)
end
alias_method :on_csend, :on_send
end
end
end
end

View File

@ -151,7 +151,7 @@ RSpec.describe 'Database schema',
oauth_device_grants: %w[resource_owner_id application_id],
packages_nuget_symbols: %w[project_id],
packages_package_files: %w[project_id],
p_ci_builds: %w[erased_by_id trigger_request_id partition_id auto_canceled_by_partition_id execution_config_id
p_ci_builds: %w[erased_by_id partition_id auto_canceled_by_partition_id execution_config_id
upstream_pipeline_partition_id],
p_ci_builds_metadata: %w[project_id build_id partition_id],
p_ci_build_trace_metadata: %w[project_id],

File diff suppressed because one or more lines are too long

View File

@ -100,7 +100,7 @@ describe('FileBrowserToggle', () => {
it('Displays hide message for open file browser', () => {
createComponent();
expect(findTooltip().value).toBe(
'Hide file browser <kbd aria-hidden="true" class="flat gl-ml-1">f</kbd>',
'Hide file browser <kbd class="flat gl-ml-1" aria-hidden="true">f</kbd>',
);
});
@ -109,7 +109,7 @@ describe('FileBrowserToggle', () => {
useFileBrowser().fileBrowserVisible = false;
await nextTick();
expect(findTooltip().value).toBe(
'Show file browser <kbd aria-hidden="true" class="flat gl-ml-1">f</kbd>',
'Show file browser <kbd class="flat gl-ml-1" aria-hidden="true">f</kbd>',
);
});
});

View File

@ -574,6 +574,7 @@ describe('MergeRequestTabs', () => {
${'/user/diffs/-/merge_requests/1/pipelines'} | ${'pipelines'}
${'/user/pipelines/-/merge_requests/1/commits'} | ${'commits'}
${'/user/pipelines/1/-/merge_requests/1/diffs'} | ${'diffs'}
${'/user/gitlab/-/merge_requests/new/diffs'} | ${'diffs'}
${'/user/pipelines/-/merge_requests/1'} | ${'show'}
${'/user/pipelines/-/merge_requests/1/reports'} | ${'reports'}
${'/group/reports/project/-/merge_requests/1/reports'} | ${'reports'}

View File

@ -180,7 +180,7 @@ describe('Blob controls component', () => {
expect(findFindButton().attributes('aria-keyshortcuts')).toBe('t');
expect(findFindButton().attributes('title')).toBe(
'Go to find file <kbd aria-hidden="true" class="flat gl-ml-1">t</kbd>',
'Go to find file <kbd class="flat gl-ml-1" aria-hidden="true">t</kbd>',
);
expect(tooltip).toBeDefined();
});

View File

@ -270,14 +270,14 @@ describe('TokenAccess component', () => {
});
});
it('adds the current project in alphabetical order', async () => {
it('adds the current project at the top of the list', async () => {
await createComponent(
[[getCiJobTokenScopeAllowlistQuery, ciJobTokenScopeAllowlistResponseHandler]],
{ isJobTokenPoliciesEnabled: true },
);
expect(findTokenAccessTable().props('items')[0].fullPath).toBe('abc/123');
expect(findTokenAccessTable().props('items')[1].fullPath).toBe('root/my-repo');
expect(findTokenAccessTable().props('items')[0].fullPath).toBe('root/my-repo');
expect(findTokenAccessTable().props('items')[1].fullPath).toBe('abc/123');
expect(findTokenAccessTable().props('items')[2].fullPath).toBe('root/your-repo');
expect(findTokenAccessTable().props('items')[3].fullPath).toBe('zed');
});

View File

@ -15,7 +15,7 @@ const RENDERED_MARKDOWN =
'\u003cp data-sourcepos="1:1-1:79" dir="auto"\u003eCheckout \u003ca href="http://gitlab.com"\u003eGitLab\u003c/a\u003e Hello! Welcome "\u0026gt;\u003c/p\u003e';
// HTML with v-safe-html
const HTML_SAFE_RENDERED_MARKDOWN =
'\u003cp dir="auto" data-sourcepos="1:1-1:79"\u003eCheckout \u003ca href="http://gitlab.com"\u003eGitLab\u003c/a\u003e Hello! Welcome "\u0026gt;\u003c/p\u003e';
'\u003cp data-sourcepos="1:1-1:79" dir="auto"\u003eCheckout \u003ca href="http://gitlab.com"\u003eGitLab\u003c/a\u003e Hello! Welcome "\u0026gt;\u003c/p\u003e';
describe('markdown_content.vue', () => {
let wrapper;

View File

@ -228,7 +228,7 @@ describe('WorkItemSidebarDropdownWidget component', () => {
it('shows tooltip with key when shortcut is provided', () => {
createComponent({ canUpdate: true, shortcut });
const expectedTooltip = 'Edit dropdown <kbd aria-hidden="true" class="flat gl-ml-1">e</kbd>';
const expectedTooltip = 'Edit dropdown <kbd class="flat gl-ml-1" aria-hidden="true">e</kbd>';
expect(findEditButton().attributes('title')).toContain(expectedTooltip);
});

View File

@ -164,9 +164,9 @@ describe('WorkItemDescriptionRendered', () => {
describe('`disableHeadingAnchors` prop', () => {
const baseAnchorHtml =
'<a id="user-content-this-is-an-anchor" class="anchor" aria-hidden="true" href="#this-is-an-anchor"></a>';
'<a href="#this-is-an-anchor" aria-hidden="true" class="anchor" id="user-content-this-is-an-anchor"></a>';
const uninteractiveAnchorHtml =
'<a id="user-content-this-is-an-anchor" class="anchor after:!gl-hidden" aria-hidden="true" href="#this-is-an-anchor"></a>';
'<a href="#this-is-an-anchor" aria-hidden="true" class="anchor after:!gl-hidden" id="user-content-this-is-an-anchor"></a>';
const baseHtml =
'<h1 data-sourcepos="1:1-1:19" dir="auto">&#x000A;<a href="#this-is-an-anchor" aria-hidden="true" class="anchor" id="user-content-this-is-an-anchor"></a>This is an anchor</h1>';
it('renders anchor links as normal when prop is `false`', () => {

View File

@ -8,7 +8,7 @@ describe('Work Item title', () => {
const mockTitleHtml =
'Work Item <em>title</em> <gl-emoji title="grinning face with smiling eyes" data-name="smile" data-unicode-version="6.0">😄</gl-emoji>';
const mockTitleHtmlResult =
'<h1 data-testid="work-item-title" class="gl-heading-1 !gl-m-0 gl-w-full gl-wrap-anywhere"><span>Work Item <em>title</em> <gl-emoji data-unicode-version="6.0" data-name="smile" title="grinning face with smiling eyes">😄</gl-emoji></span></h1>';
'<h1 data-testid="work-item-title" class="gl-heading-1 !gl-m-0 gl-w-full gl-wrap-anywhere"><span>Work Item <em>title</em> <gl-emoji title="grinning face with smiling eyes" data-name="smile" data-unicode-version="6.0">😄</gl-emoji></span></h1>';
const mockTitleText = 'Work Item title 😄';
const createComponent = ({ isEditing = false, isModal = false } = {}) => {

View File

@ -386,7 +386,6 @@ Ci::Build:
- options
- allow_failure
- stage
- trigger_request_id
- stage_idx
- stage_id
- tag
@ -438,7 +437,6 @@ Ci::Bridge:
- options
- allow_failure
- stage
- trigger_request_id
- stage_idx
- stage_id
- tag
@ -490,7 +488,6 @@ GenericCommitStatus:
- options
- allow_failure
- stage
- trigger_request_id
- stage_idx
- stage_id
- tag

View File

@ -62,6 +62,7 @@ RSpec.describe ::Gitlab::Middleware::PathTraversalCheck, feature_category: :shar
message: described_class::PATH_TRAVERSAL_MESSAGE,
fullpath: fullpath,
method: method.upcase,
remote_ip: instance_of(String),
request_rejected: true
)).and_call_original
expect(::Gitlab::Instrumentation::Middleware::PathTraversalCheck)

View File

@ -88,7 +88,7 @@ RSpec.describe Ci::Processable, feature_category: :continuous_integration do
let(:ignore_accessors) do
%i[type namespace lock_version target_url base_tags trace_sections
commit_id deployment erased_by_id project_id project_mirror
runner_id taggings tags trigger_request_id trigger trigger_id
runner_id taggings tags trigger trigger_id
user_id auto_canceled_by_id retried failure_reason
sourced_pipelines sourced_pipeline artifacts_file_store artifacts_metadata_store
metadata runner_manager_build runner_manager runner_session trace_chunks

View File

@ -6,8 +6,8 @@ RSpec.describe Mutations::Organizations::Create, feature_category: :organization
include GraphqlHelpers
include WorkhorseHelpers
let_it_be(:user) { create(:user) }
let_it_be(:organization) { create(:organization) }
let_it_be(:user) { create(:user, organizations: [organization]) }
let(:mutation) { graphql_mutation(:organization_create, params) }
let(:name) { 'Name' }

View File

@ -5,8 +5,6 @@ require 'spec_helper'
RSpec.describe 'getting organizations information', feature_category: :organization do
include GraphqlHelpers
let_it_be(:user) { create(:user) }
let(:query) { graphql_query_for(:organizations, organizations_fields) }
let(:organizations) { graphql_data_at(:organizations, :nodes) }
let(:organizations_fields) do
@ -20,8 +18,9 @@ RSpec.describe 'getting organizations information', feature_category: :organizat
end
let_it_be(:private_organization) { create(:organization, :private) }
let_it_be(:public_organizations) { create_list(:organization, 3, :public) }
let_it_be(:organization) { public_organizations.first }
let_it_be(:user) { create(:user, organizations: [organization]) }
subject(:request_organization) { post_graphql(query, current_user: current_user) }

View File

@ -0,0 +1,27 @@
# frozen_string_literal: true
require 'rubocop_spec_helper'
require_relative '../../../../rubocop/cop/database/avoid_using_connection_execute'
RSpec.describe RuboCop::Cop::Database::AvoidUsingConnectionExecute, feature_category: :database do
it 'adds an offense when the using connection.execute' do
expect_offense(<<~RUBY)
class MyModel < ApplicationRecord
def execute
connection.execute('SELECT * FROM my_models LIMIT 1').to_a
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The `connection.execute` method always runs [...]
end
end
RUBY
end
it 'adds no offense if only calls for execute' do
expect_no_offenses(<<~RUBY)
class MyModel < ApplicationRecord
def execute
execute('SELECT * FROM my_models LIMIT 1').to_a
end
end
RUBY
end
end

View File

@ -144,48 +144,12 @@ RSpec.describe DraftNotes::PublishService, feature_category: :code_review_workfl
expect(notes.last.note).to eq('second note')
end
context 'when pub-sub event feature flag is disabled' do
before do
stub_feature_flags(notification_event_store_migration_draft_published: false)
end
it 'creates the correct pub-sub event' do
expect(::Gitlab::EventStore).to receive(:publish).with(
an_instance_of(MergeRequests::DraftNotePublishedEvent)
).and_call_original
it 'resolves todos for the MR' do
expect(todo_service).to receive(:new_review).with(merge_request, user)
publish
end
it 'sends batch notification' do
expect(notification_service).to receive_message_chain(:async, :new_review).with(kind_of(Review))
publish
end
end
context 'when pub-sub event feature flag is enabled' do
before do
stub_feature_flags(notification_event_store_migration_draft_published: true)
end
it 'creates the correct pub-sub event' do
expect(::Gitlab::EventStore).to receive(:publish).with(
an_instance_of(MergeRequests::DraftNotePublishedEvent)
).and_call_original
publish
end
it 'does not send batch notification' do
expect(notification_service).not_to receive(:async)
publish
end
it 'does not handle todos' do
expect(todo_service).not_to receive(:new_review)
publish
end
publish
end
it 'tracks the publish event' do
@ -296,29 +260,11 @@ RSpec.describe DraftNotes::PublishService, feature_category: :code_review_workfl
context 'with no draft notes' do
let(:merge_request) { create(:merge_request) }
context 'when pub-sub event feature flag is disabled' do
before do
stub_feature_flags(notification_event_store_migration_draft_published: false)
end
it 'creates the correct pub-sub event' do
expect(::Gitlab::EventStore).to receive(:publish)
expect(MergeRequests::DraftNotePublishedEvent).to receive(:new)
it 'resolves todos for the MR' do
expect(todo_service).to receive(:new_review).with(merge_request, user)
publish
end
end
context 'when pub-sub event feature flag is enabled' do
before do
stub_feature_flags(notification_event_store_migration_draft_published: true)
end
it 'creates the correct pub-sub event' do
expect(::Gitlab::EventStore).to receive(:publish)
expect(MergeRequests::DraftNotePublishedEvent).to receive(:new)
publish
end
publish
end
end
@ -447,32 +393,12 @@ RSpec.describe DraftNotes::PublishService, feature_category: :code_review_workfl
expect(Note.find(note.id).discussion.resolved?).to be true
end
context 'when pub-sub event feature flag is enabled' do
before do
stub_feature_flags(notification_event_store_migration_draft_published: true)
it 'handles resolved discussions without sending notifications' do
expect_next_instance_of(MergeRequests::ResolvedDiscussionNotificationService) do |instance|
expect(instance).to receive(:execute).with(merge_request, send_notifications: false)
end
it 'handles resolved discussions without sending notifications' do
expect_next_instance_of(MergeRequests::ResolvedDiscussionNotificationService) do |instance|
expect(instance).to receive(:execute).with(merge_request, send_notifications: false)
end
publish
end
end
context 'when pub-sub event feature flag is disabled' do
before do
stub_feature_flags(notification_event_store_migration_draft_published: false)
end
it 'handles resolved discussions sending notifications' do
expect_next_instance_of(MergeRequests::ResolvedDiscussionNotificationService) do |instance|
expect(instance).to receive(:execute).with(merge_request, send_notifications: true)
end
publish
end
publish
end
end

View File

@ -31,8 +31,7 @@ module ApiHelpers
elsif access_token
query_string = "access_token=#{access_token.token}"
elsif user
organization = Organizations::Organization.first || build(:organization)
organization = user.organizations.first || FactoryBot.build(:organization)
personal_access_token = if admin_mode && user.admin?
create(:personal_access_token, :admin_mode, user: user, organization: organization)

View File

@ -127,7 +127,7 @@ RSpec.shared_examples 'User views wiki sidebar' do
first_wiki_list.hover
wiki_new_page_link = first(".wiki-list-create-child-button")['href']
expect(wiki_new_page_link).to eq "#{wiki_link}/%7Bnew_page_title%7D"
expect(wiki_new_page_link).to eq "#{wiki_link}/%7Bnew_page_title%7D?view=create"
end
end
end

View File

@ -6935,10 +6935,10 @@ domexception@^4.0.0:
dependencies:
webidl-conversions "^7.0.0"
dompurify@^3.0.5, dompurify@^3.2.5:
version "3.2.5"
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.2.5.tgz#11b108656a5fb72b24d916df17a1421663d7129c"
integrity sha512-mLPd29uoRe9HpvwP2TxClGQBzGXeEC/we/q+bFlmPPmj2p2Ugl3r6ATu/UU1v77DXNcehiBg9zsr1dREyA/dJQ==
dompurify@^3.0.5, dompurify@^3.2.6:
version "3.2.6"
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.2.6.tgz#ca040a6ad2b88e2a92dc45f38c79f84a714a1cad"
integrity sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==
optionalDependencies:
"@types/trusted-types" "^2.0.7"