Repository navigation
sbe: refuse a oneof field in a message or composite, as protowire-go does - #147
Conversation
0529a25 to
448b8af
Compare
d00be54 to
e45944c
Compare
448b8af to
456dd6e
Compare
e45944c to
db34ed3
Compare
db34ed3 to
39e1261
Compare
456dd6e to
b945fdf
Compare
|
Rebased onto main 197e05b, after #124 and #137 merged as squashes: db34ed3 → 39e1261. The old #124 and #137 commits were dropped ( |
b945fdf to
72c54f1
Compare
39e1261 to
2ee007c
Compare
|
Rebased onto main 9525e9b, after #140 merged as a squash: 39e1261 → 2ee007c. I dropped #140's old commit with |
…does Go's template.go refuses a field in a non-synthetic oneof when it builds a message template or a composite. This port bound it, giving every member its own block slot. A proto3 optional field and a oneof in a group entry still bind, as in Go. Fixes #141
2ee007c to
674b935
Compare
|
Rebased onto main 1706247, after #143 merged as a squash: 2ee007c → 674b935. I dropped #143's old commit with |
Fixes #141.
sbe::Codec::Newnow refuses a field in a oneof, in a message or a composite. It uses protowire-go's texts (encoding/sbe/template.go, present since d137dd0):sbe: oneof field <M>.<f> not supported;composite <C> contains oneof field <f>, under the caller's prefix, for examplesbe: composite M.c: composite C contains oneof field a.What still binds: a proto3
optionalfield, which sits in a synthetic oneof, and a oneof in a group entry. Go does not check either.This narrows what binds. Before, such a message bound with a block slot for every member, and
Marshalwrote the unset members as zero. The CHANGELOG says so.Merge order: #123 → #124 → #137 → #140 → #143 → this PR. The base is
sbe-encoding-range-133(#143), because the check sits in the same bind code.Evidence (macOS, fresh build at d00be54):
SbeOneof.NewCodecand no check, all four shapes Go refuses bound in C++ (bound; want …). These were a message, a composite, a nested composite, and a composite in a group. The three shapes that must bind did bind. This run is also the mutation check: without the check, each refused case fails.SbeOneof.NewCodecpasses, andctestpasses 690 of 690.scripts/go_differential.shagainst protowire-go main 207fdfc and spec main 0317811 exits 1. Every section ran:954 damaged streams decoded alike,18 SBE schemas converted alike, 9 of them refused,362 documents. The 450 differing lines are PXF only, the same count as on sbe: refuse a value its (sbe.encoding) primitive cannot hold (#133) #143: pxf: reject null on a (pxf.required) or @required field #131's null rule, pxf: FormatDocument drops every directive, so a @dataset document formats to nothing #130's formatter and pxf: Marshal leaves out an unset (pxf.default) or (pxf.required) field, so it doesn't read back #129. Those have their own PRs (pxf: reject null on a (pxf.required) or @required field #138, pxf: keep every directive when formatting a document (#130) #135, pxf: write an unset annotated field so that it reads back (#129) #136). No SBE line differs.template.cc.Go has no test for this check, so the test cases come from the issue and Go's code.