Repository navigation
fix(sdk): include sdk id and version in event publish requests - #473
Merged
Merged
Conversation
Event publish requests did not include an sdk field, so epx-events tagged them as SDK_ID_UNSPECIFIED. Confidence.create now passes the existing sdk metadata (SDK_ID_JS_CONFIDENCE and the release-please version) to EventSenderEngine, which serializes it with the generated Sdk.toJSON on both the fetch flush path and the sendBeacon page-unload path. Tests cover the fetch body, the beacon payload, the beacon-to-fetch fallback and the Confidence.create wiring. Validated with the sdk jest project, yarn build, yarn lint and yarn format:check.
confidence-agent
Bot
force-pushed
the
confidence-coding-agent/a61a05cd
branch
from
October 16, 2026 14:34
ffb993e to
0c36b01
Compare
nicklasl
approved these changes
Oct 16, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Event publish requests from the JS SDK did not include an
sdkfield, so epx-events tagged them asSDK_ID_UNSPECIFIED. This change makesEventSenderEnginesend the SDK's identity with every publish request.Confidence.createpasses the existingsdkobject (SDK_ID_JS_CONFIDENCEplus the version maintained by release-please) toEventSenderEngine. The flag resolver already receives the same object, so no second version string is added.EventSenderEnginenow requires an internalsdk: Sdkoption, using the generated resolver type, and stores it on eachEventBatch.Sdk.toJSON, which produces{"id":"SDK_ID_JS_CONFIDENCE","version":"…"}. This is the same proto-JSON enum-name form the resolver requests use.upload.sendBeaconon page unload, throughbeaconFlush.sendTimerefresh on retry, custom event URLs, rate limiting, keepalive, the beacon size cap and queue behavior are unchanged.Decisions:
sdkis required on the internal engine options rather than optional. This way the compiler flags any construction that leaves it out.EventSenderEngineis internal, so the public API does not change.sdkas optional, and unspecified traffic from other clients is outside this change.Tests:
EventSenderEngine.test.ts: the upload batch includessdk. The serialized fetch body hassdk: {id:'SDK_ID_JS_CONFIDENCE', version}.EventSenderEngine.visibilitychange.test.ts: the beacon payload includes the serializedsdk. When the beacon is rejected, the fallback upload batch includessdk.Confidence.int.test.ts: an event published throughConfidence.createreaches the publish endpoint withsdk.id = 'SDK_ID_JS_CONFIDENCE'and a semver version.Validation:
yarn jest --selectProjects sdk --testPathIgnorePatterns e2e: 208/208 passed.yarn build,yarn lintandyarn prettier -c packages/sdk/src: all passed.*.e2e.test.tsfiles were not run. They need live backend credentials and fail in this sandbox both with and without this change.Source: https://app.confidence.spotify.com/chats/ibdi0t34ewzwpbjwpcz7
Opened by the Confidence coding agent.