Skip to content

sbe: diagnose a stale descriptor in Codec::New, as protowire-go does - #124

Merged
trendvidia merged 1 commit into
mainfrom
sbe-stale-122
Nov 5, 2026
Merged

trendvidia merged 1 commit into
mainfrom
sbe-stale-122

Conversation

@bfrancojr

Copy link
Copy Markdown
Collaborator

Fixes #122

Stacked on #123 (the XML converters), whose ProtoToXML carried the first copy of this check. Merge #121, then #123, then this.

sbe::Codec::New now diagnoses a descriptor compiled against the pre-v1.12.0 sbe/annotations.proto the way protowire-go does:

  • A file whose (sbe.schema_id) sits at the retired number 50100 gets sbe: file <name> carries (sbe.schema_id) at retired option number 50100 (registered as 1319 since protowire v1.12.0): the descriptor predates ... must be recompiled ....
  • A message whose (sbe.template_id) sits at 50200 gets the same diagnosis. It used to be skipped silently, as if it weren't a template, so the codec just didn't know the message.
  • A file with no schema id now says sbe: file <name> missing (sbe.schema_id) option, Go's text, where it said <name> missing (sbe.schema_id) file option.

The check, StaleFileError and StaleMessageError in annotations.cc, is now shared with ProtoToXML. A retired number that the descriptor's pool declares as an extension counts as a known option, not a stale one. That's how Go's compiler stores it, and the #123 differential fixture stale.proto pins it.

Evidence

  • Tests: SbeStale.CodecNewDiagnosesStaleDescriptors builds descriptors whose options carry 50100 or 50200 as unknown fields, and checks Go's text for both, plus that a plain message is still skipped. SbeStale.CodecNewMissingSchemaIDText checks the new missing text with a pool that declares 50100.
  • Mutations, one per check: without the file check, without the message check, and without the pool-declared exemption, a test fails each time.
  • Full suite: 655 of 655 pass, 0 error: lines. The --sbe-xml differential output is unchanged and still identical to Go main's. Formatted with clang-format 18.1.8.

@bfrancojr

Copy link
Copy Markdown
Collaborator Author

Rebased onto #123's new head 212cd45 (this PR's head is now f75124d). The only conflict was CHANGELOG.md, where I kept both entries. Evidence for the pair is on #123: 676 of 676 tests pass, and the differential is clean against Go c13c69b. Against Go main the differential is red because of #134 and #129, not this PR. #132 and #134 will stack on this branch, since they change Codec::New too.

@bfrancojr

Copy link
Copy Markdown
Collaborator Author

Rebased onto main e1c1b72 (#136 merged); head is now 801d607. 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.

Base automatically changed from sbe-xml-96 to main November 4, 2026 22:48
A file or message carrying its SBE option at the pre-v1.12.0 number is
reported as stale instead of missing or silently skipped, and the
missing-schema-id error uses Go's words. The check moves to annotations.cc,
shared with ProtoToXML.
@bfrancojr

Copy link
Copy Markdown
Collaborator Author

Rebased onto main df6b102 (#123 merged); head is now 76f7a4e. The rest of the stack moved with it in one rebase: #137 bcedc19, #140 43eabbe, #143 456dd6e, #147 db34ed3. Each layer's diff against its base is unchanged. Local ctest at the top (#147): 705 of 705. Unmodified scripts/go_differential.sh at #137's head bcedc19, against protowire-go main a1e79dd and spec main 7bde7a9: exit 0, every section ran (954 damaged streams decoded alike, 18 SBE schemas converted alike, 362 documents), no differences. So main's differential should go green once #124 and #137 are in.

@trendvidia
trendvidia merged commit 69fce36 into main Nov 5, 2026
10 of 11 checks passed
@trendvidia
trendvidia deleted the sbe-stale-122 branch November 5, 2026 00:03
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 lacks protowire-go's stale-descriptor diagnosis, and its missing-schema-id text differs

2 participants