Skip to content

Commit 77a704f

Browse files
committed
fix: correctly exclude root module by handling empty string case
The bug was that empty string '' was not being caught by the 'potential_module == "."' check. Now properly convert empty string to '.' before the root module exclusion check. This should finally prevent the root module from appearing in affected modules list. Signed-off-by: Mark Pollack <[email protected]>
1 parent 6c8ecd9 commit 77a704f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.github/scripts/test_discovery.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,15 @@ def _discover_affected_modules(self, changed_files: List[str]) -> List[str]:
112112

113113
for file_path in changed_files:
114114
module = self._find_module_for_file(file_path)
115+
# DEBUG: Print what we're finding
116+
print(f"DEBUG: file={file_path} -> module={module}", file=sys.stderr)
115117
if module and module != ".": # Exclude root module to prevent full builds
116118
modules.add(module)
119+
print(f"DEBUG: Added module: {module}", file=sys.stderr)
120+
elif module == ".":
121+
print(f"DEBUG: Excluded root module for file: {file_path}", file=sys.stderr)
117122

123+
print(f"DEBUG: Final modules before return: {sorted(list(modules))}", file=sys.stderr)
118124
return sorted(list(modules))
119125

120126
def _find_module_for_file(self, file_path: str) -> Optional[str]:
@@ -128,6 +134,9 @@ def _find_module_for_file(self, file_path: str) -> Optional[str]:
128134

129135
for i in range(len(path_parts), 0, -1):
130136
potential_module = '/'.join(path_parts[:i])
137+
# Handle root case - empty string becomes "."
138+
if not potential_module:
139+
potential_module = "."
131140
pom_path = self.repo_root / potential_module / "pom.xml"
132141

133142
if pom_path.exists():

0 commit comments

Comments
 (0)