Skip to content

fix: close if-block before starting a new one in sort_vinca_lists - #152

Merged
traversaro merged 1 commit into
RoboStack:masterfrom
Tobias-Fischer:fix/sort-vinca-lists-adjacent-if-blocks
Sep 6, 2026
Merged

fix: close if-block before starting a new one in sort_vinca_lists#152
traversaro merged 1 commit into
RoboStack:masterfrom
Tobias-Fischer:fix/sort-vinca-lists-adjacent-if-blocks

Conversation

@Tobias-Fischer

Copy link
Copy Markdown
Contributor

Summary

  • vinca-sort-vinca-lists parses packages_select_by_deps (etc.) by collecting all - if: ... then: [...] blocks, then sorting each block's then: items independently.
  • Two - if: blocks placed back-to-back, with no blank line or comment between them, were being merged into a single block during parsing: the code only closed the currently-open block when it hit a list-level comment, never when it hit a new- if: line.
  • Once merged, sorting pooled both blocks' then: items into one flat list and reassigned them back to their original line positions — which can move an item that belongs to one platform condition into a different, unrelated one.
  • Reproduced downstream in RoboStack/ros-rolling: adding several packages to a - if: not wasm32 and not win block that was immediately followed (no separating comment) by - if: linux and not aarch64 caused webots_ros2 (linux-only, non-aarch64) to swap places with an item from the other block after a routine sort. The existing workaround there was a comment between the two blocks, which happened to close the block correctly as a side effect — this PR fixes the actual boundary detection so that workaround isn't required.

Fix

Close the current if-block whenever a new - if: line is seen (mirroring the existing comment-based close), so each block's then: items are sorted within their own scope regardless of whether they're adjacent to another block.

Test plan

  • Added vinca/test_sort_vinca_lists.py with a regression test reproducing the bug (adjacent if-blocks, no separator) and a companion test confirming the comment-separator workaround still works
  • pixi run test — 161 passed (was 157; +4 new)
  • pixi run fmt-check and pixi run lint-check — clean

🤖 Generated with Claude Code

Two "- if:" blocks placed back-to-back with no blank line or comment
between them were parsed as a single block, since the "then:" handler
never resets in_then between blocks. Sorting then pooled both blocks'
then-items into one flat list and redistributed them by original line
position, which can move an item across a platform-condition boundary
into the wrong block.
Reproduced downstream in RoboStack/ros-rolling: adding entries to a
"not wasm32 and not win" block right before an adjacent, comment-less
"linux and not aarch64" block caused webots_ros2 (linux-only) to swap
places with an item that should have stayed unconditional.
Close the current if-block whenever a new "- if:" line is seen, the
same way a list-level comment already does, so each block sorts within
its own scope regardless of adjacency.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Tobias-Fischer added a commit to RoboStack/ros-rolling that referenced this pull request Sep 5, 2026
…em_modes_msgs seed
rosgraph_monitor, rviz_2d_overlay_plugins, sick_safetyscanners_base,
spacenav, system_modes, trac_ik, and zed_msgs were all gated under
if: linux (or, for zed_msgs, linux and not aarch64) in this repo's
vinca.yaml despite jazzy already building every one of them on osx
(its own vinca.yaml selects them under "not win"/"not linux"). Moved
them into the not-wasm32-and-not-win block instead of duplicating them,
and added a comment separator so vinca-sort-vinca-lists' known
adjacent-if-block-merging bug doesn't scramble the boundary on the next
sort (see build_feedback.md's vinca-sort-vinca-lists entry, and
RoboStack/vinca#152 for the upstream fix).
Also added system_modes_msgs as an explicit seed -- system_modes
depends on it but it wasn't reachable any other way for this distro.
Each of the 7 was individually verified via rebuild before being kept
in this platform-loosened state; three needed additional fixes to
actually build once genuinely attempted for the first time on macOS:
- rosgraph_monitor: same "-Wl,--no-undefined is GNU-ld-only" pattern
already fixed for rmw_stats_shim this session.
- system_modes: the already-documented Rolling-wide
ament_target_dependencies() removal (see build_feedback.md), fixed
with the same local link_ament_dependencies() macro pattern.
- sick_safetyscanners_base: the largest fix of the three -- Boost.ASIO
API removals across 8 files: find_package(Boost COMPONENTS system)
dropped (header-only now, matches the rtabmap/web-video-server/
cartographer_ros pattern), boost::asio::io_service -> io_context,
io_service::work -> executor_work_guard<io_context::executor_type>
(constructed via make_work_guard), boost::asio::deadline_timer ->
explicit boost::asio::basic_deadline_timer<boost::posix_time::ptime>
(the plain deadline_timer typedef is gated behind a macro this Boost
build doesn't define, but the underlying template is still present
and just deprecated-not-removed), address_v4::from_string ->
make_address_v4, address_v4::to_ulong -> to_uint, plus two missing
<boost/date_time/posix_time/posix_time_types.hpp> includes that used
to arrive transitively via the now-gated deadline_timer.hpp.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@traversaro
traversaro merged commit c3ebb0f into RoboStack:masterSep 6, 2026
3 checks passed
Sign up for freeto 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.

2 participants

@Tobias-Fischer@traversaro