From a8eec0d740c8fbc6ef9b4b643c3ccee304af4e61 Mon Sep 17 00:00:00 2001 From: Patrick Buckley Date: Wed, 13 May 2026 16:09:16 -0700 Subject: [PATCH] fix(vendor): widen update-vendored-js sweep to catch shared_static/ + .py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shared_static exclude in scripts/update-vendored-js.sh was meant to skip self-references inside vendored libraries, but it also hid shared_static/renderer.js — which loads the vendored libs and pinned mermaid-11.14.0 across every renovate bump since #426. Tests under tests/test_web_helpers.py were similarly invisible because the include list omitted *.py. Replace the broad shared_static exclude with the specific old-versioned vendor directory (about to be rm -rf'd next anyway), and add *.py to the include list. Bump renderer.js to mermaid-11.15.0 to repair the live 404, and refresh the test fixtures to current vendor versions so they stop drifting. --- scripts/update-vendored-js.sh | 9 ++++++--- tests/test_web_helpers.py | 10 +++++----- turnstone/shared_static/renderer.js | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/update-vendored-js.sh b/scripts/update-vendored-js.sh index 65779b9f..a5c8bb49 100755 --- a/scripts/update-vendored-js.sh +++ b/scripts/update-vendored-js.sh @@ -50,11 +50,14 @@ update_refs() { local old_pattern="$1" # e.g. katex-0.16.38 local new_pattern="$2" # e.g. katex-0.16.39 - # Find all files with version references (excludes vendored JS and worktrees) + # Find all files with version references. Excludes the old versioned vendor + # directory itself (about to be rm -rf'd anyway) so we don't bother rewriting + # self-references inside it — but does NOT exclude all of shared_static/, + # because shared_static/renderer.js loads the vendored libs and needs the bump. local files - files=$(grep -rl --include='*.toml' --include='*.html' --include='*.js' --include='*.md' \ + files=$(grep -rl --include='*.toml' --include='*.html' --include='*.js' --include='*.md' --include='*.py' \ -F "$old_pattern" . \ - --exclude-dir='.claude' --exclude-dir='node_modules' --exclude-dir='shared_static' \ + --exclude-dir='.claude' --exclude-dir='node_modules' --exclude-dir="$old_pattern" \ 2>/dev/null || true) for f in $files; do sed -i "s|${old_pattern}|${new_pattern}|g" "$f" diff --git a/tests/test_web_helpers.py b/tests/test_web_helpers.py index 1d8ed9bf..8d848779 100644 --- a/tests/test_web_helpers.py +++ b/tests/test_web_helpers.py @@ -29,7 +29,7 @@ class TestVersionHtml: def test_vendored_katex_skipped(self): from turnstone.core.web_helpers import version_html - html = '' + html = '' result = version_html(html) assert result == html # unchanged @@ -43,14 +43,14 @@ class TestVersionHtml: def test_vendored_mermaid_skipped(self): from turnstone.core.web_helpers import version_html - html = '' + html = '' result = version_html(html) assert result == html # unchanged def test_vendored_hls_skipped(self): from turnstone.core.web_helpers import version_html - html = '' + html = '' result = version_html(html) assert result == html # unchanged @@ -76,7 +76,7 @@ class TestVersionHtml: html = ( '\n' - '\n' + '\n' '\n' '\n' '\n' @@ -88,7 +88,7 @@ class TestVersionHtml: assert f'/shared/utils.js?v={__version__}"' in result assert f'/static/app.js?v={__version__}"' in result # Vendored libs unchanged - assert '/shared/katex-0.16.44/katex.min.css"' in result + assert '/shared/katex-0.16.46/katex.min.css"' in result assert '/shared/hljs-11.11.1/highlight.min.js"' in result def test_version_matches_package(self): diff --git a/turnstone/shared_static/renderer.js b/turnstone/shared_static/renderer.js index 2a354f93..8551357e 100644 --- a/turnstone/shared_static/renderer.js +++ b/turnstone/shared_static/renderer.js @@ -869,7 +869,7 @@ function _loadMermaid(callback) { if (_mermaidState === "loading") return; _mermaidState = "loading"; var script = document.createElement("script"); - script.src = "/shared/mermaid-11.14.0/mermaid.min.js"; + script.src = "/shared/mermaid-11.15.0/mermaid.min.js"; script.onload = function () { _initMermaid(); _mermaidState = "ready";