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.
29 lines
871 B
Python
29 lines
871 B
Python
import pytest
|
|
from src.project_files import FileItem
|
|
from src.fuzzy_anchor import FuzzyAnchor
|
|
|
|
def test_add_slice_with_annotations():
|
|
f_item = FileItem(path="test.py")
|
|
content = "line1\nline2\nline3\nline4\nline5"
|
|
|
|
# Simulate adding a slice from GUI
|
|
s_line, e_line = 2, 4
|
|
slice_data = FuzzyAnchor.create_slice(content, s_line, e_line)
|
|
slice_data['tag'] = "important"
|
|
slice_data['comment'] = "this is a test"
|
|
|
|
f_item.custom_slices.append(slice_data)
|
|
|
|
# Verify it's in the list
|
|
assert len(f_item.custom_slices) == 1
|
|
assert f_item.custom_slices[0]['tag'] == "important"
|
|
assert f_item.custom_slices[0]['comment'] == "this is a test"
|
|
|
|
# Verify serialization
|
|
d = f_item.to_dict()
|
|
assert d['custom_slices'][0]['tag'] == "important"
|
|
|
|
# Verify deserialization
|
|
f_item_2 = FileItem.from_dict(d)
|
|
assert f_item_2.custom_slices[0]['comment'] == "this is a test"
|