Skip to content

feat(topsort): prefix event ids with the source platform - #5774

Merged
krishna2020 merged 1 commit into
developfrom
fork-check/5771
Nov 10, 2026
Merged

krishna2020 merged 1 commit into
developfrom
fork-check/5771

Conversation

@krishna2020

@krishna2020 krishna2020 commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Contributed by @bernirosas in #5771 (fork PR). This PR carries their commit 4db6d27, cherry-picked onto develop with authorship unchanged, so the full CI (Docker build + ingestion-service test, SonarCloud) can run; those checks can't run from a fork. Merge with a merge commit (not squash) to keep the contributor's commit on develop.

Diff reviewed before pushing: only Topsort transform code and tests; no .github/ changes, no env, network or shell access in tests.

What are the changes introduced in this PR?

The Topsort destination now prefixes each event id with the platform that sent it, using fields RudderStack's SDKs already set. Marketplaces don't need to change anything.

RudderStack fields Topsort event id
channel: "web" web-<messageId>
channel: "mobile" + context.os.name iOS, iPadOS, watchOS or tvOS ios-<messageId>
channel: "mobile" + context.os.name: "Android" android-<messageId>
anything else (no channel, server-side, mobile with no or another OS name) <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 shared isAppleFamily / isAndroidFamily helpers, 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 id is the RudderStack messageId. With the prefix, the Topsort dashboard and request logs show the source of each event directly.

channel is set by every RudderStack SDK, and context.os.name by the mobile SDKs. Checked against real payloads: the JavaScript SDK sends channel: "web", and the iOS SDK sends channel: "mobile" with context.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 id changes from <messageId> to <platform>-<messageId>. The Topsort Events API accepts any unique string as id, so no request is affected. Topsort dedupes on id, and the prefix is deterministic for a given message, so retries still produce the same id. The exception is an event first sent before this deploys and retried after it: it goes out with the new id and isn't deduped against the first attempt. Anyone matching Topsort event ids against their own RudderStack messageIds 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. getPlatform and getEventId are local to src/v0/destinations/topsort/utils.ts; OS matching reuses the existing isAppleFamily / isAndroidFamily from src/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.ts for 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

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]>
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a1eb12c5-e0f4-44f4-87c0-28ba242da9da

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@krishna2020 krishna2020 changed the title chore: [CI only] fork check for #5771 feat(topsort): prefix event ids with the source platform Nov 6, 2026
@krishna2020
krishna2020 marked this pull request as ready for review November 6, 2026 12:36
@krishna2020
krishna2020 marked this pull request as ready for review November 6, 2026 12:36
@krishna2020
krishna2020 requested review from a team as code owners November 6, 2026 12:36
Copilot AI balanced review requested due to automatic review settings November 6, 2026 12:36

Copilot AI 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.

🟢 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, or android prefixes 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

@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.44%. Comparing base (6a245da) to head (124294e).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@krishna2020
krishna2020 merged commit b1642e7 into develop Nov 10, 2026
40 checks passed
@krishna2020
krishna2020 deleted the fork-check/5771 branch November 10, 2026 05:00
krishna2020 added a commit that referenced this pull request Nov 11, 2026
## 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)
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.

4 participants