bazel: ban boost::property_tree::get<ss::sstring> via force-include#30375
Draft
nvartolomei wants to merge 1 commit intoredpanda-data:devfrom
Draft
bazel: ban boost::property_tree::get<ss::sstring> via force-include#30375nvartolomei wants to merge 1 commit intoredpanda-data:devfrom
nvartolomei wants to merge 1 commit intoredpanda-data:devfrom
Conversation
ptree::get<ss::sstring>(path, default) silently returns the default for non-empty trees because seastar::sstring lacks a stream extractor; boost's stream_translator falls through and the failure is invisible at compile time and at runtime. Force-include base/ptree_ban.h via redpanda_copts(), which partially specializes boost::property_tree::translator_between for basic_sstring with a static_assert. The new //src/v/base:ptree_ban target is wired as an implicit dep of redpanda_cc_library / redpanda_cc_binary and the test/bench rules so the header resolves under layering_check. Existing call sites in cloud_storage_clients fail to build with this change and need to be migrated to std::string in a follow-up.
14d2557 to
301a56b
Compare
Contributor
Author
|
/rp-unit-test |
Contributor
Author
|
/ci-repeat 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
boost::property_tree::ptree::get<ss::sstring>(path, default)silentlyreturns the supplied default for non-empty trees because
seastar::sstringlacks a stream extractor; boost'sstream_translatorfalls through and the failure is invisible at both compile time and
runtime — the call site looks correct.
This PR makes the pattern a hard compile error.
What's wired
src/v/base/ptree_ban.h: forward-declaresseastar::basic_sstringandpartially specializes
boost::property_tree::translator_betweenforit with a
static_assert(false, …)carrying a pointed message.//src/v/base:ptree_ban: header-onlycc_library(uses the nativerule directly to avoid the
redpanda_cc_librarymacro recursing intoitself).
bazel/internal.bzl:redpanda_copts()appends-include base/ptree_ban.h; newredpanda_implicit_deps()returns["//src/v/base:ptree_ban"]so the header is visible underlayering_check.bazel/build.bzl+bazel/test.bzl: threadredpanda_implicit_deps()through
redpanda_cc_library,redpanda_cc_binary,_redpanda_cc_test,_redpanda_cc_fuzz_test,redpanda_cc_btest_no_seastar,redpanda_test_cc_library, andredpanda_cc_bench.Third-party
cc_librarytargets are unaffected — only Redpanda's ownmacros inject the force-include.
Diagnostic
Existing breakage surfaced
This change does not compile against
devas-is — it surfaces whatappear to be real, latent silent failures in S3/Azure error parsing
that need follow-up fixes:
src/v/cloud_storage_clients/abs_client.cc:122-123src/v/cloud_storage_clients/s3_client.cc:550-553, 1401-1404, 1837Those call sites parse cloud error responses and have been resolving
Error.Code/Error.Message/Error.RequestIdto the supplieddefaults (
"Unknown"/"") regardless of what the server returned.A follow-up PR will switch them to
std::stringand adapt the callsites; this PR is filed as a draft to discuss the approach before that
follow-up lands.
Backports Required
Release Notes