Skip to content

Serve the diagram and reaction figure exports from node, on the ContentService paths #273

Description

@adamjohnwright

The node render service (tools/render) already produces every diagram figure the site offers, drawn by the site's own renderer rather than a second reimplementation of it. It answers on /RenderService/render/<id>.<ext>, a path that exists on beta and not on production.

That extra path is the problem. The figures it makes are the ones /ContentService/exporter/diagram/<id>.<ext> and /exporter/reaction/<id>.<ext> have always made, so a second URL for the same thing means external consumers keep the old one, our own tests cannot assert against a path that exists everywhere, and the two can drift.

Proposal: node answers the existing ContentService paths, with Tomcat behind it as a backup upstream — the arrangement already proven for /data/content/ in #269. Nothing outside has to change, and anything node does not answer still reaches Java.

What already lines up

/render/:name.:ext is the same request in different clothes: tokentoken, selselect, viewview, plus our own subpathways, dark and scale. The routing is an nginx location for the prefix pointing at the node upstream.

What has to be closed first

jpeg and jpg. Java's enum is png, jpg, jpeg, svg, gif; the render service is svg, png, pdf, gif, pptx and returns 400 for jpeg. Taking the path over without it is a format regression. Small: the canvas is already there, and ehld.service.ts already handles JPEG having no alpha channel.

Eleven parameters we do not implement: quality, flg, flgInteractors, title, margin, ehld, diagramProfile, analysisProfile, resource, expColumn, includeRef. Our own site uses almost none of them, but this is a public URL and we cannot enumerate who calls it. Each needs a decision — honour it, or reject the request naming the parameter. Ignoring one silently is the outcome to avoid: flg dropped on the floor renders a figure without the flagged entity and returns 200, which no caller can detect.

Rate limiting in front, before the switch, not after. A render costs seconds where a static file costs milliseconds, and this path is public and crawled. That work is already on the list before the render service can front reactome.org; this issue depends on it rather than repeating it.

Why it is likely to be an improvement rather than a risk

The render service answers 503 beyond a bounded queue instead of accumulating work, caches on the request, and coalesces concurrent requests for the same pathway into one render — four concurrent became one, measured. The exports it replaces have none of that.

What it unblocks

Five tests in e2e/downloads.spec.ts assert on figure formats and are gated on the render service being up. CI does not run it, so they never execute there; where it is running they fail for want of a recording. Once the figures come from a path that exists on every deployment, those assertions can live in the release suite and run against real output.

Order

  1. add jpeg/jpg
  2. decide each unimplemented parameter: honour, or reject naming it
  3. rate limiting in front
  4. route the two paths to node with Tomcat as backup
  5. move the figure-format assertions to the release suite

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions