Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix: handle '.' as glob pattern on Python 3.14+ (#609)
John Knowles2dcb33a3db34
diff --git a/packages/core/src/repowise/core/ingestion/resolvers/rust_workspace.py b/packages/core/src/repowise/core/ingestion/resolvers/rust_workspace.pyindex d0419a12d..d15628ee9 100644--- a/packages/core/src/repowise/core/ingestion/resolvers/rust_workspace.py+++ b/packages/core/src/repowise/core/ingestion/resolvers/rust_workspace.py@@ -206,12 +206,18 @@ def _build_cargo_workspace_index(ctx) -> CargoWorkspaceIndex | None:excluded_paths: set[Path] = set()for pattern in exclude_patterns:if isinstance(pattern, str):- excluded_paths.update(p.resolve() for p in repo.glob(pattern))+ if pattern == ".":+ excluded_paths.add(repo)+ else:+ excluded_paths.update(p.resolve() for p in repo.glob(pattern))for member_pattern in members:if not isinstance(member_pattern, str):continue- matched_paths = sorted(repo.glob(member_pattern))+ if member_pattern == ".":+ matched_paths = [repo]+ else:+ matched_paths = sorted(repo.glob(member_pattern))if not matched_paths:# Fallback to literal path for backward compatmatched_paths = [(repo / member_pattern).resolve()]@@ -221,6 +227,8 @@ def _build_cargo_workspace_index(ctx) -> CargoWorkspaceIndex | None:continueif member_path in excluded_paths:continue+ if member_path == repo and root_pkg.get("name"):+ continuetry:member_rel = member_path.relative_to(repo).as_posix()except ValueError:diff --git a/packages/core/src/repowise/core/ingestion/resolvers/ts_workspace.py b/packages/core/src/repowise/core/ingestion/resolvers/ts_workspace.pyindex 0eae9e64b..64ca16754 100644--- a/packages/core/src/repowise/core/ingestion/resolvers/ts_workspace.py+++ b/packages/core/src/repowise/core/ingestion/resolvers/ts_workspace.py@@ -262,9 +262,11 @@ def build_workspace_info(repo_path: Path | None) -> dict[str, dict[str, Any]]:result: dict[str, dict[str, Any]] = {}for pattern in patterns:- # Glob each pattern relative to the repo root. ``pathlib.Path.glob``- # already understands ``*`` and ``**``.- for ws_dir in repo_path.glob(pattern):+ if pattern == ".":+ ws_dirs = [repo_path]+ else:+ ws_dirs = repo_path.glob(pattern)+ for ws_dir in ws_dirs:if not ws_dir.is_dir():continuews_pkg = ws_dir / "package.json"diff --git a/tests/unit/ingestion/test_rust_resolver.py b/tests/unit/ingestion/test_rust_resolver.pyindex 80842b4ec..cbaf4a4c1 100644--- a/tests/unit/ingestion/test_rust_resolver.py+++ b/tests/unit/ingestion/test_rust_resolver.py@@ -101,6 +101,46 @@ class TestCargoWorkspaceGlobExpansion:assert idx.lookup("foo") == "crates/foo/src"assert idx.lookup("ignored") is None+ def test_root_member_dot(self, tmp_path: Path) -> None:+ """members = ["."] should index the root crate without crashing.++ Python 3.14+ rejects ``pathlib.Path.glob(".")`` with+ ``ValueError: Unacceptable pattern``. Cargo workspaces commonly+ declare ``"."`` as a member to include the root crate.+ """+ (tmp_path / "Cargo.toml").write_text(+ '[workspace]\nmembers = [".", "crates/foo"]\n'+ '[package]\nname = "root_crate"\nversion = "0.1.0"\n'+ )+ _write_member_crate(tmp_path, "crates/foo", "foo")+ (tmp_path / "src").mkdir(exist_ok=True)+ (tmp_path / "src" / "lib.rs").write_text("// root crate\n")+ ctx = _ctx(tmp_path, [+ "src/lib.rs",+ "crates/foo/src/lib.rs",+ ])+ idx = get_or_build_cargo_workspace_index(ctx)+ assert idx is not None+ assert idx.lookup("root_crate") == "src"+ assert idx.lookup("foo") == "crates/foo/src"++ def test_exclude_dot(self, tmp_path: Path) -> None:+ """exclude = ["."] should not crash (root pkg still indexed via [package])."""+ (tmp_path / "Cargo.toml").write_text(+ '[workspace]\nmembers = [".", "crates/foo"]\nexclude = ["."]\n'+ '[package]\nname = "root_crate"\nversion = "0.1.0"\n'+ )+ _write_member_crate(tmp_path, "crates/foo", "foo")+ (tmp_path / "src").mkdir(exist_ok=True)+ (tmp_path / "src" / "lib.rs").write_text("// root crate\n")+ ctx = _ctx(tmp_path, [+ "src/lib.rs",+ "crates/foo/src/lib.rs",+ ])+ idx = get_or_build_cargo_workspace_index(ctx)+ assert idx is not None+ assert idx.lookup("foo") == "crates/foo/src"+def test_rust_visibility_levels():from repowise.core.ingestion.extractors.visibility import rust_visibilitydiff --git a/tests/unit/ingestion/test_ts_workspace_index.py b/tests/unit/ingestion/test_ts_workspace_index.pyindex 19ef57ae6..af5fcd3b2 100644--- a/tests/unit/ingestion/test_ts_workspace_index.py+++ b/tests/unit/ingestion/test_ts_workspace_index.py@@ -79,6 +79,22 @@ class TestExportsWildcardEntries:second = get_or_build_ts_index(ctx)assert first is second+ def test_root_workspace_dot(self, tmp_path: Path) -> None:+ """workspaces: ["."] should not crash on Python 3.14+.++ Python 3.14+ rejects pathlib.Path.glob(".") with ValueError.+ Entry-point resolution for the root package is a separate concern.+ """+ _write(+ tmp_path,+ "package.json",+ '{"name":"root","workspaces":["."],"main":"./src/index.ts"}',+ )+ _write(tmp_path, "src/index.ts", "export const x = 1;\n")+ ctx = _ctx(tmp_path, ["src/index.ts"])+ index = build_ts_workspace_index(ctx)+ assert "root" in index.packages+class TestVitestIncludeScanner:def test_runtime_tests_glob_matches(self, tmp_path: Path) -> None: