many: remove "retractions" experiment

For golang/go#43265

Change-Id: Iac39814ce532adf5846bb768802a46ad7a77fa84
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/309609
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/content/static/html/helpers/_unit_header.tmpl b/content/static/html/helpers/_unit_header.tmpl
index 38fbe4e..a032f6f 100644
--- a/content/static/html/helpers/_unit_header.tmpl
+++ b/content/static/html/helpers/_unit_header.tmpl
@@ -203,27 +203,25 @@
         </span>
       </div>
     {{end}}
-    {{if (.Experiments.IsActive "retractions")}}
-      {{if .Unit.Deprecated}}
-        <div class="UnitHeader-banner UnitHeader-banner--deprecated">
-          <span class="Site-margin UnitHeader-bannerContent">
-            <strong>Deprecated</strong>
-            {{with .Unit.DeprecationComment}}
-              <strong>:</strong>&nbsp;{{.}}
-            {{end}}
-          </span>
-        </div>
-      {{end}}
-      {{if .Unit.Retracted}}
-        <div class="UnitHeader-banner UnitHeader-banner--retracted">
-          <span class="Site-margin UnitHeader-bannerContent">
-            <strong>Retracted</strong>
-              {{with .Unit.RetractionRationale}}
-              <strong>:</strong>&nbsp;{{.}}
-            {{end}}
-          </span>
-        </div>
-      {{end}}
+    {{if .Unit.Deprecated}}
+      <div class="UnitHeader-banner UnitHeader-banner--deprecated">
+        <span class="Site-margin UnitHeader-bannerContent">
+          <strong>Deprecated</strong>
+          {{with .Unit.DeprecationComment}}
+            <strong>:</strong>&nbsp;{{.}}
+          {{end}}
+        </span>
+      </div>
+    {{end}}
+    {{if .Unit.Retracted}}
+      <div class="UnitHeader-banner UnitHeader-banner--retracted">
+        <span class="Site-margin UnitHeader-bannerContent">
+          <strong>Retracted</strong>
+            {{with .Unit.RetractionRationale}}
+            <strong>:</strong>&nbsp;{{.}}
+          {{end}}
+        </span>
+      </div>
     {{end}}
     {{if .LatestMajorVersion}}
       <div class="UnitHeader-banner UnitHeader-banner--majorVersion" data-test-id="UnitHeader-majorVersionBanner">
diff --git a/internal/experiment.go b/internal/experiment.go
index fba5c0d..00c56c0 100644
--- a/internal/experiment.go
+++ b/internal/experiment.go
@@ -7,7 +7,6 @@
 
 const (
 	ExperimentInsertSymbols             = "insert-symbols"
-	ExperimentRetractions               = "retractions"
 	ExperimentSymbolHistoryVersionsPage = "symbol-history-versions-page"
 	ExperimentSymbolHistoryMainPage     = "symbol-history-main-page"
 	ExperimentUnitMetaWithLatest        = "unit-meta-with-latest"
@@ -17,7 +16,6 @@
 // a description of each experiment.
 var Experiments = map[string]string{
 	ExperimentInsertSymbols:             "Insert data into symbols, package_symbols, and documentation_symbols.",
-	ExperimentRetractions:               "Retrieve and display retraction and deprecation information.",
 	ExperimentSymbolHistoryVersionsPage: "Show package API history on the versions page.",
 	ExperimentSymbolHistoryMainPage:     "Show package API history on the main unit page.",
 	ExperimentUnitMetaWithLatest:        "Use latest-version information for GetUnitMeta.",
diff --git a/internal/frontend/versions.go b/internal/frontend/versions.go
index 2f82ee9..30f8d3b 100644
--- a/internal/frontend/versions.go
+++ b/internal/frontend/versions.go
@@ -112,7 +112,7 @@
 		}
 		return constructUnitURL(versionPath, mi.ModulePath, linkVersion(mi.Version, mi.ModulePath))
 	}
-	return buildVersionDetails(ctx, modulePath, versions, outVersionToNameToUnitSymbol, linkify), nil
+	return buildVersionDetails(modulePath, versions, outVersionToNameToUnitSymbol, linkify), nil
 }
 
 // pathInVersion constructs the full import path of the package corresponding
@@ -139,8 +139,7 @@
 // versions tab, organizing major versions into those that have the same module
 // path as the package version under consideration, and those that don't.  The
 // given versions MUST be sorted first by module path and then by semver.
-func buildVersionDetails(ctx context.Context,
-	currentModulePath string,
+func buildVersionDetails(currentModulePath string,
 	modInfos []*internal.ModuleInfo,
 	versionToNameToSymbol map[string]map[string]*internal.UnitSymbol,
 	linkify func(v *internal.ModuleInfo) string) *VersionsDetails {
@@ -187,12 +186,10 @@
 			Version:    linkVersion(mi.Version, mi.ModulePath),
 			IsMinor:    isMinor(mi.Version),
 		}
-		if experiment.IsActive(ctx, internal.ExperimentRetractions) {
-			key.Deprecated = mi.Deprecated
-			key.DeprecationComment = shortRationale(mi.DeprecationComment)
-			vs.Retracted = mi.Retracted
-			vs.RetractionRationale = shortRationale(mi.RetractionRationale)
-		}
+		key.Deprecated = mi.Deprecated
+		key.DeprecationComment = shortRationale(mi.DeprecationComment)
+		vs.Retracted = mi.Retracted
+		vs.RetractionRationale = shortRationale(mi.RetractionRationale)
 		if nts, ok := versionToNameToSymbol[mi.Version]; ok {
 			vs.Symbols = symbolsForVersion(linkify(mi), nts)
 		}
diff --git a/internal/postgres/insert_module_test.go b/internal/postgres/insert_module_test.go
index 291bb4c..6478f16 100644
--- a/internal/postgres/insert_module_test.go
+++ b/internal/postgres/insert_module_test.go
@@ -37,6 +37,7 @@
 	for _, test := range []struct {
 		name   string
 		module *internal.Module
+		goMod  string
 	}{
 		{
 			name:   "valid test",
@@ -74,15 +75,16 @@
 				m.DeprecationComment = "use v2"
 				return m
 			}(),
+			goMod: "module " + sample.ModulePath + " // Deprecated: use v2",
 		},
 	} {
 		t.Run(test.name, func(t *testing.T) {
 			testDB, release := acquire(t)
 			defer release()
 
-			MustInsertModule(ctx, t, testDB, test.module)
+			MustInsertModuleGoMod(ctx, t, testDB, test.module, test.goMod)
 			// Test that insertion of duplicate primary key won't fail.
-			MustInsertModule(ctx, t, testDB, test.module)
+			MustInsertModuleGoMod(ctx, t, testDB, test.module, test.goMod)
 			checkModule(ctx, t, testDB, test.module)
 		})
 	}
diff --git a/internal/postgres/unit.go b/internal/postgres/unit.go
index 5d48ebe..5cac3e2 100644
--- a/internal/postgres/unit.go
+++ b/internal/postgres/unit.go
@@ -124,20 +124,18 @@
 	}
 	um.Licenses = lics
 
-	if experiment.IsActive(ctx, internal.ExperimentRetractions) {
-		// If we don't have the latest version information, try to get it.
-		// We can be here if there is really no info (in which case we are repeating
-		// some work, but it's fast), or if we are ignoring the info (for instance,
-		// if all versions were retracted).
-		if lmv == nil {
-			lmv, err = db.GetLatestModuleVersions(ctx, um.ModulePath)
-			if err != nil {
-				return nil, err
-			}
+	// If we don't have the latest version information, try to get it.
+	// We can be here if there is really no info (in which case we are repeating
+	// some work, but it's fast), or if we are ignoring the info (for instance,
+	// if all versions were retracted).
+	if lmv == nil {
+		lmv, err = db.GetLatestModuleVersions(ctx, um.ModulePath)
+		if err != nil {
+			return nil, err
 		}
-		if lmv != nil {
-			lmv.PopulateModuleInfo(&um.ModuleInfo)
-		}
+	}
+	if lmv != nil {
+		lmv.PopulateModuleInfo(&um.ModuleInfo)
 	}
 	return &um, nil
 }
diff --git a/internal/postgres/unit_test.go b/internal/postgres/unit_test.go
index cf4f7ea..37780f3 100644
--- a/internal/postgres/unit_test.go
+++ b/internal/postgres/unit_test.go
@@ -26,13 +26,11 @@
 	t.Parallel()
 	ctx, cancel := context.WithTimeout(context.Background(), testTimeout*2)
 	defer cancel()
-	ctx = experiment.NewContext(ctx, internal.ExperimentRetractions)
 	t.Run("legacy", func(t *testing.T) {
 		testGetUnitMeta(t, ctx)
 	})
 	t.Run("latest", func(t *testing.T) {
-		testGetUnitMeta(t, experiment.NewContext(ctx,
-			internal.ExperimentRetractions, internal.ExperimentUnitMetaWithLatest))
+		testGetUnitMeta(t, experiment.NewContext(ctx, internal.ExperimentUnitMetaWithLatest))
 	})
 }
 
@@ -295,7 +293,7 @@
 			if got := modver(gotLegacy); got != test.wantLegacy {
 				t.Errorf("legacy: got %s, want %s", got, test.wantLegacy)
 			}
-			gotLatest, err := testDB.GetUnitMeta(experiment.NewContext(ctx, internal.ExperimentRetractions, internal.ExperimentUnitMetaWithLatest),
+			gotLatest, err := testDB.GetUnitMeta(experiment.NewContext(ctx, internal.ExperimentUnitMetaWithLatest),
 				test.path, internal.UnknownModulePath, internal.LatestVersion)
 			if err != nil {
 				t.Fatal(err)
diff --git a/internal/postgres/version.go b/internal/postgres/version.go
index 8c2fffa..5f9329c 100644
--- a/internal/postgres/version.go
+++ b/internal/postgres/version.go
@@ -10,7 +10,6 @@
 	"errors"
 	"fmt"
 	"strings"
-	"time"
 
 	"github.com/Masterminds/squirrel"
 	"github.com/lib/pq"
@@ -18,7 +17,6 @@
 	"golang.org/x/pkgsite/internal"
 	"golang.org/x/pkgsite/internal/database"
 	"golang.org/x/pkgsite/internal/derrors"
-	"golang.org/x/pkgsite/internal/experiment"
 	"golang.org/x/pkgsite/internal/log"
 	"golang.org/x/pkgsite/internal/version"
 	"golang.org/x/sync/errgroup"
@@ -115,17 +113,13 @@
 func populateLatestInfo(ctx context.Context, db *DB, mi *internal.ModuleInfo) (err error) {
 	defer derrors.WrapStack(&err, "populateLatestInfo(%q)", mi.ModulePath)
 
-	if experiment.IsActive(ctx, internal.ExperimentRetractions) {
-		// Get information about retractions an deprecations, and apply it.
-		start := time.Now()
-		lmv, err := db.GetLatestModuleVersions(ctx, mi.ModulePath)
-		if err != nil {
-			return err
-		}
-		if lmv != nil {
-			lmv.PopulateModuleInfo(mi)
-		}
-		log.Debugf(ctx, "latest info fetched and applied in %dms", time.Since(start).Milliseconds())
+	// Get information about retractions an deprecations, and apply it.
+	lmv, err := db.GetLatestModuleVersions(ctx, mi.ModulePath)
+	if err != nil {
+		return err
+	}
+	if lmv != nil {
+		lmv.PopulateModuleInfo(mi)
 	}
 	return nil
 }
@@ -133,27 +127,23 @@
 func populateLatestInfos(ctx context.Context, db *DB, mis []*internal.ModuleInfo) (err error) {
 	defer derrors.WrapStack(&err, "populateLatestInfos(%d ModuleInfos)", len(mis))
 
-	if experiment.IsActive(ctx, internal.ExperimentRetractions) {
-		start := time.Now()
-		// Collect the LatestModuleVersions for all modules in the list.
-		lmvs := map[string]*internal.LatestModuleVersions{}
-		for _, mi := range mis {
-			if _, ok := lmvs[mi.ModulePath]; !ok {
-				lmv, err := db.GetLatestModuleVersions(ctx, mi.ModulePath)
-				if err != nil {
-					return err
-				}
-				lmvs[mi.ModulePath] = lmv
+	// Collect the LatestModuleVersions for all modules in the list.
+	lmvs := map[string]*internal.LatestModuleVersions{}
+	for _, mi := range mis {
+		if _, ok := lmvs[mi.ModulePath]; !ok {
+			lmv, err := db.GetLatestModuleVersions(ctx, mi.ModulePath)
+			if err != nil {
+				return err
 			}
+			lmvs[mi.ModulePath] = lmv
 		}
-		// Use the collected LatestModuleVersions to populate the ModuleInfos.
-		for _, mi := range mis {
-			lmv := lmvs[mi.ModulePath]
-			if lmv != nil {
-				lmv.PopulateModuleInfo(mi)
-			}
+	}
+	// Use the collected LatestModuleVersions to populate the ModuleInfos.
+	for _, mi := range mis {
+		lmv := lmvs[mi.ModulePath]
+		if lmv != nil {
+			lmv.PopulateModuleInfo(mi)
 		}
-		log.Debugf(ctx, "latest info fetched and applied in %dms", time.Since(start).Milliseconds())
 	}
 	return nil
 }
diff --git a/internal/postgres/version_test.go b/internal/postgres/version_test.go
index 0f81dd4..7b09998 100644
--- a/internal/postgres/version_test.go
+++ b/internal/postgres/version_test.go
@@ -12,7 +12,6 @@
 
 	"github.com/google/go-cmp/cmp"
 	"golang.org/x/pkgsite/internal"
-	"golang.org/x/pkgsite/internal/experiment"
 	"golang.org/x/pkgsite/internal/source"
 	"golang.org/x/pkgsite/internal/stdlib"
 	"golang.org/x/pkgsite/internal/testing/sample"
@@ -231,7 +230,6 @@
 		},
 	}
 
-	ctx = experiment.NewContext(ctx, internal.ExperimentRetractions)
 	for _, test := range testCases {
 		t.Run(test.name, func(t *testing.T) {
 			for _, w := range test.want {
diff --git a/internal/testing/integration/integration_test.go b/internal/testing/integration/integration_test.go
index 52b7158..4c447ca 100644
--- a/internal/testing/integration/integration_test.go
+++ b/internal/testing/integration/integration_test.go
@@ -18,7 +18,6 @@
 	"github.com/google/go-cmp/cmp"
 	"github.com/google/safehtml/template"
 	"golang.org/x/pkgsite/internal"
-	"golang.org/x/pkgsite/internal/experiment"
 	"golang.org/x/pkgsite/internal/godoc/dochtml"
 	"golang.org/x/pkgsite/internal/index"
 	"golang.org/x/pkgsite/internal/middleware"
@@ -40,7 +39,6 @@
 func TestEndToEndProcessing(t *testing.T) {
 	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
 	defer cancel()
-	ctx = experiment.NewContext(ctx, internal.ExperimentRetractions)
 
 	defer postgres.ResetTestDB(testDB, t)