Skip to content

fix(braze): abort recommended ecommerce schema failures - #5636

Merged
ItsSudip merged 4 commits into
developfrom
harness/RUD-3228-fix-braze-abort-recommended-eco-8ac961f1
Oct 8, 2026
Merged

ItsSudip merged 4 commits into
developfrom
harness/RUD-3228-fix-braze-abort-recommended-eco-8ac961f1

Conversation

@rudder-devbox

@rudder-devbox rudder-devbox Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

Braze v1 /users/track partial failures now return per-job 400 for every correlated rejection, including recommended-ecommerce schema validation errors that previously returned 296.

The Braze-specific delivered-with-warning classification and braze_delivered_with_warning metric emission have been removed. Follow-up cleanup keeps HTTP_STATUS_CODES.DELIVERED_WITH_WARNING explicitly reserved for rudder-server while removing obsolete ecommerce event-name detection, request-body narrowing, warning terminology, and duplicate test fixtures. Unit and proxy/component coverage verify the abort behavior.

What is the related Linear task?

Resolves RUD-3228

Please explain the objectives of your changes below

Ensure payloads rejected by Braze are represented as delivery failures instead of successful deliveries with warnings. Affected jobs will now surface in delivery failures and router aborted events.

Accepted or uncorrelated jobs remain successful, and non-track endpoint handling is unchanged. This PR does not modify rudder-server's treatment of status 296; transformer retains the constant only as a reserved value and no Braze path emits it.

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

Yes. Correlated recommended-ecommerce schema rejections change from status 296 to 400. This intentionally makes those jobs customer-visible delivery failures rather than successful deliveries with warnings.

The braze_delivered_with_warning metric is no longer emitted for Braze. Existing dashboards or alerts depending on that metric may need adjustment. No rollout gate was added.

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?

  • braze_partial_failure and braze_delivery_aborted remain active.
  • Correlated errors still preserve Braze's verbatim error text and existing ordering.
  • HTTP_STATUS_CODES.DELIVERED_WITH_WARNING remains reserved for rudder-server and is not used by destination handlers.
  • The originating Slack context was not independently inspected.

Validation

  • npm test -- --runTestsByPath src/v1/destinations/braze/networkHandler.test.ts --no-coverage --runInBand - 24 passed
  • npm run test:ts -- component --destination=braze --no-coverage --runInBand - 102 passed
  • npx tsc --noEmit -p tsconfig.json - passed
  • npx tsc --noEmit -p tsconfig.test.json - passed
  • npm run lint - passed
  • git diff --check - passed

⚠️ Known Issues

  • The braze_delivered_with_warning metric is no longer emitted; owners should confirm that no external dashboards or alerts rely on it.
  • The originating Slack thread was not independently inspected, so any unrecorded rollout or metric-retention decision remains a follow-up concern.

Developer checklist

  • My code follows the style guidelines of this project
  • No breaking changes are being introduced.
  • All related docs linked with the PR? N/A
  • All changes manually tested?
  • Any documentation changes needed with this change? No
  • 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.

@rudder-devbox

rudder-devbox Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

👋 I'm rudder-devbox. I opened this PR from a Linear ticket.

Mention @devbox or @rudder-devbox and I'll act on it — on a top-level PR comment,
in a review summary, or on an inline comment on the diff. Without a mention I won't see it.

@coderabbitai

coderabbitai Bot commented Oct 7, 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: b6889918-aeef-4d4f-9f0c-b7b58238a8a9

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
  • Autopilot · 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

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

@rudder-devbox

rudder-devbox Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

The live Braze failures were caused by three recommended-ecommerce test payloads omitting Braze's required products field. The log showed braze-ecom-checkout-started, braze-ecom-order-refunded, and braze-ecom-order-cancelled each returning per-job statusCode: 400 with The property '#/' did not contain a required property of 'products'; the paired read-back failures were only consequences of those rejected steps.

I updated those three delivered-path live scenarios with schema-valid product data. The focused Braze component suite passes all 104 tests, the test TypeScript project passes, and formatting passes.

Commit: 5ccc793

@rudder-devbox

rudder-devbox Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.32%. Comparing base (938e883) to head (71b372c).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5636      +/-   ##
===========================================
- Coverage    93.33%   93.32%   -0.01%     
===========================================
  Files          703      703              
  Lines        38759    38742      -17     
  Branches      9073     9065       -8     
===========================================
- Hits         36174    36157      -17     
  Misses        2381     2381              
  Partials       204      204              

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

@ItsSudip
ItsSudip marked this pull request as ready for review October 7, 2026 10:14
@ItsSudip
ItsSudip requested review from a team as code owners October 7, 2026 10:14
@ItsSudip
ItsSudip requested a balanced review from Copilot October 7, 2026 10:14

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ItsSudip

ItsSudip commented Oct 7, 2026

Copy link
Copy Markdown
Member

@rudder-devbox please clean up the leftovers from the removed 296 / warn-only path. None of these should change behavior.

  1. Remove dead exports. isBrazeEcommerceEventName and the BRAZE_ECOMMERCE_EVENT_NAMES set in src/v0/destinations/braze/ecommerceUtil.ts (~L70-77) no longer have any callers. Their comment still says "Read by the v1 networkHandler". Delete both.
  2. Fix stale comments and over-narrowed types. The BrazeResponseHandlerParams comment in src/v0/destinations/braze/types.ts (~L202) still says the handler reads body.JSON.events to tell recommended-ecommerce events from legacy ones. The BrazeProxyV1Request narrowing (~L183) only existed for that read. Use plain ProxyV1Request and update the comment to say the handler only reads endpointPath. Also update the "correlate Braze's per-item warnings" comment in src/v0/destinations/braze/util.ts (~L840).
  3. Rename "warned" to "rejected". Every correlated hit now aborts the job, so in src/v1/destinations/braze/networkHandler.ts rename buildWarnedIndexMaps / WarnedIndexMap / WarnedHit / collectWarnedHits / the warned variable to buildRejectedIndexMaps / RejectedIndexMap / RejectedHit / collectRejectedHits / rejected. Update the related comments (~L84, L93-96, L112, L120-124, L142, L146). The L93-96 comment also says only the first hit across a job's positions is surfaced, but hits across positions are concatenated. Please correct that too.
  4. Simplify countStatesByStatus. In networkHandler.ts (~L174) it has a single caller, which always passes BAD_REQUEST / METRIC_DELIVERY_ABORTED. Narrow it to a countAbortedStates(states, labels) helper, or inline it.
  5. Remove HTTP_STATUS_CODES.DELIVERED_WITH_WARNING (296). It has no remaining users in src/v0/util/constant.js (~L35), and its comment still describes per-item warnings "worth surfacing to alerting". Remove it, or, if rudder-server still relies on the value, keep it with a comment saying it's reserved for rudder-server.
  6. Merge the redundant test splits. In src/v1/destinations/braze/networkHandler.test.ts, ecommerceSchemaCases (~L489) and otherCorrelatedFailureCases (~L496) now go through the same code path and expect the same 400. Merge them into one table, and drop the ECOM/LEGACY event names and trackRequestFor request bodies (~L66) from correlation tests where they no longer affect the result. Do the same in test/integrations/destinations/braze/dataDelivery/business.ts: the "legacy custom event schema rejection" and "ecommerce non-schema failure" scenarios now assert the same thing as the generic 400 case.

@rudder-devbox

rudder-devbox Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Cleaned up the removed warning path: deleted the dead ecommerce classifier and transformer 296 constant, restored ProxyV1Request, renamed correlation helpers to rejected terminology, narrowed the abort counter, corrected stale comments, and consolidated the redundant unit/component fixtures. The PR description now reflects the cleanup and updated validation counts.

Validated with lint, both TypeScript projects, 29 focused unit tests, and 102 Braze component tests. Pushed in 2cb7747.

@rudder-devbox

rudder-devbox Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

@ItsSudip

ItsSudip commented Oct 7, 2026

Copy link
Copy Markdown
Member

@rudder-devbox thanks for the cleanup. Most of it is done; a few leftovers remain:

  1. Restore the 296 constant as reserved. HTTP_STATUS_CODES.DELIVERED_WITH_WARNING was deleted from src/v0/util/constant.js, but rudder-server still uses 296 (DeliveredWithWarningCode in utils/types/types.go:17, checked in router/worker.go:824). Please add it back with a comment saying it's reserved for rudder-server, so it isn't reused by accident.
  2. Fix two remaining stale comments in test fixtures:
    • test/integrations/destinations/braze/dataDelivery/business.ts (~L141) still says the ecommerce events' name lets the v1 networkHandler tell them apart from legacy custom events. The handler no longer checks names.
    • test/integrations/destinations/braze/router/data.ts (~L1531) still says destInfo indices correlate "per-item warnings". They're rejections now.
  3. Correct the rewritten comment in src/v1/destinations/braze/networkHandler.ts (~L96). It says hits "are concatenated in encounter order", but this function doesn't concatenate anything. The joining happens in buildTrackPartialFailureStates, and it follows the job's own index order (events → attributes → purchases), not the order of Braze's errors[].
  4. Remove the remaining duplicate tests in src/v1/destinations/braze/networkHandler.test.ts:
    • The four SCHEMA_ERRORS rows on events in the merged correlatedFailureCases table run identical code. One row is enough.
    • The mixed-hits test (~L506) is covered by the concatenation test (~L332).
    • The "counts every correlated job as aborted" test (~L528) repeats the counter assertion at ~L254.
    • The NON_SCHEMA_ERROR comment (~L34, "always aborts, whatever it hit") still implies schema errors might not abort. Reword it, or drop the schema/non-schema naming.

@rudder-devbox

rudder-devbox Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Restored HTTP_STATUS_CODES.DELIVERED_WITH_WARNING as a rudder-server-reserved value, corrected the remaining rejection/order comments, and removed the redundant correlation cases and counter tests. I also updated the PR description to match.

Validation passed: 24 focused unit tests, 102 Braze component tests, lint, both TypeScript checks, and git diff --check.

Pushed in 71b372c.

@rudder-devbox

rudder-devbox Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@ItsSudip
ItsSudip merged commit 11d917f into develop Oct 8, 2026
47 of 48 checks passed
@ItsSudip
ItsSudip deleted the harness/RUD-3228-fix-braze-abort-recommended-eco-8ac961f1 branch October 8, 2026 05:39
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.

3 participants