Skip to content

bug(llc/tests): full-suite module pollution replaces sys.modules['llc.api'] — kills all llc.api.* route tests and masks regressions #9995

Description

@mrveiss

Discovered during

#9843 review — the reviewer found that in full-suite order, sys.modules['llc.api'] ends up replaced by a non-package module, so every llc.api.* route test errors at setup with ModuleNotFoundError: No module named 'llc.api.backlog'; 'llc.api' is not a package.

Impact

Likely cause

An earlier test's importlib.util.spec_from_file_location + direct sys.modules insertion — pattern at llc/tests/test_routine.py:268-281 — clobbers the package entry.

Fix direction

Restore sys.modules in a fixture/finally around the isolated-load pattern (save+restore the affected keys), or load under a synthetic module name that doesn't collide with the real package path.

Related: #9843 (PR #9994), umbrella #9923.

Activity

  1. mrveiss commented on Jun 14, 2026

    @mrveiss
    OwnerAuthor

    Partial fix in PR #10139: the named root cause — sys.modules['llc.api'] clobbered to a non-package by test_haiku_tier's __path__-less stub — is fixed, recovering +117 tests (llc/tests 832→949 passed, 36→5 errors). The residual full-suite failures (64) are a deeper layer of the same module-level stub pollution (llc.services/autobot_shared clobbers + test_haiku_tier's own 13 failures) — tracked in #10140 as a focused test-isolation effort.

  2. github-actions commented on Jun 21, 2026

    @github-actions
    Contributor

    PR #10387 (merged to Dev_new_gui) references this issue with a close keyword.

    fix(llc/tests): remove leaking sys.modules stubs masking regressions (#9995, #10140)

    If this issue is fully resolved, close it manually. If work remains, no action is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions