feat(R01): architecture foundation, offline fakes and characterization net

EPIC R01 (Team Duy) - safety net before the parallel refactor starts.

R01-T01 docs/architecture/ADR-001-layered-architecture.md
  4-tier boundaries, allowed dependency directions, invariants I1-I6 and
  the strangler-fig migration strategy.
R01-T02 tests/fakes/{fake_provider,fake_tool_executor}.py
  Scripted, offline Provider and extra-tool executor doubles.
R01-T03 scripts/check_imports.py
  AST-based Clean Architecture Guard (CASAN Check 3). Also covers relative
  imports and function-local imports; ASCII-only output for cp932 consoles.
R01-T04 tests/characterization/test_run_cowork.py
  13 snapshot tests pinning run_cowork's current observable contract before
  EPIC R04 moves its orchestration into application/.
R01-T05 docs/architecture/dormant-code.md
  Import-graph scan: 43 unimported modules verified down to 6 genuinely
  dormant items (~1887 LOC); the rest run via subprocess/CLI entry points.

tests/conftest.py binds `cowork_local` to THIS checkout by absolute path -
previously sys.path discovery could import a sibling checkout and the suite
would silently test the wrong code.

Suite: 104 passed, 1.08s (2 pre-existing failures in test_config_security.py
remain - config.py still ships a hardcoded default password, EPIC R02/Team Nam).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-21 10:05:50 +09:00
co-authored by Claude Opus 5
parent d633dffae6
commit bbc09f628a
12 changed files with 1379 additions and 10 deletions
+16
View File
@@ -0,0 +1,16 @@
"""Offline test doubles for the refactoring safety net (R01-T02).
Every double here is deliberately Qt-free, network-free and disk-free so the
unit/contract suites run in well under a second and give the same answer on a
laptop, in CI and on a machine with no API keys configured.
* :class:`~tests.fakes.fake_provider.FakeProvider` - a scripted
``providers.base.Provider`` that streams canned text/tool calls.
* :class:`~tests.fakes.fake_tool_executor.FakeToolExecutor` - a scripted stand-in
for the ``extra_executor`` callable that ``core.chat_agent.run_cowork`` routes
MCP/connector tool calls to.
"""
from .fake_provider import FakeProvider, ScriptedTurn
from .fake_tool_executor import FakeToolExecutor, ToolInvocation
__all__ = ["FakeProvider", "ScriptedTurn", "FakeToolExecutor", "ToolInvocation"]