Skip to content

Allow substitutions for ParameterFile allow_substs - #552

Open
Old-Ding wants to merge 2 commits into
ros2:rollingfrom
Old-Ding:codex/parameter-file-allow-substs
Open

Allow substitutions for ParameterFile allow_substs#552
Old-Ding wants to merge 2 commits into
ros2:rollingfrom
Old-Ding:codex/parameter-file-allow-substs

Conversation

@Old-Ding

@Old-Ding Old-Ding commented Jul 11, 2026

Copy link
Copy Markdown

Description

ParameterFile declares and normalizes allow_substs as a boolean or substitution, and the node frontend parses substitution-valued attributes before constructing it. However, its constructor validation only accepted bool, so both Python substitutions and XML/YAML substitution lists raised TypeError.

Accept the existing SomeSubstitutionsType variants in that validation, exercise both node frontends with a runtime expression, and cache the resolved boolean after successful evaluation. Cleanup resets dynamic substitution caches and temporary-file ownership so a reused description evaluates the new context and never treats the original parameter file as a generated temporary file.

Is this user-facing behavior change?

Yes. allow_substs can now be selected by a launch substitution in Python, XML, and YAML as its API already declares, instead of failing while constructing ParameterFile. After evaluation, the allow_substs property reports the resolved boolean; after cleanup, a later context is evaluated again.

Did you use Generative AI?

Yes. OpenAI Codex assisted with root-cause analysis and preparing the focused code and tests. I reviewed the diff and verification results.

Additional Information

Local verification:

  • existing and new ParameterFile tests: 8 passed, including invalid-constructor cleanup
  • dynamic false-to-true and true-to-false reevaluation both preserve the source parameter file
  • direct validation of bool, LaunchConfiguration, frontend-style substitution lists, and invalid objects
  • ament_flake8, ament_copyright, and ament_pep257 for all three changed files
  • Python bytecode compilation
  • git diff --check

The full node frontend test requires a ROS 2 runtime with rclpy, lifecycle_msgs, and demo_nodes_py, which is not installed on this Windows host; repository CI covers that integration test. xmllint was also unavailable locally.

Accept the substitution types already normalized by ParameterFile so XML and YAML frontends can defer allow_substs evaluation until runtime.

Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
@mergify

mergify Bot commented Jul 11, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@Old-Ding
Old-Ding force-pushed the codex/parameter-file-allow-substs branch 2 times, most recently from 1ffda44 to 6146d2b Compare July 12, 2026 18:07
Store the resolved boolean after successful evaluation so the public property reports the effective value.

Reset dynamic substitution caches and temporary-file ownership during cleanup so later contexts are re-evaluated without exposing the source parameter file to deletion.

Initialize cleanup state before validation so rejected arguments cannot trigger a secondary unraisable exception during destruction.

Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
@Old-Ding
Old-Ding force-pushed the codex/parameter-file-allow-substs branch from 6146d2b to 673aa58 Compare July 12, 2026 19:01
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.

1 participant