feat(context): Add view_mode to FileItem model

This commit is contained in:
2026-05-11 10:28:35 -04:00
parent a1343eebe6
commit 8addb97018
2 changed files with 11 additions and 3 deletions
+5 -2
View File
@@ -493,8 +493,9 @@ class TrackState:
@dataclass
class FileItem:
path: str
auto_aggregate: bool = False
auto_aggregate: bool = True
force_full: bool = False
view_mode: str = 'full'
selected: bool = False
ast_signatures: bool = False
ast_definitions: bool = False
@@ -510,6 +511,7 @@ class FileItem:
"path": self.path,
"auto_aggregate": self.auto_aggregate,
"force_full": self.force_full,
"view_mode": self.view_mode,
"ast_signatures": self.ast_signatures,
"ast_definitions": self.ast_definitions,
"ast_mask": self.ast_mask,
@@ -520,12 +522,13 @@ class FileItem:
@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "FileItem":
"""
[C: src/personas.py:PersonaManager.load_all, src/presets.py:PresetManager.load_all, src/project_manager.py:load_project, src/project_manager.py:load_track_state, src/tool_presets.py:ToolPresetManager.load_all_bias_profiles, src/tool_presets.py:ToolPresetManager.load_all_presets, src/workspace_manager.py:WorkspaceManager.load_all_profiles, tests/test_bias_models.py:test_bias_profile_model, tests/test_bias_models.py:test_tool_model, tests/test_bias_models.py:test_tool_preset_extension, tests/test_external_editor.py:TestExternalEditorConfig.test_from_dict_with_dict_editors, tests/test_external_editor.py:TestExternalEditorConfig.test_from_dict_with_string_editors, tests/test_external_editor.py:TestTextEditorConfig.test_from_dict_with_diff_args, tests/test_external_editor.py:TestTextEditorConfig.test_from_dict_without_diff_args, tests/test_file_item_model.py:test_file_item_from_dict, tests/test_file_item_model.py:test_file_item_from_dict_defaults, tests/test_mcp_config.py:test_mcp_configuration_to_from_dict, tests/test_mcp_config.py:test_mcp_server_config_to_from_dict, tests/test_per_ticket_model.py:test_model_override_default_on_deserialize, tests/test_per_ticket_model.py:test_model_override_deserialization, tests/test_persona_id.py:test_ticket_persona_id_deserialization, tests/test_persona_models.py:test_persona_defaults, tests/test_persona_models.py:test_persona_deserialization, tests/test_project_serialization.py:TestProjectSerialization.test_backward_compatibility_strings, tests/test_ticket_queue.py:test_ticket_from_dict_default_priority, tests/test_ticket_queue.py:test_ticket_from_dict_priority, tests/test_tiered_aggregation.py:test_persona_aggregation_strategy, tests/test_track_state_schema.py:test_track_state_from_dict, tests/test_track_state_schema.py:test_track_state_from_dict_empty_and_missing, tests/test_ui_summary_only_removal.py:test_file_item_serialization_with_flags]
[C: src/personas.py:PersonaManager.load_all, src/presets.py:PresetManager.load_all, src/project_manager.py:load_project, src/project_manager.py:load_track_state, src/tool_presets.py:ToolPresetManager.load_all_bias_profiles, src/tool_presets.py:ToolPresetManager.load_all_presets, src/workspace_manager.py:WorkspaceManager.load_all_profiles, tests/test_bias_models.py:test_bias_profile_model, tests/test_bias_models.py:test_tool_model, tests/test_bias_models.py:test_tool_preset_extension, tests/test_external_editor.py:TestExternalEditorConfig.test_from_dict_with_dict_editors, tests/test_external_editor.py:TestExternalEditorConfig.test_from_dict_with_string_editors, tests/test_external_editor.py:TestTextEditorConfig.test_from_dict_with_diff_args, tests/test_external_editor.py:TestTextEditorConfig.test_from_dict_without_diff_args, tests/test_file_item_model.py:test_file_item_from_dict, tests/test_file_item_model.py:test_file_item_from_dict_defaults, tests/test_mcp_config.py:test_mcp_configuration_to_from_dict, tests/test_mcp_config.py:test_mcp_server_config_to_from_dict, tests/test_per_ticket_model.py:test_model_override_default_on_deserialize, tests/test_per_ticket_model.py:test_model_override_deserialization, tests/test_persona_id.py:test_ticket_persona_id_deserialization, tests/test_persona_models.py:test_persona_defaults, tests/test_persona_models.py:test_persona_serialization, tests/test_project_serialization.py:TestProjectSerialization.test_backward_compatibility_strings, tests/test_ticket_queue.py:test_ticket_from_dict_default_priority, tests/test_ticket_queue.py:test_ticket_from_dict_priority, tests/test_tiered_aggregation.py:test_persona_aggregation_strategy, tests/test_track_state_schema.py:test_track_state_from_dict, tests/test_track_state_schema.py:test_track_state_from_dict_empty_and_missing, tests/test_ui_summary_only_removal.py:test_file_item_serialization_with_flags]
"""
return cls(
path=data["path"],
auto_aggregate=data.get("auto_aggregate", True),
force_full=data.get("force_full", False),
view_mode=data.get("view_mode", 'full'),
ast_signatures=data.get("ast_signatures", False),
ast_definitions=data.get("ast_definitions", False),
ast_mask=data.get("ast_mask", {}),
+6 -1
View File
@@ -7,17 +7,19 @@ def test_file_item_fields():
assert item.path == "src/models.py"
assert item.auto_aggregate is True
assert item.force_full is False
assert item.view_mode == "full"
assert item.ast_mask == {}
assert item.custom_slices == []
assert item.injected_at is None
def test_file_item_to_dict():
"""Test that FileItem can be serialized to a dict."""
item = FileItem(path="test.py", auto_aggregate=False, force_full=True)
item = FileItem(path="test.py", auto_aggregate=False, force_full=True, view_mode="summary")
expected = {
"path": "test.py",
"auto_aggregate": False,
"force_full": True,
"view_mode": "summary",
"ast_signatures": False,
"ast_definitions": False,
"ast_mask": {},
@@ -32,12 +34,14 @@ def test_file_item_from_dict():
"path": "test.py",
"auto_aggregate": False,
"force_full": True,
"view_mode": "summary",
"injected_at": 123.456
}
item = FileItem.from_dict(data)
assert item.path == "test.py"
assert item.auto_aggregate is False
assert item.force_full is True
assert item.view_mode == "summary"
assert item.injected_at == 123.456
assert item.ast_mask == {}
@@ -48,6 +52,7 @@ def test_file_item_from_dict_defaults():
assert item.path == "test.py"
assert item.auto_aggregate is True
assert item.force_full is False
assert item.view_mode == "full"
assert item.ast_mask == {}
assert item.custom_slices == []
assert item.injected_at is None