guardian/frontend

Remove `atom-renderer` dependency from `frontend`

ioannakok opened this issue · 1 comments

atom-renderer is the legacy library used by frontend to render atoms. It's a deprecated unmaintained repo. It is currently blocking the frontend Play 3 upgrade. Play 3 changes the group id from com.typesafe.play to org.playframework and we need to make sure frontend does not pull in any pre Play 3 dependency. The only one left is coming from atom-renderer. This has proven tricky to upgrade because it's so out-of-date. Also, it keeps causing issues whenever we're attempting a major upgrade in frontend, e.g. Node 20 in the past.

This ticket is to move the client-side code for the following atoms to frontend:

Tasks

Other options investigated

@arelra and myself investigated two alternatives

Option 1: Remove the dependency without moving any code to frontend

This cannot be done at this point. These routes are triggering calls of the library and they get ~150,000 hits per 15 days mostly by Editions and AMP.

GET /embed/atom/:atomType/:id controllers.AtomPageController.render(atomType: String, id: String, isJsEnabled: Boolean = true, hasVerticalScrollbar: Boolean = false)
GET /embed/atom/:atomType/:id/nojs controllers.AtomPageController.renderNoJs(atomType: String, id: String)
GET /embed/atom/:atomType/:id/nojs/scroll-y controllers.AtomPageController.renderNoJsVerticalScroll(atomType: String, id: String)

image

Option 2: Resurrect the repo and maintain it properly

This would need to:

  • Add CODEOWNERS
  • Add Snyk and / or Dependabot security monitoring
  • Fix any existing critical and high vulnerabilities
  • Add a build and a release action
  • Upgrade dependencies. They are really old, e.g. content-api-client (using 15.9 - latest is v25.0.1)

If we did this we would end up being the only consumers in the end. Current consumers are frontend, Ophan and MAPI. Ophan already have a ticket to remove it and MAPI uses it only in one place and it's easy to remove it.

We decided moving the code to frontend is the most straightforward approach at this point to unblock the Play 3 upgrade and make sure this won't cause us any issues in the future. Follow-up tickets will be created to prevent AMP and possibly Editions hitting the above routes and then we will re-examine if they can be removed.

After further investigation a chat with @JamieB-gu, @mxdvl and @alinaboghiu it turns out:

  • Editions is only rendering media atoms (videos) via atom-renderer
  • AMP is only rendering interactive and chart atoms via atom-renderer

We decided to:

  • Stop supporting interactive and chart atoms in AMP: guardian/dotcom-rendering#11045
  • Move the client-side code only for the media into frontend
  • Remove the dependency