Repository navigation
feat(topsort): drop zero-priced purchase lines - #5805
krishna2020 merged 1 commit into
Conversation
Purchase items whose unit price is 0 are removed before the event is sent. A purchase left with no items is skipped as a filtered event (298) instead of failed, since Topsort rejects a purchase without items. 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 were identified for the Topsort zero-priced purchase-item filtering change.
No open issues 🎉
What changed in this PR
This PR updates the Topsort destination to exclude zero-priced purchase items while preserving unpriced items and leaving clicks and impressions unchanged.
Changes:
- Removes purchase items with a mapped
unitPriceof zero, including prices supplied as"0". - Reports purchases containing only zero-priced items as filtered (298), without failing other events in the batch.
- Adds unit and component coverage for filtering and batch isolation.
| File | Description |
|---|---|
test/integrations/destinations/topsort/router/data.ts |
Adds component coverage for mixed-price and all-zero purchases. |
src/v0/destinations/topsort/utils.ts |
Filters zero-priced items and skips purchases left without items. |
src/v0/destinations/topsort/routerTransform.test.ts |
Tests numeric and string zero prices, unpriced items, and batch isolation. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## contrib/5805 #5805 +/- ##
=============================================
Coverage 92.49% 92.49%
=============================================
Files 742 742
Lines 41358 41363 +5
Branches 9654 9738 +84
=============================================
+ Hits 38254 38259 +5
+ Misses 2921 2843 -78
- Partials 183 261 +78 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
krishna2020
left a comment
There was a problem hiding this comment.
Reviewed at 7c2b688. Merging into contrib/5805 so the full CI runs before it lands on develop.
|
Thanks! This is now in |
> **Contributed by @bernirosas in #5805** (fork PR). This PR brings their commits from > `contrib/5805` to `develop` so the full CI (Docker build + ingestion-service test, > SonarCloud) runs. **Merge with "Create a merge commit" (not squash)** to keep the > contributor's commits on `develop`. ## What are the changes introduced in this PR? The Topsort destination now removes purchase items whose `unitPrice` is 0 before sending a purchase to the Topsort Events API. | Purchase | Result | | --- | --- | | Some items priced 0 | Sent without those items | | Every item priced 0 | Skipped as a filtered event (298), not failed | | No zero-priced items | Unchanged | - A price of `"0"` counts as 0, since the mapping already coerces `unitPrice` to a number. - Items with no price at all are still sent. - Impressions and clicks are not affected. ## What is the related Linear task? N/A ## Please explain the objectives of your changes below Zero-priced purchase lines should not be reported to Topsort as purchased items. A purchase whose items are all priced 0 is left with nothing to send. Topsort rejects a purchase without items (`no_purchase_items`), so the transform throws `FilteredEventsError`. The job is reported as filtered (298): it is not retried, not counted as an error, and the other jobs in the batch are still delivered. ### Any changes to existing capabilities/behaviour, mention the reason & what are the changes ? Purchases no longer carry zero-priced items, and a purchase made up only of zero-priced items is no longer sent. See the objectives above for the reason. ### 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 - [x] **No breaking changes are being introduced.** - [x] All related docs linked with the PR? - [x] All changes manually tested? - [ ] Any documentation changes needed with this change? - [x] 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)
What are the changes introduced in this PR?
The Topsort destination now removes purchase items whose
unitPriceis 0 before sending a purchase to the Topsort Events API."0"counts as 0, since the mapping already coercesunitPriceto a number.What is the related Linear task?
N/A
Please explain the objectives of your changes below
Zero-priced purchase lines should not be reported to Topsort as purchased items.
A purchase whose items are all priced 0 is left with nothing to send. Topsort rejects a purchase without items (
no_purchase_items), so the transform throwsFilteredEventsError. The job is reported as filtered (298): it is not retried, not counted as an error, and the other jobs in the batch are still delivered.Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
Purchases no longer carry zero-priced items, and a purchase made up only of zero-priced items is no longer sent. See the objectives above for the reason.
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
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