Skip to content

fix(sdk): report the real SDK version in the User-Agent#186

Merged
AdirAmsalem merged 1 commit into
mainfrom
fix-version-attribution
Jul 21, 2026
Merged

fix(sdk): report the real SDK version in the User-Agent#186
AdirAmsalem merged 1 commit into
mainfrom
fix-version-attribution

Conversation

@AdirAmsalem

@AdirAmsalem AdirAmsalem commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What & why

Every published release of @decartai/sdk reported its version as 0.0.0-dev in the outgoing User-Agent, regardless of the actual version. This broke SDK version attribution in our observability — we couldn't tell which SDK version a customer was actually running, which slowed down a live customer debugging session.

The version is now sourced reliably at build time so the User-Agent always carries the real version (e.g. decart-js-sdk/0.1.14 …). A build-package regression check was added so a placeholder or mismatched version can never silently ship again.

Note: this corrects all future releases; already-published versions keep reporting 0.0.0-dev until a new version is cut.


Note

Low Risk
Narrow build/version wiring and test coverage only; no auth, data handling, or runtime API behavior changes beyond correct version strings in headers and telemetry.

Overview
Published @decartai/sdk builds were shipping VERSION as 0.0.0-dev in the User-Agent and telemetry because tsdown/rolldown rejected the define block and the old magic-token path silently fell back to a placeholder.

VERSION now comes from a real package.json import in version.ts (tree-shaken to the version string at build time), and the define entry is removed from tsdown.config.ts.

built-package.mjs now asserts the built VERSION matches package.json, is not the dev placeholder, and that buildUserAgent() includes decart-js-sdk/<real version>.

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

The published SDK reported decart-js-sdk/0.0.0-dev for every release: the
build-time __PACKAGE_VERSION__ define is silently rejected by the pinned
tsdown/rolldown, so VERSION always fell back to the dev placeholder. Read
the version as a real module import from package.json instead, drop the dead
define, and add a built-package regression guard on VERSION and the UA.
@pkg-pr-new

pkg-pr-new Bot commented Jul 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@decartai/sdk@186

commit: 20cfdd8

@AdirAmsalem
AdirAmsalem merged commit e0370f0 into main Jul 21, 2026
5 checks passed
@AdirAmsalem
AdirAmsalem deleted the fix-version-attribution branch July 21, 2026 13:14
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