Repository navigation
fix(connectors): reject ambiguous proto field mappings - #4581
ParthibanRajasekaran wants to merge 12 commits into
Conversation
|
This PR is closed because its description has no Every PR needs an issue that was assigned to you before work started. See CONTRIBUTING.md. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4581 +/- ##
============================================
+ Coverage 80.83% 80.89% +0.06%
Complexity 3107 3107
============================================
Files 1467 1467
Lines 356533 356620 +87
Branches 300421 300508 +87
============================================
+ Hits 288194 288505 +311
+ Misses 61617 61237 -380
- Partials 6722 6878 +156
🚀 New features to boost your workflow:
|
|
CI is currently blocked only by an unrelated integration-test failure in |
|
i'll check this flaky test @ParthibanRajasekaran |
mmodzelewski
left a comment
There was a problem hiding this comment.
Nit: encode_should_resolve_ambiguous_reverse_lookup_to_one_of_the_colliding_keys at core/connectors/sdk/src/encoders/proto.rs:1023 still treats duplicate JSON names as valid input. Once update_config runs the check, change it to expect the rejection.
Nit: core/connectors/sdk/README.md:185 lists the encoder fields but omits field_mappings. Add a bullet that says keys are protobuf names, values are JSON names, and values must be unique.
|
/author |
Which issue does this PR address?
Relates to #4386
Rationale
ProtoEncoderConfig.field_mappingsmaps protobuf field names to JSON field names. When multiple protobuf fields mapped to the same JSON name, the encoder's reverse lookup depended onHashMapiteration order and could select either field nondeterministically.The accepted scope is limited to configuration loading. Broader runtime collision behavior and the other field-mapping configurations remain unchanged.
What changed?
Deserializing
ProtoEncoderConfignow rejectsfield_mappingscontaining duplicate JSON field names. Missing, null, empty, and uniquely named mappings retain their existing behavior.Regression tests cover duplicate rejection and each preserved configuration form.
Local Execution
cargo fmt --allcargo sort --no-format --workspacecargo clippy -p iggy_connector_sdk --all-targets --all-features -- -D warningscargo test -p iggy_connector_sdk --all-featurescargo build -p iggy_connector_stdout_sink -p iggy_connector_random_sourceprek run --from-ref 4f58678d^ --to-ref 4f58678d