Skip to content

fix(destination): reject conflicting delivery body formats - #5784

Merged
achettyiitr merged 10 commits into
developfrom
harness/INT-6922-fix-destination-reject-conflict-e2fa8ee0
Nov 17, 2026
Merged

achettyiitr merged 10 commits into
developfrom
harness/INT-6922-fix-destination-reject-conflict-e2fa8ee0

Conversation

@rudder-devbox

@rudder-devbox rudder-devbox Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

Add a shared one-format guard for JSON, JSON_ARRAY, XML, FORM, and GZIP. The post-transformation success handler checks native and CDK v2 processor outputs; router outputs and native batch outputs are also checked before delivery.

What is the related Linear task?

Resolves INT-6922

Please explain the objectives of your changes below

Prevent ambiguous delivery when a builder emits more than one non-empty body format. This foundational change blocks INT-6924 and INT-6926.

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

Router validation checks every 2xx response, including one with an error key. A conflicting router response becomes a failure retaining its own metadata and destination. It uses the destination group's existing error details and router stats loop. A conflicting native batch output follows the existing retryable 500 batch failure path, with the failure metadata scoped to its own destination group. Existing router tag precedence and native processor and batch failure metrics are unchanged. Single-format outputs are unchanged.

Any new dependencies introduced with this change?

None.

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

validateDeliveryRequestBody checks single or array requests using the proxy's lodash emptiness rule and throws a PlatformError naming the conflicting formats.

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

A conflicting nested router request fails its enclosing response because nested requests share metadata. In native batch transformation, a conflict goes through the existing batch catch. CDK v2 increments event_transform_success before calling the shared processor success handler, so a guard rejection also increments event_transform_failure. No builders or transport selection logic were changed.

Validation

  • npm run lint — passed.
  • Focused destination service and guard Jest tests — passed.
  • TypeScript build checks — passed.
  • Full component suite — 4,144 passed, 2 skipped.
  • Live mini integration verification skipped: the transformer source change cannot be built from its SHA-pinned Docker base in this sandbox; a stock service would not exercise the edit.

⚠️ Known Issues

  • The changed transformer was not exercised end-to-end on mini because its source build is unavailable in this sandbox. Focused and component tests passed; live behavior remains to be checked in a source-capable environment.

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? 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 Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

👋 I'm rudder-devbox. I opened this PR from task INT-6922.

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 Nov 13, 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: 6f72bd01-adad-4b60-9237-a46b3b7be158

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

@achettyiitr
achettyiitr marked this pull request as ready for review November 16, 2026 12:16
@achettyiitr
achettyiitr requested review from a team as code owners November 16, 2026 12:16
achettyiitr
achettyiitr previously approved these changes Nov 16, 2026

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.

🟡 Changes recommended

A destination-group conflict incorrectly includes every input job in the failure response, causing jobs in healthy groups to receive contradictory failure and success outcomes.

1 open issue
What changed in this PR

This PR adds shared validation to reject transformation outputs containing multiple non-empty delivery body formats before delivery.

Changes:

  • Derives supported body formats from the network adapter and adds GZIP to the request body type.
  • Applies validation to processor, router, and native batch outputs.
  • Adds tests for conflicts, failure handling, metadata, and metrics.
File Description
src/​types/​destinationTransformation.ts Adds GZIP to the body type.
src/​services/​destination/​validateDeliveryRequestBody.ts Adds the shared body-format guard.
src/​services/​destination/​postTransformation.ts Validates processor and successful router outputs.
src/​services/​destination/​nativeIntegration.ts Validates native batch outputs.
src/​services/​destination/​__tests__/​validateDeliveryRequestBody.test.ts Tests valid and conflicting formats.
src/​services/​destination/​__tests__/​postTransformation.test.ts Tests router rejection, metadata, and metrics.
src/​services/​destination/​__tests__/​nativeIntegration.test.ts Tests processor and batch failure handling.
src/​adapters/​network.js Exports the supported delivery body formats.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 16, 2026 12:35

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.

🔵 Needs a closer look

A destination-group conflict incorrectly includes unrelated jobs in the retryable failure response, giving successful jobs contradictory outcomes and unnecessary retries.

1 open issue

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 16, 2026 12:43

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.

🔵 Needs a closer look

The new validation incorrectly treats customer-data keys in raw storage events as delivery-format selectors, causing valid S3 and Azure Blob events to fail with non-retryable 400 errors.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Rejecting raw events with JSON and FORM keys breaks storage destinations

src/​services/​destination/​postTransformation.ts:36

This handler also receives raw events from destinations such as S3 and Azure Blob (src/v0/destinations/s3/transform.js returns event.message unchanged). A valid event containing customer data such as body: { JSON: { id: 1 }, FORM: { id: 2 } } now becomes a non-retryable 400, even though these keys are not delivery-format selectors for those destinations. Restrict this check to delivery request envelopes, and add a raw-event regression case so storage destinations retain their pass-through behavior.

1 resolved since last review

Review effort: Balanced

@sonarqubecloud

Copy link
Copy Markdown

@achettyiitr
achettyiitr merged commit 667a77d into develop Nov 17, 2026
52 of 53 checks passed
@achettyiitr
achettyiitr deleted the harness/INT-6922-fix-destination-reject-conflict-e2fa8ee0 branch November 17, 2026 05:56
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