Skip to content

Fast-lane backlog: cli import shadowing (scripts/cli.py shadows cli/ package in CI) #1158

@neuron7xLab

Description

@neuron7xLab

Surfaced by #1153 (fast-gate oracle restore)

When the vacuous python-fast-shard gate was restored to a real oracle (#1153), the only failing cluster across the ~17.6k fast tests was cli_import_shadowing.

Symptom

4 test modules error at collection in CI:

  • tests/unit/cli/test_amm_cli.py (from cli import amm_cli)
  • tests/unit/cli/test_cli_golden.py (from cli.geosync_cli import cli)
  • tests/unit/cli/test_fete_backtest_cli.py (from cli.geosync_cli import cli)
  • tests/unit/test_geosync_cli.py (from cli.geosync_cli import cli)
ImportError: cannot import name 'amm_cli' from 'cli' (/home/runner/work/GeoSync/GeoSync/scripts/cli.py)

Root cause

cli/ (repo root) holds amm_cli.py / geosync_cli.py but is not declared in [tool.setuptools.packages.find] (which DOES declare scripts/scripts.*). The same-named regular module scripts/cli.py (scripts.cli) shadows the cli package under the CI editable install, so top-level cli resolves to scripts/cli.py.

Notably: pytest tests/ --collect-only resolves cli correctly (the ids ARE collected), but the explicit-node-id run step resolves it to scripts/cli.py — invocation-dependent sys.path/rootdir difference. Adding cli/__init__.py alone did NOT fix CI.

Why this is import-architecture (separate PR)

A clean fix is one of: declare cli in packages.find, rename scripts/cli.py, or restructure so cli and scripts.cli cannot collide as top-level cli. All are outside the #1153 CI-oracle boundary.

Interim

These 4 modules are quarantined in tests/ci/fast_quarantine.txt with this issue ref so the fast gate is real-green, not fake-green. Quarantine expiry condition: from cli import amm_cli resolves to cli/amm_cli.py in CI.

Owner lane: ci-import-architecture

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions