From 846c105de2c6f15985bf67386b83d854b6b1cf68 Mon Sep 17 00:00:00 2001 From: Dominik Lander Date: Tue, 29 Oct 2024 09:30:32 +0000 Subject: [PATCH] Remove lite-fronts experiment --- common/app/experiments/Experiments.scala | 10 ------- facia/app/AppLoader.scala | 4 +-- facia/app/FaciaErrorHandler.scala | 26 ------------------- facia/app/controllers/FaciaController.scala | 16 +++++------- .../dotcomrendering/FaciaPicker.scala | 6 +---- 5 files changed, 8 insertions(+), 54 deletions(-) delete mode 100644 facia/app/FaciaErrorHandler.scala diff --git a/common/app/experiments/Experiments.scala b/common/app/experiments/Experiments.scala index d10480a2069e..8e0bffa75e43 100644 --- a/common/app/experiments/Experiments.scala +++ b/common/app/experiments/Experiments.scala @@ -11,7 +11,6 @@ import java.time.LocalDate object ActiveExperiments extends ExperimentsDefinition { override val allExperiments: Set[Experiment] = Set( - RemoveLiteFronts, EuropeBetaFront, DarkModeWeb, ) @@ -39,12 +38,3 @@ object DarkModeWeb sellByDate = LocalDate.of(2024, 10, 30), participationGroup = Perc0D, ) - -object RemoveLiteFronts - extends Experiment( - name = "remove-lite-fronts", - description = "Get the full pressed page of a front instead of the lite version", - owners = Seq(Owner.withEmail("dotcom.platform@theguardian.com")), - sellByDate = LocalDate.of(2024, 10, 30), - participationGroup = Perc10A, - ) diff --git a/facia/app/AppLoader.scala b/facia/app/AppLoader.scala index c38f95b54604..e1677a9c5c29 100644 --- a/facia/app/AppLoader.scala +++ b/facia/app/AppLoader.scala @@ -16,7 +16,7 @@ import model.ApplicationIdentity import services.ophan.SurgingContentAgentLifecycle import play.api.ApplicationLoader.Context import play.api.BuiltInComponentsFromContext -import play.api.http.{HttpErrorHandler, HttpRequestHandler} +import play.api.http.HttpRequestHandler import play.api.mvc.EssentialFilter import play.api.routing.Router import play.api.libs.ws.WSClient @@ -74,8 +74,6 @@ trait AppComponents extends FrontendComponents with FaciaControllers with FapiSe DCRMetrics.DCRRequestCountMetric, ) - override lazy val httpErrorHandler: HttpErrorHandler = wire[FaciaErrorHandler] - val frontendBuildInfo: FrontendBuildInfo = frontend.facia.BuildInfo override lazy val httpFilters: Seq[EssentialFilter] = wire[CommonFilters].filters override lazy val httpRequestHandler: HttpRequestHandler = wire[DevParametersHttpRequestHandler] diff --git a/facia/app/FaciaErrorHandler.scala b/facia/app/FaciaErrorHandler.scala deleted file mode 100644 index 8d4f6166466a..000000000000 --- a/facia/app/FaciaErrorHandler.scala +++ /dev/null @@ -1,26 +0,0 @@ -import common.GuLogging -import common.LoggingField.LogFieldBoolean -import experiments.{ActiveExperiments, RemoveLiteFronts} -import play.api._ -import play.api.http.DefaultHttpErrorHandler -import play.api.mvc._ -import play.api.routing.Router -import play.core.SourceMapper - -class FaciaErrorHandler(env: Environment, config: Configuration, sourceMapper: Option[SourceMapper], router: => Router) - extends DefaultHttpErrorHandler(env, config, sourceMapper, Some(router)) - with GuLogging { - - override def logServerError(request: RequestHeader, usefulException: UsefulException): Unit = { - lazy val isFullFrontRequest = ActiveExperiments.isParticipating(RemoveLiteFronts)(request) - - logErrorWithCustomFields( - """ - | - |! @%s - Internal server error, for (%s) [%s] -> - | """.stripMargin.format(usefulException.id, request.method, request.uri), - usefulException, - List(LogFieldBoolean("isFullFrontRequest", isFullFrontRequest)), - ) - } -} diff --git a/facia/app/controllers/FaciaController.scala b/facia/app/controllers/FaciaController.scala index 9fdacb015e68..ca80f685e31f 100644 --- a/facia/app/controllers/FaciaController.scala +++ b/facia/app/controllers/FaciaController.scala @@ -6,7 +6,7 @@ import common._ import conf.Configuration import conf.switches.Switches.InlineEmailStyles import controllers.front._ -import experiments.{ActiveExperiments, EuropeBetaFront, RemoveLiteFronts} +import experiments.{ActiveExperiments, EuropeBetaFront} import http.HttpPreconnections import implicits.GUHeaders import layout.slices._ @@ -140,7 +140,7 @@ trait FaciaController successful(Cached(CacheTime.Facia)(notFound())) } else { frontJsonFapi - .get(path, requestType) + .get(path, liteRequestType) .map(_.fold[CacheableResult](notFound())(FrontHeadline.renderEmailHeadline)) .map(Cached(CacheTime.Facia)) } @@ -181,7 +181,7 @@ trait FaciaController Cached(CacheTime.Facia)(JsonComponent.fromWritable(JsObject(Nil))), ) } else { - frontJsonFapi.get(path, requestType).map { resp => + frontJsonFapi.get(path, liteRequestType).map { resp => Cached(CacheTime.Facia)(JsonComponent.fromWritable(resp match { case Some(pressedPage) => FapiFrontJsonMinimal.get(pressedPage) case None => JsObject(Nil) @@ -221,8 +221,6 @@ trait FaciaController import PressedPage.pressedPageFormat private[controllers] def renderFrontPressResult(path: String)(implicit request: RequestHeader): Future[Result] = { - val NonAdFreeType = if (ActiveExperiments.isParticipating(RemoveLiteFronts)) FullType else LiteType - // Europe beta experiment // Phase 1 prevents users from being able to view the europe-beta front unless opted into the test val inEuropeBetaTest = ActiveExperiments.isParticipating(EuropeBetaFront) @@ -230,7 +228,7 @@ trait FaciaController return successful(Cached(CacheTime.NotFound)(WithoutRevalidationResult(NotFound))) } - val futureFaciaPage: Future[Option[(PressedPage, Boolean)]] = frontJsonFapi.get(path, requestType).flatMap { + val futureFaciaPage: Future[Option[(PressedPage, Boolean)]] = frontJsonFapi.get(path, liteRequestType).flatMap { case Some(faciaPage: PressedPage) => val pageContainsTargetedCollections = TargetedCollections.pageContainsTargetedCollections(faciaPage) val regionalFaciaPage = TargetedCollections.processTargetedCollections( @@ -245,8 +243,8 @@ trait FaciaController List(), ) } - if (faciaPage.collections.isEmpty && (requestType == FullAdFreeType || requestType == LiteAdFreeType)) { - frontJsonFapi.get(path, NonAdFreeType).map(_.map(f => (f, false))) + if (faciaPage.collections.isEmpty && liteRequestType == LiteAdFreeType) { + frontJsonFapi.get(path, LiteType).map(_.map(f => (f, false))) } else Future.successful(Some(regionalFaciaPage, pageContainsTargetedCollections)) case None => Future.successful(None) } @@ -537,8 +535,6 @@ trait FaciaController if (request.isAdFree) FullAdFreeType else FullType def liteRequestType(implicit request: RequestHeader): PressedPageType = if (request.isAdFree) LiteAdFreeType else LiteType - def requestType(implicit request: RequestHeader): PressedPageType = - if (ActiveExperiments.isParticipating(RemoveLiteFronts)) fullRequestType else liteRequestType def ampRsaPublicKey: Action[AnyContent] = { Action { diff --git a/facia/app/services/dotcomrendering/FaciaPicker.scala b/facia/app/services/dotcomrendering/FaciaPicker.scala index 6a2573957f5b..8804d1592ff8 100644 --- a/facia/app/services/dotcomrendering/FaciaPicker.scala +++ b/facia/app/services/dotcomrendering/FaciaPicker.scala @@ -2,7 +2,6 @@ package services.dotcomrendering import common.{Edition, GuLogging} import conf.switches.Switches.{DCRFronts, DCRNetworkFronts} -import experiments.{ActiveExperiments, RemoveLiteFronts} import implicits.Requests._ import model.PressedPage import model.facia.PressedCollection @@ -113,7 +112,6 @@ object FaciaPicker extends GuLogging { lazy val dcrCouldRender = checks.values.forall(checkValue => checkValue) lazy val isNetworkFront = faciaPage.isNetworkFront lazy val dcrNetworkFrontsSwitchEnabled = DCRNetworkFronts.isSwitchedOn - lazy val isFullFrontRequest = ActiveExperiments.isParticipating(RemoveLiteFronts) val tier = decideTier( @@ -126,7 +124,7 @@ object FaciaPicker extends GuLogging { dcrNetworkFrontsSwitchEnabled, ) - logTier(faciaPage, dcrCouldRender, checks, tier, isFullFrontRequest) + logTier(faciaPage, dcrCouldRender, checks, tier) tier } @@ -157,7 +155,6 @@ object FaciaPicker extends GuLogging { dcrCouldRender: Boolean, checks: Map[String, Boolean], tier: RenderType, - isFullFrontRequest: Boolean, )(implicit request: RequestHeader): Unit = { val tierReadable = if (tier == RemoteRender) "dotcomcomponents" else "web" val checksToString = checks.map { case (key, value) => @@ -170,7 +167,6 @@ object FaciaPicker extends GuLogging { "dcrCouldRender" -> dcrCouldRender.toString, "isFront" -> "true", "tier" -> tierReadable, - "isFullFrontRequest" -> isFullFrontRequest.toString, ) ++ checksToString DotcomFrontsLogger.logger.logRequest(s"front executing in $tierReadable", properties, faciaPage)