fix(connectors): preserve transformed payload schema across FFI#3669
Open
Standing-Man wants to merge 1 commit into
Open
fix(connectors): preserve transformed payload schema across FFI#3669Standing-Man wants to merge 1 commit into
Standing-Man wants to merge 1 commit into
Conversation
Sink transforms can change the Payload variant after the input stream has been decoded, but the runtime forwarded decoder.schema() to sink plugins. Plugins then reconstructed the transformed bytes using the stale input schema. Derive the schema from transformed payloads and use it for both FFI metadata containers. Reject mixed-schema messages within a batch and cover Raw-to-Text conversion at the FFI boundary. Signed-off-by: StandingMan <jmtangcs@gmail.com>
|
Thanks for the PR. It is labeled Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3669 +/- ##
=============================================
- Coverage 73.49% 45.48% -28.01%
Complexity 937 937
=============================================
Files 1291 1289 -2
Lines 141568 125216 -16352
Branches 117128 100776 -16352
=============================================
- Hits 104046 56956 -47090
- Misses 34300 65611 +31311
+ Partials 3222 2649 -573
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR address?
Closes #
Relates to #
Rationale
Sink transforms can change the payload format after a message has been decoded.
For example, a transform may convert a raw payload into text or a Protobuf
payload into JSON.
The runtime serialized the transformed payload bytes but continued to attach
the original decoder schema to the FFI batch. The sink plugin then reconstructed
the payload using that stale schema, which could cause transformed bytes to be
decoded as the wrong payload type or rejected entirely.
What changed?
The payload schema is now derived from the transformed
Payloadvariant beforethe message crosses the FFI boundary. The derived schema is written to both
MessagesMetadataandRawMessages, keeping the two existing FFI metadatarepresentations consistent.
Messages whose transformed schema differs from the rest of the batch are
rejected and counted as errors instead of being reinterpreted using an
incompatible schema. The FFI function signatures,
#[repr(C)]layouts, andpostcard payload structures remain unchanged.
A regression test converts a raw payload to text and verifies inside the FFI
callback that both metadata structures carry
Schema::Text.Local Execution
passed
ran
AI Usage
unit tests, integration-style SDK tests, and representative plugin builds.