From dda7b70747b6b7561c73087881b9ff17b1b311cb Mon Sep 17 00:00:00 2001 From: Wolfvin Date: Sun, 12 Jul 2026 01:29:48 +0700 Subject: [PATCH] fix(search,context): symbol search ModuleNotFoundError + trace always-empty domain bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. search --mode symbol crashed with ModuleNotFoundError: no module named 'symbols_engine'. The function it needs (search_symbols) actually lives in search_engine.py — wrong module name in the import statement. 2. context --check trace always returned 0 callers/callees regardless of symbol or workspace. Root cause: context.py's _build_namespace() set ns.domain = None when --domain wasn't passed, but trace_engine.py checks `domain in ("backend", "auto")` / `("frontend", "auto")` — a bare None matches neither branch, so both trace_via_flat and trace_via_graph silently skipped both backend and frontend tracing every time. Must default to "auto" (matching commands/trace.py's own standalone default). Both found via manual validation against Coretax-Auto-Downloader extension: search --mode symbol crashed outright; trace returned {up:0, dn:0} for signInWithGoogle and isAuthenticated despite both having real callers/callees confirmed via grep. After fix: trace returns 7 callers, 21 callees for signInWithGoogle. --- scripts/commands/context.py | 7 ++++++- scripts/commands/search.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/commands/context.py b/scripts/commands/context.py index 94170cb4..650fa164 100644 --- a/scripts/commands/context.py +++ b/scripts/commands/context.py @@ -136,7 +136,12 @@ def _build_namespace(base_args, check_name: str) -> argparse.Namespace: ns.name = getattr(base_args, "name", None) ns.direction = getattr(base_args, "direction", None) or "up" ns.depth = getattr(base_args, "depth", None) or 10 - ns.domain = getattr(base_args, "domain", None) + # trace_engine.trace_symbol() checks `domain in ("backend", "auto")` + # / `("frontend", "auto")` — a bare None here matches neither branch, + # so every trace silently returned 0 callers/callees regardless of + # symbol or workspace. Must default to "auto" like trace.py's own + # standalone add_args default, not fall through to None. + ns.domain = getattr(base_args, "domain", None) or "auto" ns.limit = getattr(base_args, "limit", None) or 20 ns.offset = getattr(base_args, "offset", 0) ns.max_results = 1000 diff --git a/scripts/commands/search.py b/scripts/commands/search.py index 9b3496cd..b9cce18d 100644 --- a/scripts/commands/search.py +++ b/scripts/commands/search.py @@ -93,7 +93,7 @@ def _run_semantic(args, workspace) -> Dict[str, Any]: def _run_symbol(args, workspace) -> Dict[str, Any]: - from symbols_engine import search_symbols + from search_engine import search_symbols domain = getattr(args, "domain", None) or "all" fuzzy = getattr(args, "fuzzy", False) limit = getattr(args, "limit", None) or 20