fix: preserve empty subtree model defaults (backport for 10.1.1) - #32
Conversation
A SubTree model port declared with default="" was treated as mandatory, because the instantiation check tested the default's string form instead of whether a default was declared. Gate on the Any, as the model writer and XSD generator already do. Backport of d665d41 from #29 (the 4.9.0 port) onto main so it can ship in MoveIt Pro 10.1.1. Fixes PickNikRobotics/moveit_pro#22069. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. 6 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour. 📝 SummarySummary by CodeRabbit
WalkthroughSubtree model port validation now checks ChangesSubtree port defaults
Priority: ⬆️ High Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change addresses empty defaults for XML subtree models, with regression assertions for empty, non-empty, remapped-empty, and missing defaults. No actionable merge-blocking risk is established. 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation The parser change satisfies the core [
Comment |
Under pixi's Windows job, the two tests that use SCOPED_TRACE crash with 0xc0000005: this one and Reactive.MissingOrEmptyGenericChildIdIsRejected, which #33 changes the same way. Stream the case name into each assertion instead, and wrap the build in ASSERT_NO_THROW so an unexpected throw still names its case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[written by AI]
The parser treats a SubTree model port declared
<inout_port name="note" default=""/>as mandatory, so a parent that invokes the subtree without remappingnotefails to build withis defining a mandatory port called [note], but you are not remapping it. The instantiation check insrc/xml_parsing.cpptesteddefaultValueString().empty(), which cannot telldefault=""from a missingdefault. It now testsdefaultValue().empty(), theAnythat is set only when the attribute exists. The model writer and XSD generator in the same file already use that test.This cherry-picks d665d41 from #29 onto
mainso the fix can ship in MoveIt Pro 10.1.1 on the 4.7.2 package, instead of waiting for the 4.9.0 port in 10.2.0. The only conflict was the test file, wheremainhasSubTree.WhitespaceInSubtreeModelin the same spot. I kept both tests. clang-format rewrapped two lines of the new test tomain's column limit.Fixes PickNikRobotics/moveit_pro#22069.
SubTree.EmptyModelDefaultIsNotMandatorycovers the matrix from the issue:default=""noteis""(failed before this fix)default=""note=""default="something"noteissomethingdefaultRuntimeErrorCase B remaps the port explicitly, so it never reaches the changed line. A and D are the pair that pin it.
Validation ran in the
moveit-pro-dev:10.1.0-jazzyimage withLD_LIBRARY_PATHpointed at the fresh build so the installed 4.7.2-3 library does not shadow it.b61a3989EmptyModelDefaultIsNotMandatoryfails on the mandatory-port errorpre-commit run --from-ref origin/mainpassesThe second commit replaces
SCOPED_TRACEin the new test with<< test_case.nameon each assertion.SCOPED_TRACEcrashes the pixi Windows job, and with it gone that job passes on #33. Here it now fails only onReactive.MissingOrEmptyGenericChildIdIsRejected, which #33 fixes, so merge #33 first.Merge with a merge commit. PickNikRobotics/apt_build_farm#68 packages
b61a3989as revision 4, and a squash or rebase would orphan that SHA. PickNikRobotics/moveit_pro#23046 then pins4.7.2-4nobleonv10.1.🤖 Generated with Claude Code