Skip to content

Commit 23fc199

Browse files
committed
fix: construct full paths from file paths for better filtering
Signed-off-by: Pablo Garay <[email protected]>
1 parent fede4d4 commit 23fc199

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

scripts/check_api_backwards_compatibility.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,27 @@ def extract_path_from_explanation(change) -> str:
206206
Format: "filepath:line: object_path: description"
207207
Example: "megatron/core/model_parallel_config.py:338: ModelParallelConfig.cpu_offloading_weights: Attribute value was changed"
208208
209-
Returns the object path or None if not found.
209+
Returns the full object path or None if not found.
210210
"""
211211
try:
212212
explanation = change.explain()
213213
# Split by ": " and get the second part (object path)
214214
parts = explanation.split(': ')
215215
if len(parts) >= 2:
216-
# First part is "filepath:line", second is object path
217-
return parts[1]
216+
short_path = parts[1]
217+
218+
# Try to get the full path from the file path (first part)
219+
file_path = parts[0].split(':')[0] # Get just the file path, remove line number
220+
221+
# Convert file path to module path
222+
# e.g., "megatron/core/model_parallel_config.py" -> "megatron.core.model_parallel_config"
223+
module_path = file_path.replace('/', '.').replace('\\', '.').replace('.py', '')
224+
225+
# Construct full path by combining module and short path
226+
# e.g., "megatron.core.model_parallel_config" + "ModelParallelConfig.cpu_offloading_weights"
227+
full_path = f"{module_path}.{short_path}"
228+
229+
return full_path
218230
except:
219231
pass
220232
return None
@@ -429,6 +441,14 @@ def experimental_feature():
429441
skip_old = False
430442
skip_new = False
431443

444+
# Debug: Check if this is a DistributedDataParallel change
445+
if old_path and 'DistributedDataParallel' in old_path and len(breaking_changes) < 5:
446+
print(f"\n🔍 DEBUG: Breaking change path: {old_path}", file=sys.stderr)
447+
print(f" Checking against {len(all_filtered)} filtered paths", file=sys.stderr)
448+
matching = [f for f in all_filtered if 'DistributedDataParallel' in f]
449+
if matching:
450+
print(f" Found filtered paths with DistributedDataParallel: {matching[:3]}", file=sys.stderr)
451+
432452
if old_path:
433453
# Check exact match or if it's a child (e.g., MyClass.__init__)
434454
if old_path in all_filtered:

0 commit comments

Comments
 (0)