From 065cdc4effe1dcc04bf34622c6ffeed64852a156 Mon Sep 17 00:00:00 2001 From: gti Date: Thu, 24 Sep 2026 11:18:21 -0300 Subject: [PATCH] fix: fdb shadowing scan ignores generated build output (dist/build bundles contain fdb) Co-Authored-By: Claude Sonnet 5 --- src/gti_discovery/provenance.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gti_discovery/provenance.py b/src/gti_discovery/provenance.py index e1e7434..cc51507 100644 --- a/src/gti_discovery/provenance.py +++ b/src/gti_discovery/provenance.py @@ -53,12 +53,19 @@ def _metadata_value(metadata: Any, name: str) -> Any: return None +_BUILD_OUTPUT_DIRS = {"dist", "build", ".pytmp", ".git", "node_modules", "__pycache__", ".venv", "venv"} + + def _project_shadowing() -> list[str]: + """Source-tree files that could shadow the approved fdb driver. Generated output (PyInstaller dist/build + bundles legitimately contain their own fdb package) is not part of the import path and is skipped.""" findings: list[str] = [] try: - for path in PROJECT_ROOT.rglob("*"): - if path.name in {"fdb.py", "fdb"} or path.suffix == ".pth": - findings.append(str(path.resolve(strict=False))) + for root, dirs, files in os.walk(PROJECT_ROOT): + dirs[:] = [d for d in dirs if d not in _BUILD_OUTPUT_DIRS] + for name in dirs + files: + if name in {"fdb.py", "fdb"} or name.endswith(".pth"): + findings.append(str((Path(root) / name).resolve(strict=False))) except OSError: return [""] return sorted(set(findings))