Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fb94cc6e
Commit
fb94cc6e
authored
Dec 07, 2021
by
David Fernandez
Committed by
Vitali Tatarintev
Dec 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the packages_npm_abbreviated_metadata feature flag
parent
ab8d113a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
60 deletions
+11
-60
app/presenters/packages/npm/package_presenter.rb
app/presenters/packages/npm/package_presenter.rb
+2
-8
app/services/packages/npm/create_package_service.rb
app/services/packages/npm/create_package_service.rb
+1
-3
config/feature_flags/development/packages_npm_abbreviated_metadata.yml
...e_flags/development/packages_npm_abbreviated_metadata.yml
+0
-8
lib/api/concerns/packages/npm_endpoints.rb
lib/api/concerns/packages/npm_endpoints.rb
+1
-3
spec/presenters/packages/npm/package_presenter_spec.rb
spec/presenters/packages/npm/package_presenter_spec.rb
+7
-14
spec/services/packages/npm/create_package_service_spec.rb
spec/services/packages/npm/create_package_service_spec.rb
+0
-11
spec/support/shared_examples/requests/api/npm_packages_shared_examples.rb
...red_examples/requests/api/npm_packages_shared_examples.rb
+0
-13
No files found.
app/presenters/packages/npm/package_presenter.rb
View file @
fb94cc6e
...
...
@@ -12,10 +12,9 @@ module Packages
attr_reader
:name
,
:packages
def
initialize
(
name
,
packages
,
include_metadata:
false
)
def
initialize
(
name
,
packages
)
@name
=
name
@packages
=
packages
@include_metadata
=
include_metadata
end
def
versions
...
...
@@ -24,10 +23,7 @@ module Packages
packages
.
each_batch
do
|
relation
|
batched_packages
=
relation
.
including_dependency_links
.
preload_files
if
@include_metadata
batched_packages
=
batched_packages
.
preload_npm_metadatum
end
.
preload_npm_metadatum
batched_packages
.
each
do
|
package
|
package_file
=
package
.
package_files
.
last
...
...
@@ -92,8 +88,6 @@ module Packages
end
def
abbreviated_package_json
(
package
)
return
{}
unless
@include_metadata
json
=
package
.
npm_metadatum
&
.
package_json
||
{}
json
.
slice
(
*
PACKAGE_JSON_ALLOWED_FIELDS
)
end
...
...
app/services/packages/npm/create_package_service.rb
View file @
fb94cc6e
...
...
@@ -23,9 +23,7 @@ module Packages
::
Packages
::
CreateDependencyService
.
new
(
package
,
package_dependencies
).
execute
::
Packages
::
Npm
::
CreateTagService
.
new
(
package
,
dist_tag
).
execute
if
Feature
.
enabled?
(
:packages_npm_abbreviated_metadata
,
project
,
default_enabled: :yaml
)
package
.
create_npm_metadatum!
(
package_json:
package_json
)
end
package
end
...
...
config/feature_flags/development/packages_npm_abbreviated_metadata.yml
deleted
100644 → 0
View file @
ab8d113a
---
name
:
packages_npm_abbreviated_metadata
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73639
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/344827
milestone
:
'
14.5'
type
:
development
group
:
group::package
default_enabled
:
true
lib/api/concerns/packages/npm_endpoints.rb
View file @
fb94cc6e
...
...
@@ -121,9 +121,7 @@ module API
not_found!
(
'Packages'
)
if
packages
.
empty?
include_metadata
=
Feature
.
enabled?
(
:packages_npm_abbreviated_metadata
,
project
,
default_enabled: :yaml
)
present
::
Packages
::
Npm
::
PackagePresenter
.
new
(
package_name
,
packages
,
include_metadata:
include_metadata
),
present
::
Packages
::
Npm
::
PackagePresenter
.
new
(
package_name
,
packages
),
with:
::
API
::
Entities
::
NpmPackage
end
end
...
...
spec/presenters/packages/npm/package_presenter_spec.rb
View file @
fb94cc6e
...
...
@@ -32,22 +32,15 @@ RSpec.describe ::Packages::Npm::PackagePresenter do
}
end
let
(
:presenter
)
{
described_class
.
new
(
package_name
,
packages
,
include_metadata:
include_metadata
)
}
let
(
:presenter
)
{
described_class
.
new
(
package_name
,
packages
)
}
subject
{
presenter
.
versions
}
where
(
:has_dependencies
,
:has_metadatum
,
:include_metadata
)
do
true
|
true
|
true
false
|
true
|
true
true
|
false
|
true
false
|
false
|
true
# TODO : to remove along with packages_npm_abbreviated_metadata
# See https://gitlab.com/gitlab-org/gitlab/-/issues/344827
true
|
true
|
false
false
|
true
|
false
true
|
false
|
false
false
|
false
|
false
where
(
:has_dependencies
,
:has_metadatum
)
do
true
|
true
false
|
true
true
|
false
false
|
false
end
with_them
do
...
...
@@ -80,7 +73,7 @@ RSpec.describe ::Packages::Npm::PackagePresenter do
context
'metadatum'
do
::
Packages
::
Npm
::
PackagePresenter
::
PACKAGE_JSON_ALLOWED_FIELDS
.
each
do
|
metadata_field
|
if
params
[
:has_metadatum
]
&&
params
[
:include_metadata
]
if
params
[
:has_metadatum
]
it
{
expect
(
subject
.
dig
(
package1
.
version
,
metadata_field
)).
not_to
be
nil
}
else
it
{
expect
(
subject
.
dig
(
package1
.
version
,
metadata_field
)).
to
be
nil
}
...
...
spec/services/packages/npm/create_package_service_spec.rb
View file @
fb94cc6e
...
...
@@ -89,17 +89,6 @@ RSpec.describe Packages::Npm::CreatePackageService do
end
end
end
context
'with packages_npm_abbreviated_metadata disabled'
do
before
do
stub_feature_flags
(
packages_npm_abbreviated_metadata:
false
)
end
it
'creates a package without metadatum'
do
expect
{
subject
}
.
not_to
change
{
Packages
::
Npm
::
Metadatum
.
count
}
end
end
end
describe
'#execute'
do
...
...
spec/support/shared_examples/requests/api/npm_packages_shared_examples.rb
View file @
fb94cc6e
...
...
@@ -41,19 +41,6 @@ RSpec.shared_examples 'handling get metadata requests' do |scope: :project|
# query count can slightly change between the examples so we're using a custom threshold
expect
{
get
(
url
,
headers:
headers
)
}.
not_to
exceed_query_limit
(
control
).
with_threshold
(
4
)
end
context
'with packages_npm_abbreviated_metadata disabled'
do
before
do
stub_feature_flags
(
packages_npm_abbreviated_metadata:
false
)
end
it
'calls the presenter without including metadata'
do
expect
(
::
Packages
::
Npm
::
PackagePresenter
)
.
to
receive
(
:new
).
with
(
anything
,
anything
,
include_metadata:
false
).
and_call_original
subject
end
end
end
shared_examples
'reject metadata request'
do
|
status
:|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment