Fix ROOT blackboard export in Groot2 publisher#1168
Merged
Conversation
When a subtree's blackboard is backed by a separate root blackboard (e.g. created via `Blackboard::create(external_root)` to expose `@` globals), the Groot2 publisher never exported those root entries, so they were invisible in Groot2. Export the root blackboard under the reserved name `ROOT` whenever a requested subtree resolves to a distinct root blackboard. - Deduplicate the `ROOT` payload when several subtrees share the same root blackboard. - Return the dump as `Expected<>` and send an error reply for ambiguous requests: a subtree literally named `ROOT`, or a request spanning multiple distinct root blackboards. - Add functional coverage to gtest_groot2_publisher_integration.cpp using the shared Groot2Test helpers (makePublisher/Client). - Enable `/utf-8` for behaviortree_cpp_test on MSVC so the Unicode name-validation tests build on Windows. Closes #1130 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
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.



Summary
Rebased and cleaned-up version of #1132 by @magic-alt (original authorship preserved on the commit).
When a subtree's blackboard is backed by a separate root blackboard — e.g. created via
Blackboard::create(external_root)to expose@globals — the Groot2 publisher never exported those root entries, so they were invisible in Groot2. This exports the root blackboard under the reserved nameROOTwhenever a requested subtree resolves to a distinct root blackboard.ROOTpayload when several subtrees share the same root blackboard.Expected<>and send anerrorreply for ambiguous requests: a subtree literally namedROOT, or a request spanning multiple distinct root blackboards./utf-8forbehaviortree_cpp_teston MSVC so the existing Unicode name-validation tests build on Windows.Closes #1130.
What changed vs #1132
#1132 was written against an older
master, before the Groot2 thread-safety refactor (#1165) reshapedserverLoop/generateBlackboardsDump. This branch:Expected<>return + error-reply path through the refactoredserverLoop(the conflicting hunk).gtest_loggers.cppand intogtest_groot2_publisher_integration.cpp, where the other real-ZMQ Groot2 tests live — so they are gatedBTCPP_GROOT_INTERFACE AND NOT WIN32like their siblings (real-ZMQ tests are intentionally not run on Windows, see the note intests/CMakeLists.txt).Groot2Test::makePublisher/Clienthelpers instead of hand-rolling a ZMQ client, hardcoded ports, and a fixed sleep.Design note
ROOTis exported for any requested subtree whose blackboard has a parent (every non-root subtree does, sinceBlackboard::create(parent)links the chain). So even plain multi-subtree trees with no external root now show aROOTentry duplicating the main tree's blackboard. This matches the approach in #1130; if we'd rather exposeROOTonly for genuinely external root blackboards, that's a small tweak to theneeds_exported_rootcondition — happy to adjust.Test plan
cmake -S . -B build -DBTCPP_GROOT_INTERFACE=ON && cmake --build build— clean, no warnings.Groot2PublisherIntegration.*7/7 (2 existing + 5 new blackboard tests).BTCPP_GROOT_INTERFACE=OFFbuild: compiles clean, Groot2 tests correctly excluded.clang-format-21clean on all touched files.🤖 Generated with Claude Code