Skip to content

feat(deploy): CDN bundle sync script and self-hosting docs - #23

Merged
Fiona2016 merged 5 commits into
mainfrom
feat/cdn-sync-and-delivery-docs
Aug 21, 2026
Merged

feat(deploy): CDN bundle sync script and self-hosting docs#23
Fiona2016 merged 5 commits into
mainfrom
feat/cdn-sync-and-delivery-docs

Conversation

@Fiona2016

@Fiona2016 Fiona2016 commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #22 (the rum-legacy README this touches lands there); GitHub will retarget this PR to main automatically once #22 merges.

What

  • scripts/deploy/sync-bundles.js: downloads the deployed bundles from the CDN into a local directory, for serving them from another origin. Entry bundles are fetched by name; the hash-named chunk files of the standard RUM bundle are recovered from the chunk table webpack embeds in the entry bundle, so a synced directory is always complete and coherent. No credentials needed; any missing file fails the run loudly.
  • The bucket layout and entry filenames move into lib/deploymentUtils.js, shared by the upload (deploy-oss.js) and download sides so they cannot drift apart.
  • packages/rum-legacy/README.md: documents where released bundles live (CDN major-version directory), the self-hosting workflow, and updates the verification status — the claim that the package had never run on a real browser engine is no longer true.

Verified

Ran the script against the production CDN: all three released entry bundles plus both chunk files downloaded (chunk-table extraction confirmed against the deployed artifact), and the not-yet-released fc-rum-legacy.js was reported as HTTP 404 with a non-zero exit — both the success and the failure paths exercised.

Self-hosting environments need a complete, coherent copy of the deployed
bundles, and the standard RUM bundle references hash-named chunk files
that are error-prone to collect by hand. The script downloads every
entry bundle by name and recovers the chunk names from the chunk table
webpack embeds in each entry bundle, over plain HTTPS with no
credentials, and fails loudly when any file is missing.

The bucket layout and the entry filenames move into deploymentUtils.js
so the upload and download sides share one definition.
The README pointed at a placeholder static host without saying where
released bundles actually live, and still claimed the package had never
been verified on a real browser engine. Document the CDN layout and the
sync-bundles workflow for self-hosting, and record the real-browser
verification outcome: IE 9, 10 and 11 pass every check in the
verification page, and IE 6 and IE 8 degrade to a silent no-op.
Three ways the script could hand over something incomplete without
saying so:

A thrown fetch — a refused connection or a DNS failure, which is the
expected shape of trouble for the networks this script exists to serve —
escaped the per-file handling, so the run stopped at the first one and
the operator got a stack trace instead of the list of what was missing
and the warning not to deploy it. Every file is attempted now and all
failures are reported together.

An interrupted run left a half-written directory that looks exactly like
a finished one: an entry bundle without its chunks is unremarkable on
disk. Files now land in a directory named for being unfinished and are
moved into place only once every one of them is there. An existing
output directory is refused rather than merged into, which would have
mixed in the chunks of an older version.

A chunk whose name webpack had to quote did not match the pattern that
reads the chunk table, so it would have been missing from the output
without ever being attempted, and so without ever being reported. Both
shapes match now, and the count of names read is checked against the
count in the table.
The sync script only reads what the release publishes, so it had no
business restructuring how the release works to get there. Sharing one
definition of the bucket layout would keep the two from drifting, but it
bought that by editing production release tooling from a read-only tool,
and the layout it needs is three constants.

deploy-oss.js and lib/deploymentUtils.js go back to what they were. The
script now depends on nothing from the release path and carries its own
copy of the host, the directories and the entry filenames.
A body that stops arriving mid-download, or a disk that fills while it
is being written, escaped the per-file handling: only the request itself
was covered. The run ended on the first one with a stack trace, the
remaining files were never attempted, and the operator never saw the
list of what was missing or the warning not to deploy it - the same
outcome the request handling was added to prevent. Reading and writing
the body are inside the same net now.

An output directory given with a trailing slash put the staging
directory inside it, where the rename cannot land. Every file downloaded
successfully and was then stranded in a hidden directory, and since the
output directory now existed, the guard refused every re-run. The path
is resolved before the staging name is derived from it.

A bundle that plainly loads chunks but whose chunk table does not match
the pattern now fails loudly. It used to be indistinguishable from a
bundle with no chunks at all, so a webpack or terser change to the
emitted runtime would have quietly produced a directory missing the very
files that are hardest to notice missing.

Chunk names decide where this writes and are read out of a downloaded
file, so anything resolving outside the output directory is refused.
@Fiona2016
Fiona2016 changed the base branch from feat/rum-legacy-es5 to main August 21, 2026 04:07
@Fiona2016 Fiona2016 closed this Aug 21, 2026
@Fiona2016 Fiona2016 reopened this Aug 21, 2026
@Fiona2016
Fiona2016 merged commit 21caa7e into main Aug 21, 2026
2 checks passed
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