Skip to content

sbe: refuse a oneof field in a message or composite, as protowire-go does - #147

Merged
trendvidia merged 1 commit into
mainfrom
sbe-oneof-141
Nov 5, 2026
Merged

trendvidia merged 1 commit into
mainfrom
sbe-oneof-141

Conversation

@bfrancojr

Copy link
Copy Markdown
Collaborator

Fixes #141.

sbe::Codec::New now 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):

  • in a message: sbe: oneof field <M>.<f> not supported;
  • in a composite: composite <C> contains oneof field <f>, under the caller's prefix, for example sbe: composite M.c: composite C contains oneof field a.

What still binds: a proto3 optional field, 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 Marshal wrote 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):

Go has no test for this check, so the test cases come from the issue and Go's code.

@bfrancojr

Copy link
Copy Markdown
Collaborator Author

Rebased onto main e1c1b72 (#136 merged); head is now e45944c. The PR's own diff is unchanged, checked by comparing its added and removed lines before and after the rebase. Rebased as part of the SBE stack; evidence is on #123.

@bfrancojr

Copy link
Copy Markdown
Collaborator Author

Rebased with the stack onto main df6b102; head is now db34ed3. Evidence is on #124.

@bfrancojr

Copy link
Copy Markdown
Collaborator Author

Rebased onto main 197e05b, after #124 and #137 merged as squashes: db34ed3 → 39e1261. The old #124 and #137 commits were dropped (git rebase --onto origin/main bcedc19), so this PR's own commit is the only one replayed. Its diff is unchanged, apart from where its CHANGELOG line lands. At the stack top (39e1261): build OK, ctest 100% tests passed out of 705. The remote head was read back with git ls-remote: 39e1261.

@bfrancojr

Copy link
Copy Markdown
Collaborator Author

Rebased onto main 9525e9b, after #140 merged as a squash: 39e1261 → 2ee007c. I dropped #140's old commit with git rebase --onto origin/main 3486d29. The diff is unchanged apart from where the CHANGELOG line lands. At the stack top (2ee007c): build OK, ctest 100% tests passed out of 705. The remote head was read back with git ls-remote: 2ee007c.

Base automatically changed from sbe-encoding-range-133 to main November 5, 2026 02:45
…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
@bfrancojr

Copy link
Copy Markdown
Collaborator Author

Rebased onto main 1706247, after #143 merged as a squash: 2ee007c → 674b935. I dropped #143's old commit with git rebase --onto origin/main 72c54f1. The diff is unchanged, and it still adds one CHANGELOG line. Build OK, ctest 100% tests passed out of 705. The remote head was read back with git ls-remote: 674b935.

@trendvidia
trendvidia merged commit 9b9860a into main Nov 5, 2026
11 checks passed
@trendvidia
trendvidia deleted the sbe-oneof-141 branch November 5, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sbe: Codec::New binds a message with a oneof field, which protowire-go refuses

2 participants