feat(models): Extend FileItem.custom_slices with tag and comment fields

This commit is contained in:
2026-05-11 17:15:04 -04:00
parent 0416eaeaa8
commit 976879dce0
2 changed files with 69 additions and 0 deletions
+13
View File
@@ -503,6 +503,19 @@ class FileItem:
custom_slices: list[dict] = field(default_factory=list)
injected_at: Optional[float] = None
def __post_init__(self):
if self.custom_slices:
normalized = []
for slc in self.custom_slices:
if isinstance(slc, dict):
new_slc = slc.copy()
if "tag" not in new_slc: new_slc["tag"] = None
if "comment" not in new_slc: new_slc["comment"] = None
normalized.append(new_slc)
else:
normalized.append(slc)
self.custom_slices = normalized
def to_dict(self) -> Dict[str, Any]:
"""
[C: src/personas.py:PersonaManager.save_persona, src/presets.py:PresetManager.save_preset, src/project_manager.py:save_project, src/project_manager.py:save_track_state, src/tool_presets.py:ToolPresetManager.save_bias_profile, src/tool_presets.py:ToolPresetManager.save_preset, src/workspace_manager.py:WorkspaceManager.save_profile, 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_event_serialization.py:test_user_request_event_serialization, tests/test_external_editor.py:TestExternalEditorConfig.test_to_dict, tests/test_external_editor.py:TestTextEditorConfig.test_to_dict, tests/test_file_item_model.py:test_file_item_to_dict, tests/test_gui_events_v2.py:test_user_request_event_payload, 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_serialization, tests/test_persona_id.py:test_ticket_persona_id_serialization, tests/test_persona_models.py:test_persona_defaults, tests/test_persona_models.py:test_persona_serialization, tests/test_thinking_gui.py:test_thinking_segment_model_compatibility, tests/test_ticket_queue.py:test_ticket_to_dict_priority, tests/test_tiered_aggregation.py:test_persona_aggregation_strategy, tests/test_track_state_schema.py:test_track_state_to_dict, tests/test_track_state_schema.py:test_track_state_to_dict_with_none, tests/test_ui_summary_only_removal.py:test_file_item_serialization_with_flags]