Skip to content

Bazel 9 upgrade, Any wire transcoding, and coverage tests#2

Merged
dallison merged 10 commits into
mainfrom
bazel9-coverage-and-any-wire
Jun 1, 2026
Merged

Bazel 9 upgrade, Any wire transcoding, and coverage tests#2
dallison merged 10 commits into
mainfrom
bazel9-coverage-and-any-wire

Conversation

@dallison

@dallison dallison commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Upgrade build to Bazel 9.1, protobuf 34, and toolbelt 2.0 (BCR deps, rules_go override).
  • Fix negative int32/int64 varint encode/decode in wireformat.h (was breaking protobuf round-trips).
  • Implement google.protobuf.Any protobuf-wire transcoding in any.h (in-memory phaser binary unchanged; transcoding at wire boundaries).
  • Add coverage.proto plus all_types_test and stress_test for scalars, maps, packed/unpacked repeated fields, imports, and buffer pressure.
  • Fix phaser_library symlink conflicts for transitive protos (e.g. Foo.phaser.h from multiple targets).
  • Improve .bazelrc: ASAN config (--config=asan), macOS platform flags, native arm64 flags when using --config=apple_silicon (needed when Bazel runs under Rosetta).

Test plan

  • bazelisk test //phaser:all_types_test //phaser:phaser_test //phaser:stress_test
  • bazelisk test //phaser/runtime:message_test //phaser/runtime:wireformat_test
  • bazelisk test //phaser/... (full suite; perf_test ~9 min)
  • ASan on Linux CI (bazel test //phaser/... --config=asan) — macOS 26 currently hangs at ASan startup locally

dallison added 8 commits June 1, 2026 13:15
Move to Bazel 9.1, protobuf 34, and toolbelt 2.0; fix negative int varint
encoding, google.protobuf.Any protobuf-wire transcoding, and phaser_library
symlink conflicts for transitive protos. Add all_types and stress tests, ASAN
config, and native arm64 build flags for Apple Silicon.
- Fix designated-initializer order in generated BankInfo (message_gen.cc)
  to match the struct declaration so generated code compiles.
- Escape backslash/quote bytes in debug string output to match protobuf
  text format; generalize the protobuf debug-redaction stripping helper.
- Fix Any message leaks by taking ownership of bank-allocated messages.
- Zero-initialize payload/proto buffers (and test buffers) on allocation
  and growth to avoid uninitialised-memory reports under valgrind.
- Free test buffers/objects in message_test to remove definite leaks.
- Upgrade cpp_toolbelt to 2.1.2 (PayloadBuffer::Realloc use-after-free fix).
- Add a cross-platform asan config and a Linux valgrind config (with a
  suppressions file for benign third-party Hexdump reads).
- Add GitHub Actions CI: test (Linux+macOS), asan (macOS), valgrind (Linux),
  all excluding perf_test.
Hexdump reads in 16-byte rows and runs past the end of tightly-sized
serialization buffers, which trips a heap-buffer-overflow under ASan
(message_test). These were debug-only calls with no assertions, so
remove them. Also add a Linux ASan job mirroring the macOS one.
Switching a union from a scalar/enum arm to a string/message arm on a
reused message crashed: the scalar arm's Clear() is a no-op and left its
bytes in the shared value slot, which the variable-length arm misread as
an allocated buffer offset. UnionField::Clear now zeros the slot's buffer
offset so the new arm allocates fresh storage.

Add MessageTest.UnionArmSwitchInPlace covering in-place arm switching and
variable-length shrink (toolbelt ShrinkBlock) on a single message.
@dallison dallison marked this pull request as ready for review June 1, 2026 22:30
dallison added 2 commits June 1, 2026 16:17
ProtoBuffer(std::string_view) does not own its storage, so constructing
a reader directly from the temporary returned by AsString() left it with
a dangling pointer into the destroyed string. ASan flagged the read in
DeserializeVarint. Hold the encoded string in a named local that outlives
the ProtoBuffer.
@dallison dallison merged commit 6d5dc06 into main Jun 1, 2026
5 checks passed
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.

1 participant