Skip to content

Render service: read the release's files from a local folder (RENDER_FILES) - #777

Merged
adamjohnwright merged 1 commit into
mainfrom
render/local-files
Nov 2, 2026
Merged

adamjohnwright merged 1 commit into
mainfrom
render/local-files

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

The render page fetches a diagram's layout ({release}/diagram/{id}.json, .graph.json) and an illustration ({release}/ehld/{id}.svg) from the download site, as a reader's browser does. That is right for a reader's browser, which is what the CDN is for, and wrong for the render service: it draws in bulk, and a release's own figures are drawn before the release's files are on the download site.

What changes

  • New tools/render/local-files.ts: with a folder given, every request the page makes to the download site is answered from that folder, laid out as the site is (<folder>/98/diagram/R-HSA-73857.json). A file the folder lacks is a 404, never a request to the site. A path that would leave the folder (an encoded ../) is a 404 too.
  • render() takes a files option and installs the route only while it draws; the service reads RENDER_FILES; the CLI takes --files. /health names the source in use.
  • Unset, nothing changes: beta keeps fetching from the download site.

Checked

  • Unit tests for the folder lookup (types, 404, escapes) and for the route being installed only with a folder and removed after. Each was seen failing: the escape case with the containment check removed, the route case with the route not installed.
  • Live, with the CLI against this site: an illustration (R-HSA-109581) and a plain diagram (R-HSA-73857, 410 elements) draw from a folder holding their files, and fail with an empty folder, so nothing reached the download site.
  • Known: a file missing from the folder makes the page wait out the timeout rather than report an error (existing page behaviour); the README says to check the folder first.

Wanted by pdf-export spec 001 (research R10): its figures' step draws a release's figures before the release is published.

🤖 Generated with Claude Code

…FILES)

The render page fetches a diagram's layout and an illustration from the
download site, as a reader's browser does. For the render service that is the
wrong source: it draws in bulk, and a release's own figures are drawn before
the release's files are on the download site. With RENDER_FILES set (--files
for the CLI), every request the page makes to the download site is answered
from that folder, laid out as the site is, and a file the folder lacks is a
404, never a request to the site. Unset, nothing changes. /health names the
source in use.

Wanted by pdf-export's spec 001 (research R10), whose figures' step draws a
release's figures before it is published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit fe0b067 into main Nov 2, 2026
8 checks passed
@adamjohnwright
adamjohnwright deleted the render/local-files branch November 2, 2026 20:30
adamjohnwright added a commit that referenced this pull request Nov 2, 2026
Render service, from #777's review: RENDER_FILES checked, contained and keyed
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