Skip to content

fix(braze): derive runtime versions from package manifests - #1399

Open
rmi22186 wants to merge 1 commit into
v3-developmentfrom
fix/align-kit-runtime-versions
Open

fix(braze): derive runtime versions from package manifests#1399
rmi22186 wants to merge 1 commit into
v3-developmentfrom
fix/align-kit-runtime-versions

Conversation

@rmi22186

@rmi22186 rmi22186 commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

  • replace Braze 3–6 hardcoded runtime versions with manifest-derived build values
  • add Rollup-compatible version replacement with explicit missing-version failures
  • cover each Braze runtime API and guard the complete kit version-surface inventory

Test plan

  • Build Braze 3, 4, 5, and 6
  • Run Braze 3–6 suites in Chrome and Firefox
  • Run test/jest/release-scripts.spec.ts
  • Run ESLint and JavaScript/TypeScript Prettier checks
  • Inspect CJS, IIFE, and ESM outputs for 3.1.0 and stale version tokens

Notes

  • npm run gts:check still crashes on the existing generated dist/types/src/audience.d.ts; targeted Jest compilation and Prettier checks pass for the changed TypeScript test.

@rmi22186
rmi22186 requested a review from a team as a code owner September 3, 2026 18:14
@cursor

cursor Bot commented Sep 3, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Build-time version injection and tests only; no runtime event or identity behavior changes. Risk is mainly a misconfigured build leaving a bad version string, which the new guard and failing Rollup config are meant to catch.

Overview
Braze web kits v3–v5 no longer hardcode their reported version in source. Each kit now uses process.env.PACKAGE_VERSION, which Rollup replaces with package.json’s version when building IIFE/CJS (and ESM for v5). Builds fail fast if npm_package_version is unset.

Rollup gains rollup-plugin-replace (v3) or @rollup/plugin-replace (v4/v5). Karma tests assert getVersion() matches the manifest version.

A new release-scripts.spec.ts check inventories kits that expose runtime versions and requires the replace wiring in their build configs (including Braze 6 and Rokt), so future kits cannot drift back to manual version strings.

Reviewed by Cursor Bugbot for commit 04fd4e1. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a935bd2. Configure here.

Comment thread kits/braze/braze-3/test/tests.js Outdated
@rmi22186
rmi22186 force-pushed the fix/align-kit-runtime-versions branch from a935bd2 to 8ddd30f Compare September 3, 2026 18:18
@rmi22186
rmi22186 changed the base branch from main to v3-development September 3, 2026 18:19
@rmi22186
rmi22186 force-pushed the fix/align-kit-runtime-versions branch from 8ddd30f to 490e4cc Compare September 3, 2026 18:52
Inject each Braze kit package version during its build so runtime metadata cannot drift from the published manifest, while keeping browser-loaded tests free of CommonJS-only calls.
@rmi22186
rmi22186 force-pushed the fix/align-kit-runtime-versions branch from 490e4cc to 04fd4e1 Compare September 3, 2026 22:43
@sonarqubecloud

sonarqubecloud Bot commented Sep 3, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
33.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

2 participants