Skip to content

Draw the illustration, not the zoom control, and stop 404ing its download - #271

Merged
adamjohnwright merged 3 commits into
mainfrom
fix/illustration-renders
Sep 20, 2026
Merged

adamjohnwright merged 3 commits into
mainfrom
fix/illustration-renders

Conversation

@adamjohnwright

@adamjohnwright adamjohnwright commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Two faults, both hitting illustrated pathways, both invisible to the tests because every illustration test used Apoptosis — 502 SVG elements, the lightest one there is. Plus a third, found reviewing the first commit.

96 of 218 illustrations rendered as a picture of the zoom control

The render page called itself ready as soon as cr-ehld svg matched anything, and the component's 70×70 zoom control is in the DOM from the first frame while the illustration is still being fetched. Watched frame by frame, at the instant readiness fired:

{"ready":"false","any":"70x70/19","inner":"none"}
{"ready":"true", "any":"70x70/19","inner":"none"}

exportPng then rasterised what the same selector found: 140×140, 8,091 bytes — over the 5,000-byte floor, so it passed the size check, was cached, and was served. The heavier the illustration the likelier it lost, so the casualties were Signal Transduction, Developmental Biology and Cytokine Signaling in Immune System, three of the most-visited pathways on the site, while the test fixture sailed through. The same URL feeds the picture on those pathways' content detail pages.

This is the fault the comment three lines above already describes for the diagram's legend, in the branch immediately below it.

#ehld is the div the illustration is injected into, and all four selectors now say so — the readiness probe and the three exporters, which have to agree on what they mean. Re-scanned all 218 afterwards: 96 broken before, 1 after, and that one is a different fault.

All 218 illustrated pathways 404'd on download

SVG, PNG and JPEG went to the content service's exporter, which reads pre-made files from download/current/ehld/ rather than drawing anything — an empty directory here, and 11 of 9,559 diagram files beside it.

The page already has the illustration on screen, and downloadImage already made the file whenever an analysis was running, at scale 3 against the render service's 2. It now always does, so the download depends on nothing being present anywhere. getExportUrl goes with it.

A figure that cannot be made now says so

This is the correction to the first commit, which claimed the tainted-canvas failure "says which file and why". It does through the render service, which returns the reason in its 500. In the download tab it did not: the message went to console.error, and clicking PNG on Circadian clock produced no file, no text on screen, and one console line nobody had open. Checked in a browser rather than assumed.

All three client-side exporters were the same — illustration, diagram and genome-wide view each end with .catch((error) => console.error(...)) — so any figure that cannot be made was indistinguishable from a button that is not wired up. A failed cytoscape export was always just as quiet; the illustration is only where it became visible.

DownloadService grows a failure signal, set by a failed() that also clears the in-progress request, rendered under the format buttons in the theme's own --negative. One catch is deliberately left alone: reacfoam.component.ts:243 has the same shape and is not a download at all — it selects a reaction's parent pathway — and routing it here would have shown a download error for an unrelated failure.

The remaining illustration is artwork, not code

Circadian clock (R-HSA-9909396) builds six shapes out of <foreignObject>, which is how a design tool exports a conic gradient — SVG has no such gradient of its own. Chromium taints a canvas the moment one is drawn onto it and refuses toDataURL. Nothing can rasterise it in a browser. It is the only one of the 218, and it is in CURATOR-REPORT.md as a re-export request.

Tests

downloads.spec.ts gains a heavy illustration, R-HSA-162582, through the download tab and through the render service — the latter because a content detail page takes its picture from there too, and a wrong render was cached and re-served. Both read the PNG's own IHDR dimensions rather than its size, because size is exactly what did not catch this. A third test clicks PNG on Circadian clock and expects the reason on screen.

All three were shown red on what they claim to measure: with the floor raised the first two report 3200x2000 and 3063x1575, and asserting different text reports the whole sentence the panel really shows.

Worth knowing: the render-service tests here only run when the render service is up, and preflight runs e2e without it, so they skip in CI. Four of them fail locally on main as well, for missing recordings — pre-existing, not touched by this.

Verified on beta

R-HSA-162582  (3200, 2000)  3022584 bytes
R-HSA-1266738 (3200, 2000)  5586546 bytes
R-HSA-1280215 (3200, 2000)  2806448 bytes

Bad cache entries purged. Gates: 359 unit tests, lint 652 and dead 145 unchanged from baseline, types, format, preflight all clear, and a production build — the last because check:types runs tsc and would not have seen a mistake in the new template block.

🤖 Generated with Claude Code

adamjohnwright and others added 3 commits September 20, 2026 03:38
…load

Two faults, both hitting illustrated pathways, both invisible to the tests
because every illustration test used Apoptosis — 502 SVG elements, the
lightest one there is.

**96 of 218 illustrations rendered as a 140x140 picture of the zoom
control.** The render page reported itself ready as soon as
`cr-ehld svg` matched anything, and the component's 70x70 zoom control is
in the DOM from the first frame while the illustration is still being
fetched. Watched frame by frame, at the instant readiness fired:

    {"ready":"false","any":"70x70/19","inner":"none"}
    {"ready":"true", "any":"70x70/19","inner":"none"}

`exportPng` then rasterised what the same selector found, giving 8,091
bytes — over the 5,000-byte floor, so it was cached and served. The
heavier the illustration the likelier it lost, so the casualties were
Signal Transduction, Developmental Biology and Cytokine Signaling in
Immune System, three of the most-visited pathways on the site, while the
test fixture sailed through. This is the fault the comment three lines
above already describes for the diagram's legend.

`#ehld` is the div the illustration is injected into, and all four
selectors now say so — the readiness probe and the three exporters, which
have to agree on what they mean. Re-scanned all 218 afterwards: 96 broken
before, 1 after, and that one is a different fault.

**All 218 illustrated pathways 404'd on download.** SVG, PNG and JPEG went
to the content service's exporter, which reads pre-made files from
`download/current/ehld/` rather than drawing anything — an empty directory
here, and 11 of 9,559 diagram files beside it. The page already has the
illustration on screen and `downloadImage` already made the file whenever
an analysis was running, at scale 3 against the render service's 2. It now
always does, so the download depends on nothing being present anywhere.
`getExportUrl` goes with it.

**The one remaining illustration is artwork, not code.** Circadian clock
builds six shapes out of `<foreignObject>`, which is how a design tool
exports a conic gradient; Chromium taints a canvas the moment one is drawn
onto it and refuses `toDataURL`. Nothing can rasterise it in a browser, so
this says which file and why instead of surfacing "Tainted canvases may
not be exported" from four frames away. Recorded for the curators.

Tests: `downloads.spec.ts` gains a heavy illustration, R-HSA-162582,
through the download tab and through the render service — the latter
because a content detail page takes its picture from there too, and a
wrong render was cached and re-served. Both read the PNG's own IHDR
dimensions, and both were shown to fail on what they claim to measure:
with the floor raised they report `3200x2000` and `3063x1575`. The wait in
`openDownloadTab` is tightened for the same reason as the probe.

Gates: 359 unit tests, lint 652 and dead 145 unchanged, types and format
clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Found reviewing the commit before this one, which claimed the tainted
canvas now "says which file and why". It does through the render service,
which returns the reason in its 500. In the download tab it did not: the
message went to `console.error` and the reader saw a button that did
nothing. Clicked it in a browser to be sure — no file, no text on screen,
one console line nobody had open.

All three client-side exporters were the same. The illustration, the
diagram and the genome-wide view each end their export with
`.catch((error) => console.error(...))`, so any figure that cannot be made
is indistinguishable from a button that is not wired up. The one
illustration a browser refuses to rasterise is simply where it became
visible; a failed cytoscape export was always just as quiet.

`DownloadService` grows a `failure` signal, set by a `failed()` that also
clears the in-progress request, and the download tab renders it under the
format buttons in the theme's own `--negative`, which is redefined for
dark mode. A new request clears the last complaint, so a reason that has
been dealt with does not sit under a download that is working.

One catch is deliberately left alone. `reacfoam.component.ts:243` looked
like the same shape and is not a download at all — it is the effect that
selects a reaction's parent pathway, and routing it here would have shown
a download error for a failure that has nothing to do with downloading.
It keeps its own message, now named for what it actually does.

Tested end to end on Circadian clock: click PNG, and the panel says the
illustration embeds HTML in a `<foreignObject>` and to take the SVG.
Shown red first — asserting different text reports what is really on
screen, which is the whole sentence.

Gates: 359 unit tests, lint 652 and dead 145 unchanged, types, format, and
a production build clean — the last because `check:types` runs tsc and
would not have seen a mistake in the new template block.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright enabled auto-merge (squash) September 20, 2026 04:29
@adamjohnwright
adamjohnwright merged commit 800ddcd into main Sep 20, 2026
6 checks passed
@adamjohnwright
adamjohnwright deleted the fix/illustration-renders branch September 20, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant