Skip to content

Keep generated MoveIt parameters out of ParameterBuilder state - #4014

Open
sylvesterkaczmarek wants to merge 1 commit into
moveit:mainfrom
sylvesterkaczmarek:fix/config-builder-dict-isolation
Open

sylvesterkaczmarek wants to merge 1 commit into
moveit:mainfrom
sylvesterkaczmarek:fix/config-builder-dict-isolation

Conversation

@sylvesterkaczmarek

@sylvesterkaczmarek sylvesterkaczmarek commented Nov 29, 2026 •

Copy link
Copy Markdown

Description

Fixes #4012. Merge generated MoveIt parameters into a fresh dictionary instead of changing the underlying ParameterBuilder state.

Checklist

  • Formatting and repository pre-commit checks
  • Regression test for repeated conversion and the opt-out flag
  • Tutorial, migration or GUI changes (not applicable)
  • Review another open PR

Validation: regression fails before the fix; 4 targeted Python tests pass afterward. Full ROS integration is pending CI.

Summary by CodeRabbit

  • Bug Fixes
    • Generating a full MoveIt configuration no longer changes the builder’s stored custom parameters. Returned configuration dictionaries can be modified without affecting later results, and configurations without MoveIt settings continue to contain only the custom parameters provided.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

to_dict() now copies the builder’s stored parameters before adding MoveIt configuration values. A new test checks that opt-out results exclude generated values and that modifying a returned dictionary does not change the builder’s custom parameter.

Changes: Builder dictionary behavior

Layer / File(s) Summary
Copy parameters and verify dictionary results
moveit_configs_utils/moveit_configs_utils/moveit_configs_builder.py, moveit_configs_utils/test/test_config_builder_dict.py
to_dict() copies stored parameters before adding MoveIt configuration values. The test checks opt-out results, full-config results, and whether changing the returned dictionary affects the builder’s custom parameter.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: jafarabdi, rhaschke

Merge Risk: Minimal · up to e70ae

to_dict() now returns a copy of the builder's parameters, so generated MoveIt values and edits to the returned dictionary no longer leak into builder state. The change is small and has a regression test, and merge risk is minimal pending the normal CI run.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title says generated MoveIt parameters are kept out of ParameterBuilder state. The change copies self._parameters in MoveItConfigsBuilder.to_dict() before adding MoveIt config values, so the build…
Linked Issues check Passed [#4012] The issue requires to_dict(include_moveit_configs=False) to return only explicitly loaded ParameterBuilder parameters after a full conversion, and requires that mutating the returned top-lev…
Out of Scope Changes check Passed The whole-PR diff against the merge base changes one line in moveit_configs_utils/moveit_configs_utils/moveit_configs_builder.py (copy of self._parameters in to_dict) and adds one regression tes…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title says generated MoveIt parameters are kept out of ParameterBuilder state. The change copies self._parameters in MoveItConfigsBuilder.to_dict() before adding MoveIt config values, so the builder's stored parameters are no longer mutated. The added test checks that generating the full config does not store generated parameters in the builder. The title names the main change and matches the linked issue #4012 and the objectives.

Full details: Linked Issues check

Explanation

[#4012] The issue requires to_dict(include_moveit_configs=False) to return only explicitly loaded ParameterBuilder parameters after a full conversion, and requires that mutating the returned top-level dictionary not change builder state. At head, to_dict() sets parameters = self._parameters.copy() before the include_moveit_configs branch adds generated values through parameters.update(...). The stored _parameters dictionary therefore no longer receives generated MoveIt keys, and top-level mutation of the returned full dictionary does not reach _parameters. The added test test_to_dict_does_not_store_generated_parameters checks the issue's sequence: opt-out returns {"custom": 42} before and after a full conversion, the full dictionary contains custom and robot_description, and mutating full["custom"] leaves builder.to_dict()["custom"] == 42. I did not execute the test. The test source and the one-line code change support the expected behavior. The fix is a shallow copy, so nested dictionaries supplied by the user are not protected. The issue does not require that protection.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base changes one line in moveit_configs_utils/moveit_configs_utils/moveit_configs_builder.py (copy of self._parameters in to_dict) and adds one regression test in moveit_configs_utils/test/test_config_builder_dict.py. Both changes directly implement or verify the objective of #4012. No unrelated changes appear in the reviewed evidence. The PR description's claim of four passing targeted tests was not verified by me; this does not affect the scope verdict.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5399d29 and e70ae1b.

Files selected for processing: 2

  • moveit_configs_utils/moveit_configs_utils/moveit_configs_builder.py
  • moveit_configs_utils/test/test_config_builder_dict.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

@mergify

mergify Bot commented Nov 29, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

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.

MoveItConfigsBuilder.to_dict leaks generated parameters into opt-out calls

1 participant