(tree, parent_names=None)
| 172 | try: |
| 173 | module_tree = json.loads(module_tree_path.read_text()) |
| 174 | except (json.JSONDecodeError, OSError): |
| 175 | return |
| 176 | |
| 177 | changed_set = set(changed_files) |
| 178 | modules_to_invalidate = set() |
| 179 | |
| 180 | def _find_affected(tree, parent_names=None): |
| 181 | if parent_names is None: |
| 182 | parent_names = [] |
| 183 | for mod_name, mod_info in tree.items(): |
| 184 | components = mod_info.get("components", []) |
| 185 | # Check if any component path overlaps with changed files |
| 186 | for comp in components: |
| 187 | # Component IDs may be class names, check if they match any changed file path |
| 188 | if any( |
| 189 | changed_file in comp or comp in changed_file for changed_file in changed_set |
| 190 | ): |
| 191 | modules_to_invalidate.add(mod_name) |
| 192 | # Also invalidate parent modules |
| 193 | for parent in parent_names: |
| 194 | modules_to_invalidate.add(parent) |
no test coverage detected