Skip to content

Pin the engine the docs' live examples load from jsDelivr - #1952

Open
sequba wants to merge 2 commits into
developfrom
docs/pin-cdn-engine-version
Open

sequba wants to merge 2 commits into
developfrom
docs/pin-cdn-engine-version

Conversation

@sequba

@sequba sequba commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Context

The live examples in the docs loaded https://cdn.jsdelivr.net/npm/hyperformula/dist/... with no version. jsDelivr resolves a bare package name to whatever it last cached as latest: up to 12 hours on the CDN (s-maxage=43200) and 7 days in a browser (max-age=604800). After 4.0.0 was published, the 4.0.0 pages kept loading 3.5.0 (x-jsd-version: 3.5.0). 3.5.0 has no license-check skip for handsontable.com, so every example threw License key is missing. Feature crud is not available. A manual jsDelivr purge fixed production for now. This change stops it from happening again.

Where the live examples load the engine from is now decided in docs/src/engine-scripts.mjs:

  • A production build (Workers Builds of master) loads hyperformula@<version> from jsDelivr, for the engine, enUS.js and frFR.js. The version is the one the docs are built from (DOCS_DATA.version, from hyperformula/package.json), and npm run release -- code-freeze already bumps it in step 3. So the release script moves the pin with every release, and there is no second copy of the version to keep in sync.
  • Every other build (previews, staging, local builds, astro dev) serves the engine it was built with, from hyperformula/dist, under <base>engine/. During a code freeze the release branch carries a version that is not on npm yet. Those builds now run the new examples against the new engine; before, they ran them against the previous release.
  • A production build of a version not yet on npm serves its own engine too. The build asks the npm registry; any answer but a clear yes, network errors included, counts as no. release.sh publish pushes master (step 5) before npm publish (step 7). Without this check the build started by that push would point every example at a version jsDelivr can't serve, for as long as the publish takes, or for good if it never happens. The cost is that that one deploy self-hosts until the next deploy. It runs the same engine either way.

Alternatives rejected:

  • A hard-coded version plus a new release-script edit: one more copy of the version that can drift.
  • hyperformula@4 (a major range): still cached for days after a minor release.
  • Self-hosting everywhere, production included: possible, but the CDN pin was the requested design for production.

How did you test your changes?

  • npx astro build in docs/ passes (229 pages), and the log shows [engine-assets] Copied the engine from .../hyperformula/dist.
  • npx astro preview of that build: guide/demo.html loads /docs/hyperformula/engine/{hyperformula.full.min.js,languages/enUS.js,languages/frFR.js}, and all 3 return 200.
  • resolveUsesCdn + engineScripts, called from node:
    • master + 4.0.0 gives https://cdn.jsdelivr.net/npm/hyperformula@4.0.0/dist/....
    • master + an unpublished version gives /docs/hyperformula/engine/..., with a warning.
    • develop and unset branch give /docs/hyperformula/engine/....
  • The dev-server middleware, run in a bare http server: it serves engine/languages/frFR.js?v=1 with 200 and text/javascript. It passes engine/../package.json and other paths on (404).
  • curl returns 200 for the 3 pinned hyperformula@4.0.0 jsDelivr URLs. I loaded hyperformula@4.0.0 on the live demo page and =A1*3 evaluates to 6 with no license error.
  • npm run lint and npm run docs:lint pass.
  • I did not run a Workers Builds production build. Its branch check and npm check are tested only through the function calls above.

AI assistance

Claude Code wrote the config change, the docs edits and this description.

Compatibility with Excel and Google Sheets

Not applicable.

Formula Excel Google Sheets HyperFormula
n/a n/a n/a n/a

Public API changes

None.

Out of scope and follow-ups

  • moment stays unpinned. It is not ours, and its releases don't break the examples.
  • A production deploy made outside Workers Builds (npm run docs:deploy:cf from a laptop) has no WORKERS_CI_BRANCH, so it self-hosts the local hyperformula/dist. Every page in such a deploy comes from the local tree anyway, so this adds no new risk. A guard on manual production deploys would be a separate change.

Types of changes

  • Breaking change (existing functionality no longer works as before) – agreed with the maintainers
  • New feature or improvement (a non-breaking change that adds functionality)
  • Bug fix (a non-breaking change that fixes an issue)
  • Additional language file, or a change to an existing language file (translations)
  • Change to the documentation

Related issues

None.

Checklist

🤖 Generated with Claude Code

The live examples loaded the unpinned `hyperformula` package, which jsDelivr
resolves to whatever it last cached as `latest` (up to 12 hours on the CDN,
7 days in a browser). After 4.0.0 shipped, the 4.0.0 pages kept running 3.5.0,
which has no license-check skip for handsontable.com, so every example threw.

The URL is now pinned to the engine version the docs are built from, read
from `hyperformula/package.json`, which `code-freeze` already bumps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@handsontable-pr-review handsontable-pr-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Medium risk: Changes what engine URL every live example on the production docs site loads; a wrong pin breaks all interactive examples site-wide, but it is documentation-site config, not engine runtime code.

Full review: 1 potential issue(s).

Want a deeper review? Comment /review improve on its own line: a full review of the latest commit with an extra fix-oriented pass (about 2x the cost).

Comment thread docs/astro.config.mjs Resolved
@sequba sequba self-assigned this Dec 3, 2026
Pinning the CDN URL to the package.json version broke every live example in
release-branch builds during a code freeze, because that version is not on npm
until publish. Only a production build whose version is on npm now loads the
engine from jsDelivr. Every other build, and a production build made before
the publish (release.sh pushes master first), serves the engine it was built
with from hyperformula/dist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.78%. Comparing base (20ca836) to head (7bceb8c).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1952      +/-   ##
===========================================
+ Coverage    97.76%   97.78%   +0.01%     
===========================================
  Files          212      212              
  Lines        19312    19316       +4     
  Branches      4561     4597      +36     
===========================================
+ Hits         18881    18888       +7     
+ Misses         423      420       -3     
  Partials         8        8              

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
hyperformula-docs 7bceb8c Commit Preview URL

Branch Preview URL
Dec 03 2026, 08:13 AM

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Performance comparison of head (7bceb8c) vs base (f59b0fa)

                                     testName |    base |   head | change
-------------------------------------------------------------------------
                                      Sheet A |  503.23 | 498.74 | -0.89%
                                      Sheet B |  161.91 | 162.05 | +0.09%
                                      Sheet T |  147.45 | 145.54 | -1.30%
                                Column ranges |  475.76 | 474.47 | -0.27%
                                Sorted lookup | 14472.4 |  14660 | +1.30%
Sheet A:  change value, add/remove row/column |   15.67 |   15.9 | +1.47%
 Sheet B: change value, add/remove row/column |  130.23 | 137.94 | +5.92%
                   Column ranges - add column |  149.91 | 155.17 | +3.51%
                Column ranges - without batch |  451.29 | 452.99 | +0.38%
                        Column ranges - batch |  119.95 | 117.75 | -1.83%

This branch has not been deployed

No deployments
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