Repository navigation
fix(llc/tests): remove leaking sys.modules stubs masking regressions (#9995, #10140) - #10387
Merged
Merged
Conversation
…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)
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
This was referenced Jun 21, 2026
30 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
#9995 / #10140 are about suite-order pollution that masks regressions: three test modules installed module-level
sys.modulesMagicMock stubs (forllc.services/autobot_shared/user_management) and loadedllc.apisubmodules from file. Those global stubs leaked into every test module collected afterward, turning real packages into MagicMocks and failing ~27llc.apiroute/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
spec_from_file_locationloader;_get_agent_hires_mod/_get_budget_modnow do normal imports.llc.servicesstub block (the scheduler circular import it guarded is resolved).spec_from_file_location+sys.modules.setdefaultwith a normalimport llc.api.routines._compute_status/_base_metricsnow passsession_checkpointer_running.HeartbeatScheduler.is_runningchecks_poll_task(not the base_task).202 Accepted+routine_id(was stale201+status).archived).Verification
llc/testssuite: 68 → 41 failures (recovered 27).test_labels+ allllc.apiroute/IDOR tests now pass in suite order.Model Used
Claude Opus 4.8
Closes #9995 · Closes #10140 (part of #9923)