Skip to content

feat(topsort): move to batching framework with dontBatch delivery - #5618

Merged
ItsSudip merged 2 commits into
feat/topsort-batching-frameworkfrom
feat/topsort-framework-ga
Sep 28, 2026
Merged

ItsSudip merged 2 commits into
feat/topsort-batching-frameworkfrom
feat/topsort-framework-ga

Conversation

@ItsSudip

Copy link
Copy Markdown
Member

What are the changes introduced in this PR?

Moves the Topsort destination fully onto the batching framework and makes it router-only.

  • Registers TOPSORT: { routerTransform: true, batching: true, transformerProxy: true } in src/features.ts, so the destination is GA on the framework for every workspace.
  • Removes the legacy process / processRouterDest transform (transform.js, purchase.js, impressions-and-clicks.js, utils.js, config.js) and the processor test fixtures.
  • Converts the destination to TypeScript: config.ts, types.ts, utils.ts (buildTopsortEvents) and routerTransform.ts.
  • Requires messageId in the input schema. Event ids are derived from it (<messageId> or <messageId>-<index> for fanned-out products), so an event without one now fails on its own instead of being sent with an undefined id.
  • Sends impressions, clicks and purchases in one request. Each array is capped at 50 independently, and a new request starts only when the array an event belongs in is full. Empty arrays are omitted from the body.
  • Adds delivery.ts: a 400 from the Events API rejects the whole request, so every job is retried on its own with dontBatch: true; a job that was already sent alone is aborted. Other statuses keep the framework default. Failure reasons are built from Topsort's [{ errCode, message }] error array.

What is the related Linear task?

Resolves INT-7228

Please explain the objectives of your changes below

Follow-up to #5606 (merged into feat/topsort-batching-framework).

Dependent change: rudder-integrations-config must set transformAtV1: "router" for Topsort before this is released (rudderlabs/rudder-integrations-config#2763). This PR removes the processor process transform, which Topsort uses while its definition is on processor.

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

  • Topsort is router-only; the processor route (/v0/destinations/topsort) is no longer supported.
  • Events of different types share a request instead of being sent per type.
  • A message without messageId fails with message.messageId: Required.
  • A 400 from Topsort retries each job alone (dontBatch) instead of aborting the batch.

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A

Any technical or performance related pointers to consider with the change?

Combining event types reduces the number of requests for mixed traffic by up to 3×. A rejected batch costs one extra request per job when it is retried with dontBatch.


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?

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

@ItsSudip
ItsSudip requested review from a team as code owners September 28, 2026 04:05
@coderabbitai

coderabbitai Bot commented Sep 28, 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

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: d9188795-108b-4fd8-b5a1-ade405681ea7

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

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

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.12%. Comparing base (eda34d9) to head (b98ef31).
⚠️ Report is 7 commits behind head on feat/topsort-batching-framework.

Additional details and impacted files
@@                         Coverage Diff                         @@
##           feat/topsort-batching-framework    #5618      +/-   ##
===================================================================
+ Coverage                            93.03%   93.12%   +0.09%     
===================================================================
  Files                                  731      700      -31     
  Lines                                39440    38534     -906     
  Branches                              9249     8992     -257     
===================================================================
- Hits                                 36692    35886     -806     
+ Misses                                2549     2439     -110     
- Partials                               199      209      +10     

☔ 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.

Comment thread src/v0/destinations/topsort/config.ts Resolved
@ItsSudip
ItsSudip merged commit ae5150e into feat/topsort-batching-framework Sep 28, 2026
19 checks passed
@ItsSudip
ItsSudip deleted the feat/topsort-framework-ga branch September 28, 2026 09:13
@sonarqubecloud

Copy link
Copy Markdown

@ItsSudip ItsSudip mentioned this pull request Sep 28, 2026
3 of 10 tasks
ItsSudip added a commit that referenced this pull request Sep 28, 2026
## What are the changes introduced in this PR?

Merges the Topsort feature branch into `develop`. It contains:

- #5606 (contributed by Topsort): deterministic event ids so retries are
idempotent (`<messageId>`, or `<messageId>-<index>` for events fanned
out from `properties.products`), removal of the `additionalAttribution`
mapping, and chunking at the Events API's per-array cap of 50.
- #5618: moves Topsort fully onto the batching framework.
- Registers `TOPSORT: { routerTransform: true, batching: true,
transformerProxy: true }` in `src/features.ts`.
- Removes the legacy `process` / `processRouterDest` transform and the
processor test fixtures; the destination is router-only.
  - Converts the destination to TypeScript.
  - Requires `messageId` in the input schema.
- Sends impressions, clicks and purchases in one request, each array
capped at 50.
- Adds `delivery.ts`: a 400 from the Events API retries each job on its
own with `dontBatch: true`; a job already sent alone is aborted.

## What is the related Linear task?

Resolves INT-7228

## Please explain the objectives of your changes below

**Dependent change:** rudder-integrations-config #2763 (`transformAtV1:
"router"` for Topsort) is merged. It must be released before this PR,
because this PR removes the processor `process` transform.

### Any changes to existing capabilities/behaviour, mention the reason &
what are the changes ?

- Topsort is router-only; the processor route
(`/v0/destinations/topsort`) is no longer supported.
- The `id` sent for events carrying a `products` array changes to
`<messageId>-<index>`.
- `additionalAttribution` is no longer mapped.
- Events of different types share a request.
- A message without `messageId` fails with `message.messageId:
Required`.
- A 400 from Topsort retries each job alone (`dontBatch`) instead of
aborting the batch.

### Any new dependencies introduced with this change?

N/A

### Any new generic utility introduced or modified. Please explain the
changes.

N/A

### Any technical or performance related pointers to consider with the
change?

N/A

<hr>

### Developer checklist

- [x] 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?

- [x] Is the PR limited to one linear task?

- [x] Are relevant unit and component test-cases added in **new
readability format**?

### 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](https://claude.com/claude-code)

---------

Co-authored-by: bernirosas <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: Bernardita Rosas <[email protected]>
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.

2 participants