Skip to content

refactor(batch): use z.infer for schema-driven types across batch destinations - #5315

Merged
shekhar-rudder merged 2 commits into
developfrom
refactor/batch-destination-schema-driven-types
Jul 3, 2026
Merged

shekhar-rudder merged 2 commits into
developfrom
refactor/batch-destination-schema-driven-types

Conversation

@shekhar-rudder

@shekhar-rudder shekhar-rudder commented Jun 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Replaces InferRouterInput with z.infer<typeof schema> in all BatchDestination transformEvent signatures — integrations no longer need to understand framework-specific utility types
  • Removes InferRouterInput, ExtractMessage, and SchemaOutput from the batching framework (ExtractDestinationConfig/ExtractConnectionConfig remain for this.destination/this.connection typing)
  • Adds a shared makeRouterInputSchema builder that validates the router envelope (message, destination config, connection config) and supports multiple message variants, so hybrid destinations (record + event-stream) validate each message type against its own connection schema
  • Adds PostHogDestinationConfigSchema and enriches PostHog/GAEC input schemas with destination config for schema-driven typing
  • Removes unused name field from IterableDestinationConfigSchema
  • Zero runtime behavior change — Zod schemas validate the same data, just with tighter types

Test plan

  • All unit tests pass (nativeBatching + 5 destinations)
  • Integration tests pass for custom_audience, iterable_audience, posthog
  • Lint clean
  • tsc --noEmit clean

🤖 Generated with Claude Code

@shekhar-rudder
shekhar-rudder requested a review from a team as a code owner June 25, 2026 06:53
@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "auto_resolve_threads"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

Native batching now derives router input, destination, and connection types from shared Zod schemas. Several destination router transforms also switched to shared module-level schemas, updated request validation shapes, and aligned tests with the new inferred input types.

Changes

Schema-driven native batching and destination transforms

Layer / File(s) Summary
Shared schema inference types
src/services/destination/nativeBatching/types.ts, src/services/destination/nativeBatching/batchDestination.ts
types.ts adds schema extraction helpers, and batchDestination.ts re-exports the schema-driven public types.
BatchDestination contract
src/services/destination/nativeBatching/batchDestination.ts
BatchDestinationConstructor, stored destination and connection fields, transformEvent, getInputSchema, and transformEvents now use schema-derived input typing instead of separate config generics.
Batched processing wiring
src/services/destination/nativeBatching/processBatchedDestination.ts
validateInputs and processBatchedDestination drop the extra config and connection generics and construct integrations with the simplified constructor typing.
Custom Audience batching setup
src/v0/destinations/custom_audience/types.ts, src/v0/destinations/custom_audience/utils.ts, src/v0/destinations/custom_audience/routerTransform.ts
Custom Audience adds schema-backed config types, updates action lookup behavior, and switches router transform input validation to the shared input schema.
CustomerIO schema plumbing
src/v0/destinations/customerio/v2/types.ts, src/v0/destinations/customerio/routerTransform.ts, src/v0/destinations/customerio/routerTransform.test.ts
CustomerIO v2 exports a schema constant with destination and connection fields, and the router transform and test types switch to the schema-inferred input shape.
GAEC and PostHog schema updates
src/v0/destinations/google_adwords_enhanced_conversions/routerTransform.ts, src/v0/destinations/posthog/routerTransform.ts, src/v0/destinations/posthog/types.ts, src/v0/destinations/google_adwords_enhanced_conversions/routerTransform.test.ts, src/v0/destinations/posthog/routerTransform.test.ts
GAEC and PostHog switch getInputSchema() to shared module-level Zod schemas, update transform input typing, and align config schema exports and tests.
Iterable schema and input typing
src/v0/destinations/iterable_audience/types.ts, src/v0/destinations/iterable_audience/routerTransform.ts, src/v0/destinations/iterable_audience/__tests__/routerTransform.test.ts
Iterable Audience updates action validation and router request schema shape, then uses the inferred input type in the integration and test fixture.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • arpl
  • ItsSudip
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning It covers the high-level summary and test plan, but it omits several required template sections, including the Linear task and checklist items. Add the missing template sections: related Linear task, objectives details, dependency/performance notes, and the developer/reviewer checklists.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed It clearly summarizes the main refactor from framework-specific input types to z.infer-based schema-driven typing.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/batch-destination-schema-driven-types

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 Jun 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.94737% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.74%. Comparing base (0e1d5b4) to head (ae72f1a).

Files with missing lines Patch % Lines
...services/destination/nativeBatching/inputSchema.ts 96.15% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5315   +/-   ##
========================================
  Coverage    92.73%   92.74%           
========================================
  Files          701      703    +2     
  Lines        38213    38255   +42     
  Branches      8937     8947   +10     
========================================
+ Hits         35438    35479   +41     
- Misses        2565     2566    +1     
  Partials       210      210           

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/v0/destinations/customerio/routerTransform.test.ts (1)

90-90: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid masking the batching input contract with any.

Line 90's as any sidesteps the schema-derived typing this PR is introducing, so this test will still pass even if transformEvents() and the inferred Customer.io router input drift apart later. Please type the fixture to the method’s expected input shape instead of suppressing the mismatch at the call site.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/v0/destinations/customerio/routerTransform.test.ts` at line 90, The
`transformEvents()` test is masking the batching input contract by casting
`inputs` to `any`, which bypasses the schema-derived type safety this PR is
meant to enforce. Update the fixture in `routerTransform.test.ts` to use the
actual expected input type for `CustomerioRouterTransform`/`transformEvents()`
instead of suppressing the mismatch at the call site, so the test will fail if
the inferred Customer.io router input drifts.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/services/destination/nativeBatching/processBatchedDestination.ts`:
- Around line 260-273: The batching flow is passing raw inputs into
transformEvents because validateInputs discards safeParse’s parsed data and
later the casts on batchableEvents/nonBatchableEvent hide the mismatch. Update
validateInputs to store and return parseResult.data for each valid item, or
otherwise map the validated list to parsed values before constructing
batchableEvents and invoking integration.transformEvents. Keep the fix centered
on validateInputs, batchableEvents, and the transformEvents calls so Zod
coercions/transforms/defaults are preserved.

In `@src/services/destination/nativeBatching/types.ts`:
- Around line 22-26: The ExtractConnectionConfig conditional type is matching
too broadly through the optional connection branch and inferring unknown instead
of falling back to Record<string, unknown>. Update ExtractConnectionConfig in
types.ts to first require that T actually has a connection key before inferring
connection.config, and keep the existing fallback for types where connection is
absent; use the ExtractConnectionConfig symbol to locate and adjust the
conditional branches.

---

Nitpick comments:
In `@src/v0/destinations/customerio/routerTransform.test.ts`:
- Line 90: The `transformEvents()` test is masking the batching input contract
by casting `inputs` to `any`, which bypasses the schema-derived type safety this
PR is meant to enforce. Update the fixture in `routerTransform.test.ts` to use
the actual expected input type for
`CustomerioRouterTransform`/`transformEvents()` instead of suppressing the
mismatch at the call site, so the test will fail if the inferred Customer.io
router input drifts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 141d2709-1f4f-49a3-87bc-86b889bf91eb

📥 Commits

Reviewing files that changed from the base of the PR and between 94f2ec7 and 5fa73dc.

📒 Files selected for processing (10)
  • src/services/destination/nativeBatching/batchDestination.ts
  • src/services/destination/nativeBatching/processBatchedDestination.ts
  • src/services/destination/nativeBatching/types.ts
  • src/v0/destinations/custom_audience/routerTransform.ts
  • src/v0/destinations/customerio/routerTransform.test.ts
  • src/v0/destinations/customerio/routerTransform.ts
  • src/v0/destinations/customerio/v2/types.ts
  • src/v0/destinations/google_adwords_enhanced_conversions/routerTransform.ts
  • src/v0/destinations/iterable_audience/routerTransform.ts
  • src/v0/destinations/posthog/routerTransform.ts

@shekhar-rudder
shekhar-rudder force-pushed the refactor/batch-destination-schema-driven-types branch 3 times, most recently from 5ced26d to 5a9433f Compare June 25, 2026 07:22
@shekhar-rudder
shekhar-rudder force-pushed the refactor/batch-destination-schema-driven-types branch 3 times, most recently from 061ecf5 to 217d551 Compare June 25, 2026 07:49

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/services/destination/nativeBatching/batchDestination.ts (1)

34-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Preserve TInputSchema on the constructor contract.

Erasing the schema here makes downstream code see only BatchDestination<TBody>, so getInputSchema() and transformEvents() lose their shared schema type. Keeping the second generic defaulted preserves inference without forcing callers to specify it.

♻️ Suggested type shape
 export type BatchDestinationConstructor<
   TBody extends Record<string, unknown> = Record<string, unknown>,
-> = new (destination: Destination, connection?: Connection) => BatchDestination<TBody>;
+  TInputSchema extends ZodType = ZodType,
+> = new (destination: Destination, connection?: Connection) => BatchDestination<TBody, TInputSchema>;

Then thread TInputSchema through validateInputs / processBatchedDestination so validated outputs can be typed as InferRouterInput<TInputSchema>[].

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/services/destination/nativeBatching/batchDestination.ts` around lines 34
- 38, Preserve the schema generic on the BatchDestination constructor contract:
BatchDestinationConstructor currently erases TInputSchema by returning only
BatchDestination<TBody>, which breaks shared typing between getInputSchema() and
transformEvents(). Update the constructor type in batchDestination.ts to thread
both TBody and the defaulted TInputSchema through the instance type, then
propagate that generic through validateInputs and processBatchedDestination so
validated batches can be typed as InferRouterInput<TInputSchema>[]
src/v0/destinations/custom_audience/routerTransform.ts (1)

58-58: 📐 Maintainability & Code Quality | 🔵 Trivial

Bind the input schema generic to BatchDestination in CustomAudienceIntegration.

Although getInputSchema() returns customAudienceInputSchema, the CustomAudienceIntegration class extends BatchDestination<Record<string, unknown>> without binding the second generic type argument for the schema. This omits the schema-derived input typing defined in the base class.

Update the class declaration at lines 58 and 174 to explicitly bind the schema:

Proposed diff
-class CustomAudienceIntegration extends BatchDestination<Record<string, unknown>> {
+class CustomAudienceIntegration extends BatchDestination<
+  Record<string, unknown>,
+  typeof customAudienceInputSchema
+> {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/v0/destinations/custom_audience/routerTransform.ts` at line 58,
`CustomAudienceIntegration` is extending `BatchDestination` with only the record
generic, so the input schema type from `getInputSchema()` is not being carried
through. Update the class declaration to bind the second generic argument to
`customAudienceInputSchema` (or its inferred schema type) in the
`CustomAudienceIntegration` definition, and make sure any related base-class
typing at the other referenced location stays consistent so the schema-derived
input type is preserved.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/v0/destinations/posthog/routerTransform.ts`:
- Around line 13-27: The postHog input validation in routerTransform.ts rejects
valid numeric identifiers because the refinement on postHogInputSchema.message
uses truthiness for userId/anonymousId. Update the refine predicate to check for
null or undefined explicitly instead of using !!msg.userId and
!!msg.anonymousId, so numeric 0 is accepted when either identifier is provided.

---

Nitpick comments:
In `@src/services/destination/nativeBatching/batchDestination.ts`:
- Around line 34-38: Preserve the schema generic on the BatchDestination
constructor contract: BatchDestinationConstructor currently erases TInputSchema
by returning only BatchDestination<TBody>, which breaks shared typing between
getInputSchema() and transformEvents(). Update the constructor type in
batchDestination.ts to thread both TBody and the defaulted TInputSchema through
the instance type, then propagate that generic through validateInputs and
processBatchedDestination so validated batches can be typed as
InferRouterInput<TInputSchema>[]

In `@src/v0/destinations/custom_audience/routerTransform.ts`:
- Line 58: `CustomAudienceIntegration` is extending `BatchDestination` with only
the record generic, so the input schema type from `getInputSchema()` is not
being carried through. Update the class declaration to bind the second generic
argument to `customAudienceInputSchema` (or its inferred schema type) in the
`CustomAudienceIntegration` definition, and make sure any related base-class
typing at the other referenced location stays consistent so the schema-derived
input type is preserved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1be88e29-7c96-40cd-b5b2-9a10c372122e

📥 Commits

Reviewing files that changed from the base of the PR and between 5fa73dc and 692bfbb.

📒 Files selected for processing (10)
  • src/services/destination/nativeBatching/batchDestination.ts
  • src/services/destination/nativeBatching/processBatchedDestination.ts
  • src/services/destination/nativeBatching/types.ts
  • src/v0/destinations/custom_audience/routerTransform.ts
  • src/v0/destinations/customerio/routerTransform.ts
  • src/v0/destinations/customerio/v2/types.ts
  • src/v0/destinations/google_adwords_enhanced_conversions/routerTransform.test.ts
  • src/v0/destinations/google_adwords_enhanced_conversions/routerTransform.ts
  • src/v0/destinations/iterable_audience/routerTransform.ts
  • src/v0/destinations/posthog/routerTransform.ts
✅ Files skipped from review due to trivial changes (1)
  • src/v0/destinations/google_adwords_enhanced_conversions/routerTransform.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/v0/destinations/customerio/v2/types.ts
  • src/v0/destinations/iterable_audience/routerTransform.ts
  • src/services/destination/nativeBatching/types.ts

@shekhar-rudder
shekhar-rudder requested review from a team as code owners June 25, 2026 10:16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/v0/destinations/custom_audience/types.ts (1)

53-55: 📐 Maintainability & Code Quality | 🔵 Trivial

Use z.nativeEnum to remove the manual tuple cast

AUTHENTICATION_TYPES is an as const object. Switching to z.nativeEnum(AUTHENTICATION_TYPES) directly infers the union of literal values, eliminating the unsafe assertion and reducing maintenance overhead.

♻️ Proposed change
-    authenticationType: z.enum(
-      Object.values(AUTHENTICATION_TYPES) as [AuthenticationType, ...AuthenticationType[]],
-    ),
+    authenticationType: z.nativeEnum(AUTHENTICATION_TYPES),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/v0/destinations/custom_audience/types.ts` around lines 53 - 55, The
authenticationType schema in the custom audience types definition is using a
manual tuple cast with z.enum even though AUTHENTICATION_TYPES is an as const
object. Update the schema in types.ts to use z.nativeEnum(AUTHENTICATION_TYPES)
instead, so the literal union is inferred directly and the unsafe assertion can
be removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/v0/destinations/custom_audience/types.ts`:
- Around line 53-55: The authenticationType schema in the custom audience types
definition is using a manual tuple cast with z.enum even though
AUTHENTICATION_TYPES is an as const object. Update the schema in types.ts to use
z.nativeEnum(AUTHENTICATION_TYPES) instead, so the literal union is inferred
directly and the unsafe assertion can be removed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 90bbc94b-aca6-4ad8-8841-0b7d5e98138e

📥 Commits

Reviewing files that changed from the base of the PR and between 692bfbb and b8dd8d3.

⛔ Files ignored due to path filters (1)
  • test/integrations/destinations/iterable_audience/common.ts is excluded by !**/test/**
📒 Files selected for processing (9)
  • src/v0/destinations/custom_audience/routerTransform.ts
  • src/v0/destinations/custom_audience/types.ts
  • src/v0/destinations/custom_audience/utils.ts
  • src/v0/destinations/customerio/routerTransform.test.ts
  • src/v0/destinations/customerio/routerTransform.ts
  • src/v0/destinations/customerio/v2/types.ts
  • src/v0/destinations/iterable_audience/__tests__/routerTransform.test.ts
  • src/v0/destinations/iterable_audience/routerTransform.ts
  • src/v0/destinations/iterable_audience/types.ts
✅ Files skipped from review due to trivial changes (1)
  • src/v0/destinations/iterable_audience/tests/routerTransform.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/v0/destinations/iterable_audience/routerTransform.ts

@shekhar-rudder
shekhar-rudder force-pushed the refactor/batch-destination-schema-driven-types branch from f72a0be to 46c6df4 Compare June 25, 2026 11:48
@shekhar-rudder shekhar-rudder changed the title refactor(batch): infer config types from Zod input schema refactor(batch): use z.infer for schema-driven types across batch destinations Jun 25, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/services/destination/nativeBatching/batchDestination.ts (1)

55-67: 🗄️ Data Integrity & Integration | 🟠 Major

Correct z.infer input typing to match runtime validation behavior

The contract mismatch confirmed: batchDestination.ts lines 55‑67 type transformEvent/transformEvents arguments as z.infer<TInputSchema> (post‑parse Zod output), while processBatchedDestination.ts lines 53 pushes the original raw input despite successful parsing. This causes runtime shapes to diverge whenever schemas use z.preprocess, .default, .transform, or coercion (e.g., survicate/types.ts line 65; dub/types.ts line 190).

Remediate by either:

  • Changing parameter types to z.input<TInputSchema> (pre‑parse shape), or
  • Updating processBatchedDestination.ts line 53 to push parseResult.data instead of input.
Runtime vs Type Mismatch
// src/services/destination/nativeBatching/processBatchedDestination.ts
 ...
 -    valid.push(input);
 +    valid.push(parseResult.data);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/services/destination/nativeBatching/batchDestination.ts` around lines 55
- 67, The batching contract in transformEvent/transformEvents is typed as
z.infer<TInputSchema>, but processBatchedDestination still passes the raw input
after parsing, so the runtime value can differ from the declared shape. Fix this
by aligning the types and call site: either change the abstract method
parameters in batchDestination.ts to z.input<TInputSchema>, or update
processBatchedDestination to pass parseResult.data into
transformEvent/transformEvents instead of the original input. Use the existing
transformEvent, transformEvents, and getInputSchema symbols to keep the contract
consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/services/destination/nativeBatching/batchDestination.ts`:
- Around line 55-67: The batching contract in transformEvent/transformEvents is
typed as z.infer<TInputSchema>, but processBatchedDestination still passes the
raw input after parsing, so the runtime value can differ from the declared
shape. Fix this by aligning the types and call site: either change the abstract
method parameters in batchDestination.ts to z.input<TInputSchema>, or update
processBatchedDestination to pass parseResult.data into
transformEvent/transformEvents instead of the original input. Use the existing
transformEvent, transformEvents, and getInputSchema symbols to keep the contract
consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7e840b67-0f7b-473b-b6a7-502b6a8211da

📥 Commits

Reviewing files that changed from the base of the PR and between b8dd8d3 and f72a0be.

📒 Files selected for processing (12)
  • src/services/destination/nativeBatching/batchDestination.ts
  • src/services/destination/nativeBatching/types.ts
  • src/v0/destinations/custom_audience/routerTransform.ts
  • src/v0/destinations/customerio/routerTransform.test.ts
  • src/v0/destinations/customerio/routerTransform.ts
  • src/v0/destinations/google_adwords_enhanced_conversions/routerTransform.test.ts
  • src/v0/destinations/google_adwords_enhanced_conversions/routerTransform.ts
  • src/v0/destinations/iterable_audience/routerTransform.ts
  • src/v0/destinations/iterable_audience/types.ts
  • src/v0/destinations/posthog/routerTransform.test.ts
  • src/v0/destinations/posthog/routerTransform.ts
  • src/v0/destinations/posthog/types.ts
💤 Files with no reviewable changes (1)
  • src/services/destination/nativeBatching/types.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/v0/destinations/customerio/routerTransform.test.ts
  • src/v0/destinations/google_adwords_enhanced_conversions/routerTransform.ts
  • src/v0/destinations/customerio/routerTransform.ts
  • src/v0/destinations/custom_audience/routerTransform.ts

@shekhar-rudder
shekhar-rudder force-pushed the refactor/batch-destination-schema-driven-types branch 4 times, most recently from 38cef5d to 039f3a4 Compare June 25, 2026 12:19
@shekhar-rudder shekhar-rudder changed the title refactor(batch): use z.infer for schema-driven types across batch destinations fix(batch): use z.infer for schema-driven types across batch destinations Jun 30, 2026
shekhar-rudder and others added 2 commits July 3, 2026 15:22
…tinations

- Replace InferRouterInput with z.infer<typeof schema> in all
  BatchDestination transformEvent signatures — integrations no longer
  need to understand framework-specific utility types
- Remove InferRouterInput, ExtractMessage, and SchemaOutput from the
  batching framework (ExtractDestinationConfig/ExtractConnectionConfig
  remain for this.destination/this.connection typing)
- Add PostHogDestinationConfigSchema and enrich PostHog/GAEC input
  schemas with destination config for schema-driven typing
- Remove unused name field from IterableDestinationConfigSchema
- Zero runtime behavior change

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@shekhar-rudder
shekhar-rudder force-pushed the refactor/batch-destination-schema-driven-types branch from 7b656e8 to ae72f1a Compare July 3, 2026 10:58
@shekhar-rudder shekhar-rudder changed the title fix(batch): use z.infer for schema-driven types across batch destinations refactor(batch): use z.infer for schema-driven types across batch destinations Jul 3, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

@maheshkutty

Copy link
Copy Markdown
Contributor

LGTM

@shekhar-rudder
shekhar-rudder merged commit b4030a0 into develop Jul 3, 2026
35 checks passed
@shekhar-rudder
shekhar-rudder deleted the refactor/batch-destination-schema-driven-types branch July 3, 2026 13:39
shekhar-rudder added a commit that referenced this pull request Jul 3, 2026
…spatch

Reconcile the record-dispatch framework with develop's schema-driven
BatchDestination refactor (#5315) and the customerio event-stream schema
fix (#5331):

- Re-base VDMV2ObjectDestination onto BatchDestination<TBody, TInputSchema>,
  deriving connection/destination config types from the Zod input schema
  instead of the retired TConfig/TConnectionConfig generics.
- Point customerio's router transform at the schema-driven customerIOInputSchema
  (which now carries the #5331 record-vs-event-stream union) while keeping the
  PR's transformObjectRecord / transformEventStream dispatch.
- Update the framework's VDMV2ObjectDestination tests to the new generic signature.

Co-Authored-By: Claude Opus 4.8 (1M context) <[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.

3 participants