Skip to content

ImportError on cache-miss path in _process_file_worker — undefined name OpticalDetector #244

Description

@squid-protocol

File: galaxyscope.py
Labels: bug, crash, priority:highDescription
_init_worker imports StructuralExtractor under a local alias:
python# line 113
from gitgalaxy.core.detector import StructuralExtractor as OpticalDetector
This alias only exists inside _init_worker's scope. Later, when a worker encounters a language that wasn't pre-warmed into detector_cache during startup, _process_file_worker tries to import the same name directly from the module:
python# lines 391–394
if lang_id not in detector_cache:
from gitgalaxy.core.detector import OpticalDetector
detector_cache[lang_id] = OpticalDetector(lang_id, lang_defs, parent_logger=logger)
detector.py only defines StructuralExtractor — there is no top-level name OpticalDetector (confirmed: grep -n "OpticalDetector" detector.py returns nothing).Trigger: Any file whose detected language wasn't part of the extension-based warm-up set computed in _init_worker (lines 132–142) — e.g. a language identified by content-based detection rather than by extension.Impact: Raises ImportError, which propagates past the inner try/except TimeoutError and is caught by the outer catch-all at line 546, silently reclassifying a legitimate, parseable file as status: "anomaly" / "Hardware failure: ...". Structural extraction for that file is lost with no indication of the real cause in the output.Fix: Change line 392 to from gitgalaxy.core.detector import StructuralExtractor as OpticalDetector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing enginepriority: highCore feature broken, but workarounds exist

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions