8f11340b38
Per post_module_taxonomy_de_cruft_20260627 Phase 2 (FR7). Each
'from src.models import X' for a moved class is rewritten to
'from src.<destination> import X':
Ticket, Track, WorkerContext, TrackState, TrackMetadata,
ThinkingSegment, EMPTY_TRACK_STATE -> src.mma
ProjectContext, ProjectMeta, ProjectOutput, ProjectFiles,
ProjectScreenshots, ProjectDiscussion, EMPTY_PROJECT_CONTEXT -> src.project
FileItem, Preset, ContextPreset, ContextFileEntry,
NamedViewPreset -> src.project_files
Tool, ToolPreset -> src.tool_presets
BiasProfile -> src.tool_bias
TextEditorConfig, ExternalEditorConfig,
EMPTY_TEXT_EDITOR_CONFIG -> src.external_editor
Persona -> src.personas
WorkspaceProfile -> src.workspace_manager
MCPServerConfig, MCPConfiguration, VectorStoreConfig,
RAGConfig, load_mcp_config -> src.mcp_client
NOT touched (kept on src.models; Phase 3 or Phase 4 will move them):
GenerateRequest, ConfirmRequest, DEFAULT_TOOL_CATEGORIES, Metadata, PROVIDERS
Migration was performed by the one-time script
scripts/tier2/artifacts/post_module_taxonomy_de_cruft_20260627/migrate_imports.py
which uses a class-to-module map and re.sub() to rewrite each
'from src.models import X' line.
Total: 85 import lines rewritten across 71 files.
Note: this commit depends on the v2 SHIPPED work
(origin/tier2/module_taxonomy_refactor_20260627) being merged into
this branch NEXT. On master (without the v2 SHIPPED commits), the
destination modules do not exist and these imports would fail.
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
import pytest
|
|
from pathlib import Path
|
|
from src.app_controller import AppController
|
|
from src.project_files import FileItem
|
|
|
|
def test_context_files_is_decoupled():
|
|
controller = AppController()
|
|
|
|
# Verify both lists exist and are distinct
|
|
assert hasattr(controller, 'files')
|
|
assert hasattr(controller, 'context_files')
|
|
assert controller.files is not controller.context_files
|
|
|
|
# Modifying one should not affect the other
|
|
controller.files.append(FileItem(path="whitelist.txt"))
|
|
controller.context_files.append(FileItem(path="context.txt"))
|
|
|
|
assert len(controller.files) == 1
|
|
assert controller.files[0].path == "whitelist.txt"
|
|
|
|
assert len(controller.context_files) == 1
|
|
assert controller.context_files[0].path == "context.txt"
|
|
|
|
def test_do_generate_uses_context_files(monkeypatch):
|
|
controller = AppController()
|
|
controller.init_state()
|
|
controller.context_files = [FileItem(path="context.txt")]
|
|
controller.files = [FileItem(path="whitelist.txt")]
|
|
|
|
# Mock project_manager.flat_config and aggregate.run to verify passed data
|
|
import src.project_manager as pm
|
|
import src.aggregate as agg
|
|
|
|
def mock_flat_config(*args, **kwargs):
|
|
return {"files": {}}
|
|
|
|
def mock_aggregate_run(flat, **kwargs):
|
|
assert flat["files"]["paths"] == controller.context_files
|
|
return ("md", Path("path"), [])
|
|
|
|
monkeypatch.setattr(pm, "flat_config", mock_flat_config)
|
|
monkeypatch.setattr(pm, "save_project", lambda *args: None)
|
|
monkeypatch.setattr(agg, "run", mock_aggregate_run)
|
|
monkeypatch.setattr(agg, "build_markdown_no_history", lambda *args, **kwargs: "stable")
|
|
monkeypatch.setattr(agg, "build_discussion_text", lambda *args, **kwargs: "disc")
|
|
|
|
# Should not raise assertion error
|
|
controller._do_generate()
|