Whole file

colcon/colcon-core

The author described this change as Fix a regression in recursive dependency enumeration (#693). It counts as a record because the checks below fail on the code as it stood at 250164b8e and pass on afd1de18a, with nothing else changed between the two runs.

Fix saved2025-07-25
Sharing licenceApache-2.0 · LICENSE
Change size+7 2

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

Fix a regression in recursive dependency enumeration (#693)

The change

88 from pathlib import Path
99
1010 from colcon_core.dependency_descriptor import DependencyDescriptor
11+from colcon_core.feature_flags import is_feature_flag_set
1112
1213
1314 class PackageDescriptor:
114115 :raises AssertionError: if a package lists itself as a dependency
115116 """
116117 if not isinstance(recursive_categories, Mapping):
117- recursive_categories = defaultdict(lambda: recursive_categories)
118+ non_map_categories = recursive_categories
119+ recursive_categories = defaultdict(lambda: non_map_categories)
118120 # the following variable only exists for faster access within the loop
119121 descriptors_by_name = defaultdict(set)
120122 for d in descriptors:
138140 continue
139141 categories = set()
140142 for category in dep.metadata['categories']:
141- cats = recursive_categories.get(category)
143+ if is_feature_flag_set('restore_build_isolation'):
144+ cats = recursive_categories[category]
145+ else:
146+ cats = recursive_categories.get(category)
142147 if cats is None:
143148 categories = None
144149 break

The check that tells the two apart

failpass·test/test_package_descriptor.py::test_get_recursive_dependencies
failpass·test/test_package_descriptor.py::test_get_recursive_dependencies_map

Check file test/test_package_descriptor.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 it250164b8e3a88497deb68d5168a11c5e7707a04f
Broken version dated2025-07-23
Modulecolcon_core.package_descriptor
Units changedPackageDescriptor
Fingerprintbaec56fe355bfaea
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 colcon/colcon-core