Repository navigation
feat(topsort): prefix event ids with the source platform - #5774
Conversation
Prefix the Topsort event id with web, ios or android, read from channel and context.os.name, so marketplaces can trace failing events back to their source. OS names are matched exactly with the shared isAppleFamily/isAndroidFamily helpers. Events whose platform can't be told keep the plain messageId. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the Topsort event-ID platform-prefix change.
No open issues 🎉
What changed in this PR
This PR adds source-platform prefixes to Topsort event IDs, making web and mobile events easier to identify in Topsort logs and dashboards.
Changes:
- Derives
web,ios, orandroidprefixes from SDK-provided fields, leaving IDs unchanged for unrecognized platforms. - Applies prefixes to clicks, impressions, purchases, and per-product events.
- Adds unit and component coverage for platform detection, fallback behavior, and generated IDs.
| File | Description |
|---|---|
test/integrations/destinations/topsort/router/data.ts |
Adds a mixed-platform batch fixture verifying prefixed IDs. |
src/v0/destinations/topsort/utils.ts |
Derives platform prefixes and applies them across event types. |
src/v0/destinations/topsort/routerTransform.test.ts |
Tests platform matching, fallbacks, fan-out, and purchase IDs. |
Review effort: Balanced
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5774 +/- ##
========================================
Coverage 92.44% 92.44%
========================================
Files 741 741
Lines 41121 41133 +12
Branches 9670 9682 +12
========================================
+ Hits 38015 38027 +12
Misses 2845 2845
Partials 261 261 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
## What are the changes introduced in this PR? Adds a `fork-pr-contribution` skill (`.claude/skills/fork-pr-contribution/SKILL.md`) so everyone handles open-source contributions the same way: ``` fork PR ──(squash)──▶ contrib/<pr> ──(PR, full CI, merge commit)──▶ develop ``` 1. **Sanity checks on the contributor PR:** lint, format, secret paths and unit tests run on fork PRs since #5772. Lists which checks are expected to be skipped (Docker build, ingestion test, Sonar) or to fail (org-level zizmor `scan`). 2. **Review the diff before it reaches our repo:** in our repo it runs with our secrets. The skill says to stop and escalate on `.github/`, Dockerfile, npm script, lockfile or test-setup changes, and includes a grep for env, shell and network access. 3. **Squash-merge into `contrib/<pr>`:** the squash commit is authored by the PR author, so the contributor keeps the credit. 4. **Raise `contrib/<pr>` → `develop`:** reuses the contributor's title and description, with a credit header. 5. **Full CI, then merge with a merge commit:** squashing here would make the maintainer the author. ## Please explain the objectives of your changes below Fork PRs can't run the checks that need secrets, and those checks show as *skipped*, which branch protection treats as passing. Without a shared process, a fork PR can be merged into `develop` without the full CI ever running. Agreed in standup; first used on #5771 → #5774. ## Any changes to existing capabilities/behaviour? None. Docs and agent skill only, no runtime or CI changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)



What are the changes introduced in this PR?
The Topsort destination now prefixes each event
idwith the platform that sent it, using fields RudderStack's SDKs already set. Marketplaces don't need to change anything.idchannel: "web"web-<messageId>channel: "mobile"+context.os.nameiOS, iPadOS, watchOS or tvOSios-<messageId>channel: "mobile"+context.os.name: "Android"android-<messageId><messageId>(unchanged)This applies to impressions, clicks and purchases, including events fanned out per product (
ios-<messageId>-0,ios-<messageId>-1, ...). OS names are matched exactly with the sharedisAppleFamily/isAndroidFamilyhelpers, so e.g. KaiOS is not tagged as iOS.What is the related Linear task?
N/A
Please explain the objectives of your changes below
Marketplaces that send events from web and mobile apps through the same destination can't tell, from the Topsort side, which platform a rejected or malformed event came from. Every event reaches the Topsort Events API from RudderStack's servers, and the
idis the RudderStackmessageId. With the prefix, the Topsort dashboard and request logs show the source of each event directly.channelis set by every RudderStack SDK, andcontext.os.nameby the mobile SDKs. Checked against real payloads: the JavaScript SDK sendschannel: "web", and the iOS SDK sendschannel: "mobile"withcontext.os.name: "iOS".Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
For events whose platform can be identified, the event
idchanges from<messageId>to<platform>-<messageId>. The Topsort Events API accepts any unique string asid, so no request is affected. Topsort dedupes onid, and the prefix is deterministic for a given message, so retries still produce the sameid. The exception is an event first sent before this deploys and retried after it: it goes out with the newidand isn't deduped against the first attempt. Anyone matching Topsort event ids against their own RudderStackmessageIds will now see the prefix.Any new dependencies introduced with this change?
N/A
Any new generic utility introduced or modified. Please explain the changes.
N/A.
getPlatformandgetEventIdare local tosrc/v0/destinations/topsort/utils.ts; OS matching reuses the existingisAppleFamily/isAndroidFamilyfromsrc/v0/util.Any technical or performance related pointers to consider with the change?
N/A. A couple of string comparisons per event.
Developer checklist
My code follows the style guidelines of this project
No breaking changes are being introduced.
All related docs linked with the PR?
All changes manually tested?
Any documentation changes needed with this change?
Is the PR limited to 10 file changes?
Is the PR limited to one linear task?
Are relevant unit and component test-cases added in new readability format?
Tests: unit cases in
routerTransform.test.tsfor web, iOS, iPadOS, Android, KaiOS (not prefixed), mobile without an OS name and server-side events, plus fanned-out and purchase ids. A component fixture (topsort-router-platform-prefix) sends a web click, an iOS impression and an Android purchase in one batch. All Topsort unit and component tests pass.Reviewer checklist
Is the type of change in the PR title appropriate as per the changes?
Verified that there are no credentials or confidential data exposed with the changes.
🤖 Generated with Claude Code