Skip to content

chore(build): version the embed bundle and add a changelog #94

Closed

Description

@Ardnived

Summary

There is no release contract for embedding hosts. package.json declares "version": "0.1" (not valid semver, never bumped), the repo has zero git tags and no CHANGELOG.md, and the build pins the widget entry to a fixed, mutable embed.js while every chunk it imports is content-hashed — so every deploy silently upgrades every host, breaking changes cannot be communicated, and a cache-skew failure mode exists: a stale cached embed.js imports hashed chunk names the CDN no longer serves → hard 404, widget dead with no fallback. Introduce a versioned entry alongside the mutable one, adopt real semver, and add a changelog + release-process doc. (Readiness report §4 headline risk: "No versioning for integrators".)

Current behavior

vite.config.ts:31-35 — the widget entry is deliberately unhashed while everything else is hashed:

output: {
  entryFileNames: (assetInfo) => {
    return assetInfo.name === 'widget' ? 'embed.js' : 'assets/[name]-[hash].js'
  },
},
  • package.json:4 is "version": "0.1" — not valid semver, and it has never been bumped; git tag returns nothing; no CHANGELOG.md exists (all verified 2026-08-06).
  • Every deploy of sahajatlas (Cloudflare Pages) instantly and silently upgrades every host embed. There is no way for a host to pin a version, and no channel to announce a breaking change (e.g. a renamed attribute).
  • Cache-skew failure mode: embed.js imports its chunks by content-hashed name. If a host-side proxy/CDN/caching plugin serves a stale embed.js after a deploy has purged the old hashed chunks, every chunk import hard-404s and the widget dies with no fallback. Live headers on https://sahajatlas.pages.dev/embed.js (verified 2026-08-06: cache-control: public, max-age=0, must-revalidate) mitigate this for well-behaved caches but do not eliminate host-side proxies or WordPress caching plugins that ignore revalidation.
  • Rollback exists only as the undocumented, global-instant Cloudflare Pages "deployment history" dashboard action.

Proposed changes

  • Emit a versioned entry alongside the mutable one — e.g. v1/embed.js per major version, produced from the same build (a copy/alias of the entry, not a second build). embed.js keeps working unchanged: existing embeds must not break. Note the versioned copy must actually boot from its path — the entry's hashed-chunk imports have to resolve from v1/ (verify via pnpm preview), so this is a build-output change, not a post-build cp.
  • Adopt real semver in package.json — pick a starting version (e.g. 0.9.0 pre-GA or 1.0.0 at release) and treat it as the source of truth for the vN/ path.
  • Add CHANGELOG.md in Keep a Changelog style, seeded with an Unreleased section covering the current release-hardening branch.
  • Document the release/upgrade story (suggest docs/releasing.md): when and how the version bumps, what embed.js vs vN/embed.js mean, the pin-vs-latest tradeoff for hosts (pinning = stability + manual upgrades; latest = instant fixes + silent changes), rollback via Cloudflare Pages deployment history, and the cache-skew failure mode + why the current headers mitigate it.
  • Flag the dashboard follow-ups explicitly (in the doc and/or a closing issue comment), since Cloudflare Pages build config lives in the dashboard and is out of this repo's control: e.g. confirming cache headers for vN/embed.js paths, and any future _headers decisions. This ticket's scope is what the repo controls: build output + docs.

Acceptance criteria

  • pnpm build emits both dist/embed.js (unchanged behavior) and a versioned entry (e.g. dist/v1/embed.js) from one build
  • The versioned entry boots the widget when loaded from its own path — chunk imports resolve (verified against pnpm preview with demo.html pointed at /v1/embed.js)
  • Existing embeds are not broken: demo.html loading /embed.js still boots identically
  • package.json carries a valid semver version, and the versioned path's major matches it
  • CHANGELOG.md exists in Keep-a-Changelog format with at least an Unreleased section
  • A release-process doc section exists covering: version-bump procedure, embed.js vs vN/embed.js, pin-vs-latest tradeoff for hosts, Cloudflare Pages rollback, and the cache-skew failure mode
  • Dashboard-only follow-ups are explicitly listed as such (not silently assumed done)
  • Lint + typecheck + test:run + build pass
  • Write an implementation report to .claude/reports/<issue-number>-<short-slug>.md — in the MAIN checkout at /Users/devindra/Documents/Projects/SahajAtlasWeb even when implementing from a worktree (the folder is gitignored) — covering what changed, what was deliberately NOT changed, and which readiness-report findings are resolved

Files affected

  • vite.config.ts — build output section only (build.rolldownOptions.output); a sibling perf ticket touches the plugins section of this same file — keep edits strictly confined to the output block
  • package.json — the version field only
  • CHANGELOG.md (new)
  • docs/releasing.md (new) or equivalent release-process doc section

Parallel implementation: this ticket OWNS the files/sections listed above; sibling release-hardening tickets run concurrently — avoid edits outside owned files except strictly additive ones. In particular: the host-facing pin-vs-latest guidance may belong in the integrator guide (docs/embedding.md), which a sibling docs ticket owns — add it there only as a strictly additive section, or leave a cross-reference for reconciliation at merge.

References

  • .claude/reports/RELEASE_READINESS.md §4 (upgradeability — "No versioning for integrators — the headline risk"), executive-summary structural risk "No version pinning for hosts", Appendix D ("No changelog / semver / tags; unhashed mutable embed.js; cache-skew 404 mode")
  • vite.config.ts:31-35 (fixed embed.js entry vs hashed chunks)
  • package.json:4 ("version": "0.1")
  • Live headers on https://sahajatlas.pages.dev/embed.js: cache-control: public, max-age=0, must-revalidate (verified 2026-08-06)
  • Keep a Changelog: https://keepachangelog.com
  • Cloudflare Pages deployment history (rollback surface; dashboard-only — see CLAUDE.md deployment section)

Activity

  1. added 2 commits that reference this issue on Aug 11, 2026
    19916ea
    64ddacf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Hold Until

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions