Skip to content

Commit

Permalink
Merge pull request #27569 from guardian/doml/remove-lite-fronts-switch
Browse files Browse the repository at this point in the history
Remove lite-fronts experiment
  • Loading branch information
domlander authored Oct 29, 2024
2 parents a75e590 + 846c105 commit a09b6e3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 54 deletions.
10 changes: 0 additions & 10 deletions common/app/experiments/Experiments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import java.time.LocalDate
object ActiveExperiments extends ExperimentsDefinition {
override val allExperiments: Set[Experiment] =
Set(
RemoveLiteFronts,
EuropeBetaFront,
DarkModeWeb,
)
Expand Down Expand Up @@ -39,12 +38,3 @@ object DarkModeWeb
sellByDate = LocalDate.of(2025, 1, 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("[email protected]")),
sellByDate = LocalDate.of(2024, 10, 30),
participationGroup = Perc10A,
)
4 changes: 1 addition & 3 deletions facia/app/AppLoader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
26 changes: 0 additions & 26 deletions facia/app/FaciaErrorHandler.scala

This file was deleted.

16 changes: 6 additions & 10 deletions facia/app/controllers/FaciaController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -221,16 +221,14 @@ 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)
if (path == "europe-beta" && !inEuropeBetaTest) {
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(
Expand All @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 1 addition & 5 deletions facia/app/services/dotcomrendering/FaciaPicker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -126,7 +124,7 @@ object FaciaPicker extends GuLogging {
dcrNetworkFrontsSwitchEnabled,
)

logTier(faciaPage, dcrCouldRender, checks, tier, isFullFrontRequest)
logTier(faciaPage, dcrCouldRender, checks, tier)

tier
}
Expand Down Expand Up @@ -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) =>
Expand All @@ -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)
Expand Down

0 comments on commit a09b6e3

Please sign in to comment.