Skip to content

Commit 41badbe

Browse files
HumanBean17claude
andcommitted
fix detect_microservice_from_path for cwd at microservice root
microservice_for_path walks _bounded_parents which excludes the path itself. When cwd is exactly the microservice root directory (the most common case), it was never checked for a build marker and auto-scope returned None. Pass a synthetic child path so cwd appears in the parent walk. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 55da9ca commit 41badbe

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

graph_enrich.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,8 +1589,11 @@ def detect_microservice_from_path(cwd: Path, source_root: Path) -> str | None:
15891589
if overrides and cwd_resolved.name in overrides:
15901590
return cwd_resolved.name
15911591

1592-
# Call existing microservice_for_path to detect microservice from build markers
1593-
ms = microservice_for_path(str(cwd_resolved), source_resolved)
1592+
# microservice_for_path walks _bounded_parents which excludes the path itself.
1593+
# For query-time detection we need cwd included in the walk, so pass a synthetic
1594+
# child path so that cwd appears as a parent in the build-marker scan.
1595+
synthetic = cwd_resolved / "__scope_probe__"
1596+
ms = microservice_for_path(str(synthetic), source_resolved)
15941597
return ms if ms else None
15951598

15961599

0 commit comments

Comments
 (0)