~bigbes/tarantool-protobuf: 849b7662

codec: recursively merge repeated singular-message wire entries

Per proto3 spec, when the same singular message field (including a oneof
branch) appears twice on the wire, the two values must merge: scalar
fields last-wins, repeated fields concatenate, sub-messages merge
recursively, maps last-wins per key. The previous reader replaced the
prev value wholesale for oneof branches and overwrote repeated/nested
fields with `prev[k] = v` even outside oneofs, losing data unique to
the first occurrence.

Adds wire.codec.merge_message(desc, prev, decoded), a descriptor-driven
recursive merge, and routes both codec.lua's reader and the inline-mode
codegen through it. WKT message fields (custom decode) keep the replace
behavior because their decoded value is not a generic Lua table.

Exposes pb.codec to the generated inline code so the helper is reachable
without a per-call require.

Drops 3 entries from test/conformance/known_failures.txt:
ValidDataOneof.MESSAGE.Merge, ValidDataOneofBinary.MESSAGE.Merge,
RepeatedScalarMessageMerge. Adds 5 regression tests covering scalar
last-wins, oneof merge, recursive sub-message merge, repeated-in-
submessage concat, and oneof sibling clearing after merge.

Eugene Blikh <bigbes@gmail.com> — 2026-05-15 21:37:04 UTC

Commit 849b76621645872c730345a667355000e017fbe8view raw patch

Parent(s): 2180b76a

8 changed file(s)

FileStatus+
cmd/protoc-gen-tarantool/internal/gen/inline.go M +9 -5
examples/expected/full/conformance/conformance_pb.lua M +1 -2
examples/expected/full/hello/hello_pb.lua M +18 -80
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua M +26 -121
runtime/pb/codec.lua M +54 -7
runtime/pb/init.lua M +4
test/conformance/known_failures.txt M -3
test/conformance_test.lua M +94