From 1578ff28ac317c37c53902c620eb89f97d48bbaf Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 17 Aug 2026 12:14:33 +0000 Subject: [PATCH 1/4] fix(tests): restore orchestrator conftest import after runner archival tests/orchestrator/conftest.py imported run_orchestrator from the project root. The root cleanup in aa41933 moved 18 runner scripts into _archive/old_runners/ without updating their tests, so the import raised ModuleNotFoundError. Because it happens in a conftest, pytest aborted the entire session at collection: `pytest tests/` ran zero tests. Keep the archived location importable instead of retiring the tree - the directory still contains 126 passing tests, including live coverage of mcp_plugins/servers/grpc_host/epic_orchestrator.py, which is not archived. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01GfTCs4rYUGstkDRSTYcBGx --- tests/orchestrator/conftest.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/orchestrator/conftest.py b/tests/orchestrator/conftest.py index 54d30c6..13f7a69 100644 --- a/tests/orchestrator/conftest.py +++ b/tests/orchestrator/conftest.py @@ -10,7 +10,15 @@ import pytest # Add project root to path -sys.path.insert(0, str(Path(__file__).parent.parent.parent)) +_PROJECT_ROOT = Path(__file__).parent.parent.parent +sys.path.insert(0, str(_PROJECT_ROOT)) + +# run_orchestrator.py was moved out of the project root into _archive/old_runners/ +# by the root cleanup in aa41933 ("chore: Clean root, update README, archive old +# scripts"). That commit moved 18 runner scripts but did not update the tests that +# import them, so this conftest - and with it the whole pytest session - failed to +# collect. Keep the archived location importable so these tests keep running. +sys.path.insert(0, str(_PROJECT_ROOT / "_archive" / "old_runners")) from run_orchestrator import OrchestratorConfig, PhaseResult From 09056ba9bad9fdfde42f86d402ec43e8cbebf8d6 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 17 Aug 2026 12:14:48 +0000 Subject: [PATCH 2/4] fix(tests): import src.registry names from their submodules Both files did `from src.registry import DocumentRegistry, ...`, which needs an __init__.py re-export. src/registry/ has none - .gitignore:79 (`_*.py`, intended for temporary root-level debug scripts) matches __init__.py at any depth, so no package initialiser is tracked anywhere under src/. Use the same submodule import form the rest of the repository already uses (src/agents/*.py, src/mind/orchestrator.py). No assertion changed; the two collection errors become 4 executing tests. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01GfTCs4rYUGstkDRSTYcBGx --- tests/test_code_quality_agent.py | 7 +++---- tests/test_document_registry.py | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/test_code_quality_agent.py b/tests/test_code_quality_agent.py index 466a671..417f537 100644 --- a/tests/test_code_quality_agent.py +++ b/tests/test_code_quality_agent.py @@ -16,10 +16,9 @@ # Add src to path sys.path.insert(0, str(Path(__file__).parent)) -from src.registry import ( - DocumentRegistry, - DocumentType, - DocumentStatus, +from src.registry.document_registry import DocumentRegistry +from src.registry.document_types import DocumentType, DocumentStatus +from src.registry.documents import ( QualityReport, TestSpec, TestResults, diff --git a/tests/test_document_registry.py b/tests/test_document_registry.py index 2188e84..e654881 100644 --- a/tests/test_document_registry.py +++ b/tests/test_document_registry.py @@ -18,10 +18,9 @@ # Add src to path sys.path.insert(0, str(Path(__file__).parent)) -from src.registry import ( - DocumentRegistry, - DocumentType, - DocumentStatus, +from src.registry.document_registry import DocumentRegistry +from src.registry.document_types import DocumentType, DocumentStatus +from src.registry.documents import ( DebugReport, ImplementationPlan, TestSpec, From f120ee56f994a1545a2bcf985b52225af89fbb4f Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 17 Aug 2026 12:14:49 +0000 Subject: [PATCH 3/4] fix(tests): mirror EpicOrchestrator.db_sync default in test helpers Both make_orchestrator() helpers build the orchestrator via __new__ with __init__ patched out, then hand-set the attributes the tests need. The real __init__ grew `self.db_sync = None` (epic_orchestrator.py:204) and the helpers were not updated, so _update_task_status() raised AttributeError in 18 tests. Mirror the real default rather than guarding the product code: with None, _update_task_status() skips the live DB write, which is exactly what the real constructor does when DBTaskSync is unavailable. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01GfTCs4rYUGstkDRSTYcBGx --- tests/orchestrator/test_fail_forward_diff.py | 3 +++ tests/orchestrator/test_pipeline_executor.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/tests/orchestrator/test_fail_forward_diff.py b/tests/orchestrator/test_fail_forward_diff.py index 0792e4e..b397acf 100644 --- a/tests/orchestrator/test_fail_forward_diff.py +++ b/tests/orchestrator/test_fail_forward_diff.py @@ -96,6 +96,9 @@ def make_orchestrator(max_parallel: int = 1) -> EpicOrchestrator: orch.task_executor.execute_task = AsyncMock( return_value=TaskExecutionResult(success=True, output="OK", error=None) ) + # See test_pipeline_executor.make_orchestrator: __init__ is bypassed here, so the + # real __init__'s self.db_sync = None default has to be mirrored explicitly. + orch.db_sync = None return orch diff --git a/tests/orchestrator/test_pipeline_executor.py b/tests/orchestrator/test_pipeline_executor.py index f0dd8a9..f8f2799 100644 --- a/tests/orchestrator/test_pipeline_executor.py +++ b/tests/orchestrator/test_pipeline_executor.py @@ -81,6 +81,11 @@ def make_orchestrator(max_parallel: int = 3) -> EpicOrchestrator: orch.task_executor = MagicMock() orch.task_executor.execute_task = AsyncMock(return_value=make_success_result()) orch._convergence_ran_diff = False # Phase 28 + # This helper bypasses __init__, so every attribute the real __init__ sets has to + # be mirrored here. EpicOrchestrator.__init__ sets self.db_sync = None and only + # replaces it when DBTaskSync imports successfully, so None is the faithful + # default: _update_task_status() then skips the live DB write. + orch.db_sync = None return orch From 1c80b0a5e005d559b2ec63eec5148a75a02b9bee Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 17 Aug 2026 12:14:49 +0000 Subject: [PATCH 4/4] fix(tests): stop src/ landing on sys.path and shadowing stdlib secrets These two files were the only ones inserting src/ itself at sys.path[0]. src/secrets.py then shadows the stdlib secrets module for every test that runs later in the same session, so secrets.token_bytes disappeared and tests/agents/test_infrastructure_agent.py (9) and tests/test_system_validation.py (1) failed in a full run while passing in isolation. Switch both to the convention the other 419 test files use: project root on sys.path, import via src.services.*. src/ is the only directory carrying a stdlib-shadowing module name; src/services/ carries none. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01GfTCs4rYUGstkDRSTYcBGx --- tests/test_pipeline_data_bucketer.py | 6 ++++-- tests/test_pipeline_data_sequencer.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_pipeline_data_bucketer.py b/tests/test_pipeline_data_bucketer.py index 7f7ffb6..2b4ce34 100644 --- a/tests/test_pipeline_data_bucketer.py +++ b/tests/test_pipeline_data_bucketer.py @@ -4,9 +4,11 @@ import sys import unittest -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src")) +# Put the project root on sys.path, not src/ itself: src/secrets.py shadows the +# stdlib secrets module for the rest of the pytest session once src/ is on the path. +sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) -from services.pipeline_data_bucketer import PipelineDataBucketer, PipelineDataBucketerState +from src.services.pipeline_data_bucketer import PipelineDataBucketer, PipelineDataBucketerState class TestBasic(unittest.TestCase): diff --git a/tests/test_pipeline_data_sequencer.py b/tests/test_pipeline_data_sequencer.py index 8538180..08ea1c2 100644 --- a/tests/test_pipeline_data_sequencer.py +++ b/tests/test_pipeline_data_sequencer.py @@ -4,9 +4,11 @@ import sys import unittest -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src")) +# Put the project root on sys.path, not src/ itself: src/secrets.py shadows the +# stdlib secrets module for the rest of the pytest session once src/ is on the path. +sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) -from services.pipeline_data_sequencer import PipelineDataSequencer +from src.services.pipeline_data_sequencer import PipelineDataSequencer class TestBasic(unittest.TestCase):