Skip to content

fix(sdk): include sdk id and version in event publish requests - #473

Merged
nicklasl merged 1 commit into
mainfrom
confidence-coding-agent/a61a05cd
Oct 16, 2026
Merged

nicklasl merged 1 commit into
mainfrom
confidence-coding-agent/a61a05cd

Conversation

@confidence-agent

Copy link
Copy Markdown
Contributor

Event publish requests from the JS SDK did not include an sdk field, so epx-events tagged them as SDK_ID_UNSPECIFIED. This change makes EventSenderEngine send the SDK's identity with every publish request.

  • Confidence.create passes the existing sdk object (SDK_ID_JS_CONFIDENCE plus the version maintained by release-please) to EventSenderEngine. The flag resolver already receives the same object, so no second version string is added.
  • EventSenderEngine now requires an internal sdk: Sdk option, using the generated resolver type, and stores it on each EventBatch.
  • Both send paths serialize it with the generated Sdk.toJSON, which produces {"id":"SDK_ID_JS_CONFIDENCE","version":"…"}. This is the same proto-JSON enum-name form the resolver requests use.
    • Normal fetch flush, including keepalive and the fallback-to-fetch path, through upload.
    • sendBeacon on page unload, through beaconFlush.
  • Batching, the sendTime refresh on retry, custom event URLs, rate limiting, keepalive, the beacon size cap and queue behavior are unchanged.

Decisions:

  • sdk is required on the internal engine options rather than optional. This way the compiler flags any construction that leaves it out. EventSenderEngine is internal, so the public API does not change.
  • This only fixes the JS instrumentation. The backend still treats sdk as optional, and unspecified traffic from other clients is outside this change.

Tests:

  • EventSenderEngine.test.ts: the upload batch includes sdk. The serialized fetch body has sdk: {id:'SDK_ID_JS_CONFIDENCE', version}.
  • EventSenderEngine.visibilitychange.test.ts: the beacon payload includes the serialized sdk. When the beacon is rejected, the fallback upload batch includes sdk.
  • Confidence.int.test.ts: an event published through Confidence.create reaches the publish endpoint with sdk.id = 'SDK_ID_JS_CONFIDENCE' and a semver version.

Validation:

  • yarn jest --selectProjects sdk --testPathIgnorePatterns e2e: 208/208 passed.
  • yarn build, yarn lint and yarn prettier -c packages/sdk/src: all passed.
  • *.e2e.test.ts files were not run. They need live backend credentials and fail in this sandbox both with and without this change.
  • Running jest from the repo root, the openfeature provider suites fail to type-check in this environment both with and without this change.

Source: https://app.confidence.spotify.com/chats/ibdi0t34ewzwpbjwpcz7


Opened by the Confidence coding agent.

@confidence-agent confidence-agent Bot changed the title Include SDK id and version in event publish requests fix(sdk): include sdk id and version in event publish requests Oct 16, 2026
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
confidence-agent Bot force-pushed the confidence-coding-agent/a61a05cd branch from ffb993e to 0c36b01 Compare October 16, 2026 14:34
@nicklasl
nicklasl merged commit 9cc03e9 into main Oct 16, 2026
4 checks passed
@nicklasl
nicklasl deleted the confidence-coding-agent/a61a05cd branch October 16, 2026 14:38
@github-actions github-actions Bot mentioned this pull request Oct 16, 2026
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