(current_id: int, depth: int = 0)
| 174 | visited: set[int] = set() |
| 175 | |
| 176 | def can_reach(current_id: int, depth: int = 0) -> bool: |
| 177 | # Security: Prevent stack overflow with depth limit |
| 178 | if depth > MAX_DEPENDENCY_DEPTH: |
| 179 | return True # Assume cycle if too deep (fail-safe) |
| 180 | if current_id == source_id: |
| 181 | return True |
| 182 | if current_id in visited: |
| 183 | return False |
| 184 | visited.add(current_id) |
| 185 | |
| 186 | current = feature_map.get(current_id) |
| 187 | if not current: |
| 188 | return False |
| 189 | |
| 190 | deps = current.get("dependencies") or [] |
| 191 | for dep_id in deps: |
| 192 | if can_reach(dep_id, depth + 1): |
| 193 | return True |
| 194 | return False |
| 195 | |
| 196 | return can_reach(target_id) |
| 197 |
no outgoing calls
no test coverage detected