From fea5977a59cea66393bd988a57d649029646e358 Mon Sep 17 00:00:00 2001 From: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com> Date: Wed, 3 Jun 2026 00:22:11 +0200 Subject: [PATCH] feat(impl-generate): enable interactive HTML previews for JavaScript libs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The browser render harness already emits standalone plot-{light,dark}.html for JS implementations, the GCS upload promotes them (gated only on file existence), and the frontend renders preview_html when present — but the metadata HAS_HTML allowlist only listed the 6 Python interactive libs, so preview_html_light/dark were written as null for chartjs/d3/echarts. The interactive HTML sat in production GCS unused (e.g. .../echarts/plot-light.html returns 200) and no "Interactive" toggle appeared on the site. Enable HTML for JavaScript libs in both the metadata block and the issue-preview step. Gate on the plot-{light,dark}.html files actually existing (rather than language alone), so a lib or render that produced no HTML can never point preview_html at a 404. Verified all three current JS libs emit both theme HTMLs (staging returns 200 for chartjs/d3, production for echarts). Already-generated JS impls must be regenerated to pick up the URLs (the HTML itself is already uploaded to GCS). Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/impl-generate.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/impl-generate.yml b/.github/workflows/impl-generate.yml index fb3ca01774..5ec2b8bd66 100644 --- a/.github/workflows/impl-generate.yml +++ b/.github/workflows/impl-generate.yml @@ -649,11 +649,18 @@ jobs: fi echo "::notice::Library version: $LIBRARY = $LIBRARY_VERSION ($LANGUAGE runtime $LANGUAGE_VERSION, pipeline python $PYTHON_VERSION)" - # Interactive libraries additionally produce HTML previews (one per theme) + # Interactive libraries additionally produce HTML previews (one per theme). + # Python interactive libs are listed explicitly. JavaScript libs are + # interactive too (the browser render harness emits standalone + # plot-{light,dark}.html) — but gate on the files actually existing, so a + # lib/render that produced no HTML never points preview_html at a 404. HAS_HTML="false" case "$LIBRARY" in plotly|bokeh|altair|highcharts|pygal|letsplot) HAS_HTML="true" ;; esac + if [ "$LANGUAGE" = "javascript" ] && [ -f "$IMPL_DIR/plot-light.html" ] && [ -f "$IMPL_DIR/plot-dark.html" ]; then + HAS_HTML="true" + fi # Write metadata file using Python for proper YAML formatting # Pass all variables inline to avoid export/env issues @@ -943,6 +950,13 @@ jobs: HTML_DARK="${BASE}/plot-dark.html" ;; esac + # JS libs are interactive too — link the HTML only when the render + # produced it (mirrors the existence gate used for preview_html). + IMPL_DIR="plots/${SPEC_ID}/implementations/${LANGUAGE}" + if [ "$LANGUAGE" = "javascript" ] && [ -f "$IMPL_DIR/plot-light.html" ] && [ -f "$IMPL_DIR/plot-dark.html" ]; then + HTML_LIGHT="${BASE}/plot-light.html" + HTML_DARK="${BASE}/plot-dark.html" + fi BODY="## :art: ${LANGUAGE}/${LIBRARY} Preview