infer schema strategy: nested nullable flips fail and nested {} to null is mangled
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Start with middleware_schema_infer.go, especially inferAndEncodePayload and inferPayloadSchema, where the issue says the witness and nullable merge only inspect top-level fields. Read the existing tests around inferred schema encoding, then add cases for nested empty maps, nullable flips in both directions, and nested type mismatches. Done means empty maps are preserved or rejected, nullable values encode successfully on both sides, and mismatches still fail.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Schema encode middleware: a nested empty map is written as NULL, and a nested value -> NULL flip still fails
Summary
There are two pre-existing limitations of the infer strategy for nested values. #193's fix does not change either of them; it only handles top-level fields.
- A nested
{}is silently encoded as NULL (invariant 6). The processor returnsbefore = {"n": {"f": {}}}andafter = {"n": {"f": nil}}. The schema inferred fromaftertypesnas an Avromapwhose values are["null","string"]. The codec accepts the empty map{}for that union and writes it as null.beforedecodes as{"n": {"f": nil}}, with no error. Main and #193 behave the same. #193 fixes the top-level version of this ({"f": {}}->{"f": nil}), because there the extracted schema is checked with a lossless round trip first. - A nested value -> NULL flip fails the record. With
before = {"n": {"q": 7}}andafter = {"n": {"q": nil}}, the map's values are inferred fromafteras["null","string"], andbefore's 7 does not fit (unknown union type int). This fails closed, so it is not data loss. But jsonb or Mongo-style nested documents whose inner fields go to NULL will see error records where Kafka Connect would succeed.
Where
middleware_schema_infer.go:inferAndEncodePayloadandinferPayloadSchema. The witness and nullable merge only look at top-level fields.- The fallback path's plain
encodeWithSchemadoes not round-trip check, becauseinferaccepts documented losses (int widened to long, sub-microsecond time truncation). That is why case 1 passes silently. - The codec behaviour (empty map accepted for
["null", T]) is iniskorotkov/avrovia conduit-commons' Avro serde.
Proposed fix
- Make the witness and nullable merge recursive over nested
StructuredDataandmap[string]any. A nested value that is nil on one side takes its type from the other side and becomes nullable at that path. For Avro map values, the nullable union goes on the map's value type. - Run the fallback encode through a round-trip check that tolerates only the documented
inferlosses (number width, time precision), and fails on anything else (a map turned into null, a dropped key). - Tests:
- nested
{}-> NULL keeps{}(or fails), never NULL; - nested value -> NULL and NULL -> value encode both sides;
- nested type mismatches still fail.
- nested
Out of scope
The extend strategy already fails closed on nested changes ("a key added to or removed from a nested record").
- Ngôn ngữ chính
- Go
- Star
- 1
- Fork
- 1
- Merge trung bình
- 11 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ConduitIO/conduit-processor-sdk
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Tất cả issue của ConduitIO/conduit-processor-sdk
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ConcatAgenticMessages loses the approval request ID of a streamed MCP tool callCó thể đã có người làm @ningsiyuan1024 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
containers/gvisor-tap-vsock#796 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
external needs:triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
celestiaorg/celestia-node#5448 ·
Maintainer thường phản hồi trong vòng 1 ngày