Repository navigation
feat(http): support XML and FORM bodies in v2 router - #5768
shekhar-rudder merged 5 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
👋 I'm rudder-devbox. I opened this PR from task Mention |
- Reuse BodyFormat and isObject instead of v1's CONTENT_TYPES_MAP and a hand-rolled object check; fold the format default into destructuring. - Drop the unreachable try/catch around prepareBody (input is sandbox-cloned plain JSON). - Drop a dead path-predicate condition from the first-event check. - Reset objectPropertyValue when walking $number() arguments so the XML unwrapped-mapping exemption no longer leaks into function calls. - Remove duplicate template tests and the mocked controller test that asserted nothing new; split the XML/FORM serializer test. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5768 +/- ##
===========================================
+ Coverage 92.44% 92.45% +0.01%
===========================================
Files 741 741
Lines 41119 41174 +55
Branches 9675 9691 +16
===========================================
+ Hits 38013 38068 +55
- Misses 2845 2923 +78
+ Partials 261 183 -78 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I traced the failure to the unchanged Everflow live scenario, This branch changes HTTP v2 and the shared JSONata validator, not Everflow. The shared edit caused CI to include Everflow in the live matrix. The success scenario uses a transaction ID from the external |
Drop the new filter check on array constructors. The migration templates
`[$$.events][0]` and `[$$.events.{...}][0]` already validate on develop, so
HTTP does not need it, and it changed validation for the custom audience
`records` collection, which is outside this change.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
This run repeats the Everflow live-test failure: The current branch changes HTTP v2 and the shared JSONata validator, not Everflow. The successful Everflow scenario uses |
…efinition
The merged HTTP v2 definition drops `xmlRootKey`: for XML the template must
produce one object with exactly one top-level key, and that key is the root
element. The transformer enforces the one-key rule, sanitizes the root name
like nested keys (so a data-derived key cannot inject markup), and rejects an
empty root.
The shared JSONata validator is back to develop: XML batches use the wrapped
form `{"Root": {"event": [$$.events.{...}]}}`, which renders identical XML, so
the unwrapped-mapping exemption (which also let JSON templates through) is gone.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
I found two separate live-test failures. Everflow’s Intercom’s This branch changes HTTP v2 and its JSONata validation, not Everflow or Intercom. The shared-file edit causes the workflow to run their live scenarios. I made no code change or push: both failures depend on external partner/test-account state, and weakening their delivery assertions would hide real rejections. |
- Handle JSON first so XML/FORM shaping reads as flat early returns. - Type v1 prepareBody's result as an object (it never returns a string), removing the HttpBody casts; restore the maxBatchSize string comment. - Merge the XML/FORM rejection tables into one; drop unit tests that repeat the component fixtures or the existing bad-cast chunk test, and the sandbox client tests that no longer exercise anything this change touches. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
The failed job is the unchanged Everflow success scenario: The branch changes HTTP v2 and an HTTP serializer export; it does not change Everflow. The HTTP serializer path causes the live workflow to run its full matrix, exposing this external test-data failure. The Everflow conversion report and the transaction ID in |
|
There was a problem hiding this comment.
🟡 Changes recommended
FORM evaluates all event chunks in a single sandbox call with a shared 500 ms budget, so large groups can repeatedly fail on retry; bounded calls and a multi-page regression test are needed.
1 open issue
What changed in this PR
Adds XML and FORM body support to the HTTP v2 router using existing v1 serializers, while keeping JSON as the default.
Changes:
- Adds optional format configuration and format-specific content types.
- Supports template-defined XML roots and batching; forces FORM requests to contain one event.
- Adds unit and component coverage for serialization, validation, and batching behavior.
| File | Description |
|---|---|
test/integrations/destinations/http/router/data.ts |
Adds XML batch and single-event FORM component cases. |
test/integrations/destinations/http/common.ts |
Adds shared XML and FORM destination fixtures. |
src/v0/destinations/http/types.ts |
Accepts optional JSON, XML, or FORM configuration. |
src/v0/destinations/http/routerTransform.ts |
Implements format-specific serialization, validation, headers, and batching. |
src/v0/destinations/http/routerTransform.test.ts |
Tests serialization edge cases and invalid template results. |
src/cdk/v2/destinations/http/utils.ts |
Exports the shared key sanitizer and narrows the body type. |
Review effort: Balanced




What are the changes introduced in this PR?
HTTP v2 now serializes XML and FORM bodies with v1 wire-format parity, including XML batching and single-event FORM requests. It follows the merged v2 definition (rudder-integrations-config #2890): there is no
xmlRootKey; for XML the template produces one object with exactly one top-level key, which becomes the root element.What is the related Linear task?
Resolves INT-7520
Please explain the objectives of your changes below
Deploy this transformer to every region before integrations-config exposes XML/FORM; otherwise older data planes may send JSON to XML/FORM endpoints. Control-plane, webapp, Terraform, and CLI changes are separate.
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
HTTP v2 accepts an optional
format; JSON remains the default. XML/FORM require an object template result. XML additionally requires exactly one top-level key holding an object; the key is sanitized like nested keys and used as the root element. FORM is always single-event. XML batches use the wrapped form, e.g.{"Envelope": {"event": [$$.events.{...}]}}.Any new dependencies introduced with this change?
None.
Any new generic utility introduced or modified. Please explain the changes.
None. The shared JSONata validator is unchanged;
sanitizeKeyis now exported from the v1 HTTP utils so v2 can sanitize the XML root element.Any technical or performance related pointers to consider with the change?
HTTP secret paths were regenerated for review and were unchanged. FORM ignores stale batch-size values above one.
Validation
npm test -- --testPathPattern='jsonataTemplate|http|controllers/__tests__/eventTest|custom_audience/template' --no-coverage --runInBand: 7 suites, 166 tests passed.npm run test:ts -- component --destination=http --runInBand: 20 tests passed.npm run build:ci,npx tsc --noEmit -p tsconfig.test.json, targeted Prettier and ESLint, andgit diff --check: passed.headerspath. The repository-widenpm run lintexceeded the command wait window; targeted formatting and lint passed.npm run lintexceeded the command wait window; targeted ESLint and formatting passed.Developer checklist
Reviewer checklist
Adversarial self-review surfaced findings that were not auto-fixed. Each carries its disposition — please evaluate before merging.
src/v0/destinations/http/routerTransform.ts:91— not auto-fixed (iteration budget exhausted)🔭 Live preview
Resumable while this task is open.