One function

_generate_launch_file in dbwls99706/ros2-engineering-skills

The author described this change as fix(scaffolder): use matches_action(node) instead of truthy-on-anything matcher in generated lifecycle launch. It counts as a record because the check below fails on the code as it stood at 636e8e42f and passes on 424b567b0, with nothing else changed between the two runs.

Fix saved2026-05-21
Sharing licenceApache-2.0 · LICENSE
Change size+7 4

What the code was meant to do, written into the code itself as a docstring

Generate a basic bringup.launch.py file for the package.

The change

99 from launch.substitutions import PathJoinSubstitution
1010 from launch_ros.actions import LifecycleNode
1111 from launch_ros.event_handlers import OnStateTransition
12-from launch_ros.events.lifecycle import ChangeState
12+from launch_ros.events.lifecycle import ChangeState, matches_action
1313 from launch_ros.substitutions import FindPackageShare
1414 import lifecycle_msgs.msg
1515
2626 parameters=[config],
2727 output='screen',
2828 )
29- # Auto-configure on launch
29+ # Auto-configure on launch. The matcher MUST target this specific node;
30+ # a truthy-on-anything matcher would fire ChangeState against every
31+ # lifecycle node in the graph (broken in multi-node launches).
32+ # matches_action(node) compares by identity to this node only.
3033 configure_event = EmitEvent(
3134 event=ChangeState(
32- lifecycle_node_matcher=lambda info: info,
35+ lifecycle_node_matcher=matches_action(node),
3336 transition_id=lifecycle_msgs.msg.Transition.TRANSITION_CONFIGURE,
3437 )
3538 )
4144 goal_state='inactive',
4245 entities=[
4346 EmitEvent(event=ChangeState(
44- lifecycle_node_matcher=lambda info: info,
47+ lifecycle_node_matcher=matches_action(node),
4548 transition_id=lifecycle_msgs.msg.Transition.TRANSITION_ACTIVATE,
4649 )),
4750 ],

The check that tells the two apart

failpass·tests/test_create_package.py::TestCppPackage::test_lifecycle_launch_uses_matches_action

Check file tests/test_create_package.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it636e8e42f0e398c57d5732e3deb3892086d45ae8
Broken version dated2026-04-29
Modulescripts.create_package
Units changed_generate_launch_file
Fingerprint3d03129a60b69dae
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in dbwls99706/ros2-engineering-skills