Skip to content

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

Merged
mrveiss merged 3 commits into
Dev_new_guifrom
issue-9995-test-isolation
Jun 21, 2026
Merged

mrveiss merged 3 commits into
Dev_new_guifrom
issue-9995-test-isolation

Conversation

@mrveiss

@mrveiss mrveiss commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Thinking Path

#9995 / #10140 are about suite-order pollution that masks regressions: three test modules installed module-level sys.modules MagicMock stubs (for llc.services / autobot_shared / user_management) and loaded llc.api submodules from file. Those global stubs leaked into every test module collected afterward, turning real packages into MagicMocks and failing ~27 llc.api route/IDOR tests in suite order. I verified all the bypassed modules now import cleanly in the test env, so the hacks are obsolete.

What Changed

  • test_haiku_tier.py — dropped the stub block + spec_from_file_location loader; _get_agent_hires_mod / _get_budget_mod now do normal imports.
  • test_health_probe.py — dropped the llc.services stub block (the scheduler circular import it guarded is resolved).
  • test_routine.py — replaced spec_from_file_location + sys.modules.setdefault with a normal import llc.api.routines.
  • Fixed each module's own drift the stubs had been masking:
    • _compute_status / _base_metrics now pass session_checkpointer_running.
    • HeartbeatScheduler.is_running checks _poll_task (not the base _task).
    • routine trigger asserts 202 Accepted + routine_id (was stale 201 + status).
    • removed a pre-existing F841 (archived).

Verification

  • Full llc/tests suite: 68 → 41 failures (recovered 27).
  • The canary test_labels + all llc.api route/IDOR tests now pass in suite order.
  • Every remaining failure also fails in isolation with an identical count (proven module-by-module) → zero suite-only pollution remains. The 41 residuals are pre-existing functional bugs filed separately (#NEW).
  • flake8 0; the 3 fixed modules + boards/sprints IDOR run together → 78 passed.

Model Used

Claude Opus 4.8

Closes #9995 · Closes #10140 (part of #9923)

mrveiss added 3 commits June 21, 2026 11:46
…9995, #10140)

Three test modules installed module-level sys.modules MagicMock stubs for
llc.services / autobot_shared / user_management (and loaded llc.api submodules
from file) to dodge import chains that no longer exist. Those global stubs
LEAKED into every test module collected afterward — turning real packages into
MagicMocks ('llc.services is not a package') and failing ~27 llc.api route/IDOR
tests in suite order while masking genuine regressions.

All the bypassed modules import cleanly in the current test env, so:
- test_haiku_tier.py: drop the stub block + load-from-file hack → normal imports.
- test_health_probe.py: drop the llc.services stub block (scheduler circular
  import is resolved).
- test_routine.py: replace spec_from_file_location + sys.modules.setdefault with
  a normal import of llc.api.routines.

Also fixed each module's own drift the stubs had been masking:
- _compute_status / _base_metrics now pass session_checkpointer_running.
- HeartbeatScheduler.is_running checks _poll_task (not the base _task).
- routine trigger asserts 202 Accepted + routine_id (was stale 201 + status).
- removed a pre-existing F841 (unused 'archived').

Result: full llc suite 68→41 failures; the canary test_labels + all llc.api
route/IDOR tests now pass in suite order. Every remaining failure also fails in
isolation (pre-existing functional bugs — filed separately), so ZERO suite-only
pollution remains.

Closes #9995 · Closes #10140 (part of #9923)
@github-actions

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant