Skip to content

Commit 0c18560

Browse files
committed
internal: remove vulns experiment
Change-Id: I17561f6ecf2d5aaaa18b6ea50dacfe3397ff091b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/401616 Run-TryBot: Jonathan Amsterdam <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]>
1 parent bbbf7a6 commit 0c18560

File tree

7 files changed

+6
-19
lines changed

7 files changed

+6
-19
lines changed

internal/experiment.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const (
99
ExperimentEnableStdFrontendFetch = "enable-std-frontend-fetch"
1010
ExperimentNewUnitLayout = "new-unit-layout"
1111
ExperimentStyleGuide = "styleguide"
12-
ExperimentVulns = "vulns"
1312
)
1413

1514
// Experiments represents all of the active experiments in the codebase and
@@ -18,7 +17,6 @@ var Experiments = map[string]string{
1817
ExperimentEnableStdFrontendFetch: "Enable frontend fetching for module std.",
1918
ExperimentNewUnitLayout: "Enable the new layout on the unit page.",
2019
ExperimentStyleGuide: "Enable the styleguide.",
21-
ExperimentVulns: "Enable vulnerability reporting.",
2220
}
2321

2422
// Experiment holds data associated with an experimental feature for frontend

internal/frontend/search.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"golang.org/x/mod/semver"
2323
"golang.org/x/pkgsite/internal"
2424
"golang.org/x/pkgsite/internal/derrors"
25-
"golang.org/x/pkgsite/internal/experiment"
2625
"golang.org/x/pkgsite/internal/log"
2726
"golang.org/x/pkgsite/internal/middleware"
2827
"golang.org/x/pkgsite/internal/postgres"
@@ -227,7 +226,7 @@ func fetchSearchPage(ctx context.Context, db *postgres.DB, cq, symbol string,
227226
results = append(results, sr)
228227
}
229228

230-
if getVulnEntries != nil && experiment.IsActive(ctx, internal.ExperimentVulns) {
229+
if getVulnEntries != nil {
231230
addVulns(results, getVulnEntries)
232231
}
233232

internal/frontend/search_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/google/go-cmp/cmp"
1515
"github.com/google/go-cmp/cmp/cmpopts"
1616
"golang.org/x/pkgsite/internal"
17-
"golang.org/x/pkgsite/internal/experiment"
1817
"golang.org/x/pkgsite/internal/licenses"
1918
"golang.org/x/pkgsite/internal/postgres"
2019
"golang.org/x/pkgsite/internal/testing/sample"
@@ -69,8 +68,6 @@ func TestFetchSearchPage(t *testing.T) {
6968
defer cancel()
7069
defer postgres.ResetTestDB(testDB, t)
7170

72-
ctx = experiment.NewContext(ctx, internal.ExperimentVulns)
73-
7471
var (
7572
now = sample.NowTruncated()
7673
moduleFoo = &internal.Module{

internal/frontend/unit.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"golang.org/x/pkgsite/internal"
1818
"golang.org/x/pkgsite/internal/cookie"
1919
"golang.org/x/pkgsite/internal/derrors"
20-
"golang.org/x/pkgsite/internal/experiment"
2120
"golang.org/x/pkgsite/internal/log"
2221
"golang.org/x/pkgsite/internal/middleware"
2322
"golang.org/x/pkgsite/internal/stdlib"
@@ -220,7 +219,7 @@ func (s *Server) serveUnitPage(ctx context.Context, w http.ResponseWriter, r *ht
220219
}
221220

222221
// Get vulnerability information.
223-
if s.vulnClient != nil && experiment.IsActive(ctx, internal.ExperimentVulns) {
222+
if s.vulnClient != nil {
224223
page.Vulns = VulnsForPackage(um.ModulePath, um.Version, um.Path, s.vulnClient.GetByModule)
225224
}
226225
s.servePage(ctx, w, tabSettings.TemplateName, page)

internal/frontend/versions.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
"golang.org/x/mod/semver"
1616
"golang.org/x/pkgsite/internal"
17-
"golang.org/x/pkgsite/internal/experiment"
1817
"golang.org/x/pkgsite/internal/log"
1918
"golang.org/x/pkgsite/internal/postgres"
2019
"golang.org/x/pkgsite/internal/stdlib"
@@ -196,9 +195,7 @@ func buildVersionDetails(ctx context.Context, currentModulePath string,
196195
if sv := sh.SymbolsAtVersion(mi.Version); sv != nil {
197196
vs.Symbols = symbolsForVersion(linkify(mi), sv)
198197
}
199-
if experiment.IsActive(ctx, internal.ExperimentVulns) {
200-
vs.Vulns = VulnsForPackage(mi.ModulePath, mi.Version, "", getVulnEntries)
201-
}
198+
vs.Vulns = VulnsForPackage(mi.ModulePath, mi.Version, "", getVulnEntries)
202199
vl := lists[key]
203200
if vl == nil {
204201
seenLists = append(seenLists, key)

internal/frontend/versions_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010

1111
"github.com/google/go-cmp/cmp"
1212
"golang.org/x/pkgsite/internal"
13-
"golang.org/x/pkgsite/internal/experiment"
1413
"golang.org/x/pkgsite/internal/postgres"
1514
"golang.org/x/pkgsite/internal/stdlib"
1615
"golang.org/x/pkgsite/internal/testing/sample"
@@ -188,7 +187,6 @@ func TestFetchPackageVersionsDetails(t *testing.T) {
188187
t.Run(tc.name, func(t *testing.T) {
189188
ctx, cancel := context.WithTimeout(context.Background(), testTimeout*2)
190189
defer cancel()
191-
ctx = experiment.NewContext(ctx, internal.ExperimentVulns)
192190
defer postgres.ResetTestDB(testDB, t)
193191

194192
for _, v := range tc.modules {

internal/frontend/vulns.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"golang.org/x/mod/semver"
1313
"golang.org/x/pkgsite/internal"
1414
"golang.org/x/pkgsite/internal/derrors"
15-
"golang.org/x/pkgsite/internal/experiment"
1615
"golang.org/x/sync/errgroup"
1716
vulnc "golang.org/x/vuln/client"
1817
"golang.org/x/vuln/osv"
@@ -46,6 +45,9 @@ func VulnsForPackage(modulePath, version, packagePath string, getVulnEntries vul
4645
func vulnsForPackage(modulePath, version, packagePath string, getVulnEntries vulnEntriesFunc) (_ []Vuln, err error) {
4746
defer derrors.Wrap(&err, "vulns(%q, %q, %q)", modulePath, version, packagePath)
4847

48+
if getVulnEntries == nil {
49+
return nil, nil
50+
}
4951
// Get all the vulns for this module.
5052
entries, err := getVulnEntries(modulePath)
5153
if err != nil {
@@ -104,9 +106,6 @@ func entryVuln(e *osv.Entry, packagePath, version string) (Vuln, bool) {
104106
}
105107

106108
func (s *Server) serveVuln(w http.ResponseWriter, r *http.Request, _ internal.DataSource) error {
107-
if !experiment.IsActive(r.Context(), internal.ExperimentVulns) {
108-
return &serverError{status: http.StatusNotFound}
109-
}
110109
switch r.URL.Path {
111110
case "/", "/list":
112111
// Serve a list of all entries.

0 commit comments

Comments
 (0)