feat(sdm): inject structural dependency mapping tags across codebase

Adds [C: caller] tags to functions/methods and [M: mutation] / [U: usage] tags to class variables based on cross-module call analysis.
This commit is contained in:
2026-05-13 22:35:41 -04:00
parent 5bb3a9026f
commit b5e512f483
110 changed files with 1673 additions and 1008 deletions
+67 -22
View File
@@ -101,7 +101,7 @@ class App:
def __init__(self) -> None:
# Initialize controller and delegate state
"""
[C: src/mcp_client.py:_DDGParser.__init__, src/mcp_client.py:_TextExtractor.__init__]
[C: src/mcp_client.py:_DDGParser.__init__, src/mcp_client.py:_TextExtractor.__init__]
"""
# --- Core Dependencies & State ---
self.controller = app_controller.AppController()
@@ -265,8 +265,9 @@ class App:
def run(self) -> None:
"""
Initializes the ImGui runner and starts the main application loop.
[C: simulation/sim_base.py:run_sim, src/mcp_client.py:get_git_diff, src/project_manager.py:get_git_commit, src/project_manager.py:get_git_log, src/rag_engine.py:RAGEngine._search_mcp, src/shell_runner.py:run_powershell, tests/conftest.py:kill_process_tree, tests/conftest.py:live_gui, tests/test_conductor_abort_event.py:test_conductor_abort_event_populated, tests/test_conductor_engine_v2.py:test_conductor_engine_dynamic_parsing_and_execution, tests/test_conductor_engine_v2.py:test_conductor_engine_run_executes_tickets_in_order, tests/test_extended_sims.py:test_ai_settings_sim_live, tests/test_extended_sims.py:test_context_sim_live, tests/test_extended_sims.py:test_execution_sim_live, tests/test_extended_sims.py:test_tools_sim_live, tests/test_external_editor_gui.py:get_vscode_processes, tests/test_external_editor_gui.py:test_vscode_launches_with_diff_view, tests/test_gui_custom_window.py:test_app_window_is_borderless, tests/test_headless_simulation.py:module, tests/test_headless_verification.py:test_headless_verification_error_and_qa_interceptor, tests/test_headless_verification.py:test_headless_verification_full_run, tests/test_mock_gemini_cli.py:run_mock, tests/test_orchestration_logic.py:test_conductor_engine_run, tests/test_parallel_execution.py:test_conductor_engine_pool_integration, tests/test_sim_ai_settings.py:test_ai_settings_simulation_run, tests/test_sim_context.py:test_context_simulation_run, tests/test_sim_execution.py:test_execution_simulation_run, tests/test_sim_tools.py:test_tools_simulation_run]
Initializes the ImGui runner and starts the main application loop.
[C: simulation/sim_base.py:run_sim, src/mcp_client.py:get_git_diff, src/project_manager.py:get_git_commit, src/rag_engine.py:RAGEngine._search_mcp, src/shell_runner.py:run_powershell, tests/conftest.py:kill_process_tree, tests/conftest.py:live_gui, tests/test_conductor_abort_event.py:test_conductor_abort_event_populated, tests/test_conductor_engine_v2.py:test_conductor_engine_dynamic_parsing_and_execution, tests/test_conductor_engine_v2.py:test_conductor_engine_run_executes_tickets_in_order, tests/test_extended_sims.py:test_ai_settings_sim_live, tests/test_extended_sims.py:test_context_sim_live, tests/test_extended_sims.py:test_execution_sim_live, tests/test_extended_sims.py:test_tools_sim_live, tests/test_external_editor_gui.py:get_vscode_processes, tests/test_external_editor_gui.py:test_vscode_launches_with_diff_view, tests/test_gui_custom_window.py:test_app_window_is_borderless, tests/test_headless_simulation.py:module, tests/test_headless_verification.py:test_headless_verification_error_and_qa_interceptor, tests/test_headless_verification.py:test_headless_verification_full_run, tests/test_mock_gemini_cli.py:run_mock, tests/test_orchestration_logic.py:test_conductor_engine_run, tests/test_parallel_execution.py:test_conductor_engine_pool_integration, tests/test_sim_ai_settings.py:test_ai_settings_simulation_run, tests/test_sim_context.py:test_context_simulation_run, tests/test_sim_execution.py:test_execution_simulation_run, tests/test_sim_tools.py:test_tools_simulation_run]
"""
if "--headless" in sys.argv:
print("Headless mode active")
@@ -544,7 +545,8 @@ class App:
def shutdown(self) -> None:
"""
Cleanly shuts down the app's background tasks and saves state.
Cleanly shuts down the app's background tasks and saves state.
[C: tests/conftest.py:app_instance, tests/conftest.py:mock_app]
"""
try:
@@ -556,7 +558,7 @@ class App:
def save_context_preset(self, name: str) -> None:
"""
[C: tests/test_context_presets.py:test_save_context_preset]
[C: tests/test_context_presets.py:test_save_context_preset]
"""
sys.stderr.write(f"[DEBUG] save_context_preset called with: {name}\n")
sys.stderr.flush()
@@ -577,7 +579,7 @@ class App:
def load_context_preset(self, name: str) -> None:
"""
[C: tests/test_context_presets.py:test_load_context_preset, tests/test_context_presets.py:test_load_nonexistent_preset]
[C: tests/test_context_presets.py:test_load_context_preset, tests/test_context_presets.py:test_load_nonexistent_preset]
"""
presets = self.controller.project.get('context_presets', {})
if name in presets:
@@ -588,7 +590,7 @@ class App:
def delete_context_preset(self, name: str) -> None:
"""
[C: tests/test_context_presets.py:test_delete_context_preset, tests/test_context_presets.py:test_delete_nonexistent_preset_no_error]
[C: tests/test_context_presets.py:test_delete_context_preset, tests/test_context_presets.py:test_delete_nonexistent_preset_no_error]
"""
if 'context_presets' in self.controller.project:
self.controller.project['context_presets'].pop(name, None)
@@ -890,7 +892,7 @@ class App:
def _show_menus(self) -> None:
"""
[C: tests/test_gui_window_controls.py:test_gui_window_controls_minimize_maximize_close]
[C: tests/test_gui_window_controls.py:test_gui_window_controls_minimize_maximize_close]
"""
with imscope.menu("manual slop") as (active):
if active and imgui.menu_item("Quit", "Ctrl+Q", False)[0]:
@@ -1026,7 +1028,8 @@ class App:
def _handle_history_logic(self) -> None:
"""
Logic for capturing UI state for undo/redo.
Logic for capturing UI state for undo/redo.
"""
if self._is_applying_snapshot:
return
@@ -1209,7 +1212,7 @@ class App:
def _render_shader_live_editor(self) -> None:
"""
[C: tests/test_shader_live_editor.py:test_shader_live_editor_renders]
[C: tests/test_shader_live_editor.py:test_shader_live_editor_renders]
"""
if self.show_windows.get('Shader Editor', False):
with imscope.window('Shader Editor', self.show_windows['Shader Editor']) as (exp, opened):
@@ -1524,7 +1527,7 @@ class App:
def _render_log_management(self) -> None:
"""
[C: tests/test_log_management_ui.py:test_render_log_management_logic]
[C: tests/test_log_management_ui.py:test_render_log_management_logic]
"""
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_log_management")
with imscope.window("Log Management", self.show_windows["Log Management"]) as (exp, opened):
@@ -1791,7 +1794,7 @@ class App:
def _save_paths(self) -> None:
"""
[C: tests/test_gui_paths.py:test_save_paths]
[C: tests/test_gui_paths.py:test_save_paths]
"""
self.config["paths"] = {
"logs_dir": self.ui_logs_dir,
@@ -2567,6 +2570,9 @@ class App:
#region: Context Management
def _render_files_and_media(self) -> None:
"""
[C: tests/test_gui_fast_render.py:test_render_files_and_media_fast]
"""
avail = imgui.get_content_region_avail().y
if not hasattr(self, 'files_screenshots_split'): self.files_screenshots_split = 0.65
split_y = int(avail * self.files_screenshots_split)
@@ -2787,6 +2793,9 @@ class App:
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_screenshots_panel")
def _render_context_composition_panel(self) -> None:
"""
[C: tests/test_auto_slices.py:test_add_all_triggers_auto_slices, tests/test_gui_fast_render.py:test_render_context_composition_panel_fast]
"""
if imgui.collapsing_header("Context Composition##panel"):
total_lines, total_ast = self._update_context_file_stats()
self._render_context_batch_actions(total_lines, total_ast)
@@ -2799,6 +2808,9 @@ class App:
self._render_context_presets()
def _render_ast_inspector_modal(self) -> None:
"""
[C: tests/test_ast_inspector_extended.py:test_ast_inspector_line_range_parsing]
"""
if self._show_ast_inspector:
imgui.open_popup('AST Inspector')
self._show_ast_inspector = False
@@ -2933,6 +2945,9 @@ class App:
if not opened: self.ui_inspecting_ast_file = None
def _render_add_context_files_modal(self) -> None:
"""
[C: tests/test_auto_slices.py:test_add_selected_triggers_auto_slices]
"""
if imgui.begin_popup_modal("Select Context Files", None, imgui.WindowFlags_.always_auto_resize)[0]:
imgui.text("Select files from project to add to context:")
if imgui.begin_child("ctx_picker_list", imgui.ImVec2(600, 300), True):
@@ -3018,6 +3033,9 @@ class App:
if imgui.button(f"Delete##{name}"): self.delete_context_preset(name)
def _populate_auto_slices(self, f_item: models.FileItem) -> None:
"""
[C: tests/test_auto_slices.py:test_populate_auto_slices_basic]
"""
from src import mcp_client
import re
mcp_client.configure([{"path": f_item.path}])
@@ -3415,7 +3433,7 @@ class App:
def _render_discussion_panel(self) -> None:
"""
[C: tests/test_discussion_takes_gui.py:test_render_discussion_tabs, tests/test_discussion_takes_gui.py:test_switching_discussion_via_tabs, tests/test_gui_discussion_tabs.py:test_discussion_tabs_rendered, tests/test_gui_phase4.py:test_track_discussion_toggle, tests/test_gui_symbol_navigation.py:test_render_discussion_panel_symbol_lookup]
[C: tests/test_discussion_takes_gui.py:test_render_discussion_tabs, tests/test_discussion_takes_gui.py:test_switching_discussion_via_tabs, tests/test_gui_discussion_tabs.py:test_discussion_tabs_rendered, tests/test_gui_fast_render.py:test_render_discussion_panel_fast, tests/test_gui_phase4.py:test_track_discussion_toggle, tests/test_gui_symbol_navigation.py:test_render_discussion_panel_symbol_lookup]
"""
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_discussion_panel")
self._render_thinking_indicator()
@@ -3654,7 +3672,8 @@ class App:
def _render_synthesis_panel(self) -> None:
"""
Renders a panel for synthesizing multiple discussion takes.
Renders a panel for synthesizing multiple discussion takes.
[C: tests/test_gui_synthesis.py:test_render_synthesis_panel]
"""
imgui.text("Select takes to synthesize:")
@@ -4358,7 +4377,7 @@ def hello():
def _reorder_ticket(self, src_idx: int, dst_idx: int) -> None:
"""
[C: tests/test_ticket_queue.py:TestReorder.test_reorder_ticket_invalid, tests/test_ticket_queue.py:TestReorder.test_reorder_ticket_valid]
[C: tests/test_ticket_queue.py:TestReorder.test_reorder_ticket_invalid, tests/test_ticket_queue.py:TestReorder.test_reorder_ticket_valid]
"""
if src_idx == dst_idx: return
new_tickets = list(self.active_tickets)
@@ -4380,7 +4399,7 @@ def hello():
def _render_ticket_queue(self) -> None:
"""
[C: tests/test_gui_kill_button.py:test_render_ticket_queue_table_columns]
[C: tests/test_gui_kill_button.py:test_render_ticket_queue_table_columns]
"""
imgui.text("Ticket Queue Management")
if not self.active_track:
@@ -4678,7 +4697,10 @@ def hello():
imgui.text_colored(imgui.ImVec4(1, 0, 0, 1), f"Error loading beads: {e}")
def _render_mma_dashboard(self) -> None:
"""Main MMA dashboard interface."""
"""
Main MMA dashboard interface.
[C: tests/test_gui_progress.py:test_render_mma_dashboard_progress, tests/test_mma_approval_indicators.py:TestMMAApprovalIndicators.test_approval_badge_shown_when_ask_dialog_pending, tests/test_mma_approval_indicators.py:TestMMAApprovalIndicators.test_approval_badge_shown_when_mma_approval_pending, tests/test_mma_approval_indicators.py:TestMMAApprovalIndicators.test_approval_badge_shown_when_spawn_pending, tests/test_mma_approval_indicators.py:TestMMAApprovalIndicators.test_no_approval_badge_when_idle]
"""
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_mma_dashboard")
self._render_mma_focus_selector()
imgui.separator()
@@ -4708,6 +4730,9 @@ def hello():
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_mma_dashboard")
def _render_mma_focus_selector(self) -> None:
"""
[C: tests/test_gui_progress.py:test_render_mma_dashboard_progress]
"""
imgui.text("Focus Agent:"); imgui.same_line()
focus_label = self.ui_focus_agent or "All"
if imgui.begin_combo("##focus_agent", focus_label, imgui.ComboFlags_.width_fit_preview):
@@ -4795,6 +4820,9 @@ def hello():
imgui.end_popup()
def _render_mma_track_summary(self) -> None:
"""
[C: tests/test_gui_progress.py:test_render_mma_dashboard_progress]
"""
is_nerv = theme.is_nerv_active()
track_name = self.active_track.description if self.active_track else "None"
if getattr(self, "ui_project_execution_mode", "native") == "beads": track_name = "Beads Graph"
@@ -4823,15 +4851,24 @@ def hello():
imgui.text_colored(C_LBL, "ETA:"); imgui.same_line(); imgui.text_colored(C_VAL, f"~{int(eta_mins)}m ({remaining} tickets remaining)")
def _render_mma_epic_planner(self) -> None:
"""
[C: tests/test_gui_progress.py:test_render_mma_dashboard_progress]
"""
imgui.text_colored(C_LBL, 'Epic Planning (Tier 1)')
_, self.ui_epic_input = imgui.input_text_multiline('##epic_input', self.ui_epic_input, imgui.ImVec2(-1, 80))
if imgui.button('Plan Epic (Tier 1)', imgui.ImVec2(-1, 0)): self._cb_plan_epic()
def _render_mma_conductor_setup(self) -> None:
"""
[C: tests/test_gui_progress.py:test_render_mma_dashboard_progress]
"""
if imgui.button("Run Setup Scan"): self._cb_run_conductor_setup()
if self.ui_conductor_setup_summary: imgui.input_text_multiline("##setup_summary", self.ui_conductor_setup_summary, imgui.ImVec2(-1, 120), imgui.InputTextFlags_.read_only)
def _render_mma_track_browser(self) -> None:
"""
[C: tests/test_gui_progress.py:test_render_mma_dashboard_progress]
"""
imgui.text("Track Browser")
if imgui.begin_table("mma_tracks_table", 4, imgui.TableFlags_.borders | imgui.TableFlags_.row_bg | imgui.TableFlags_.resizable):
imgui.table_setup_column("Title"); imgui.table_setup_column("Status"); imgui.table_setup_column("Progress"); imgui.table_setup_column("Actions"); imgui.table_headers_row()
@@ -4858,6 +4895,9 @@ def hello():
self.ui_new_track_name = ""; self.ui_new_track_desc = ""
def _render_mma_global_controls(self) -> None:
"""
[C: tests/test_gui_progress.py:test_render_mma_dashboard_progress]
"""
changed, self.mma_step_mode = imgui.checkbox("Step Mode (HITL)", self.mma_step_mode)
imgui.same_line(); imgui.text(f"Status: {self.mma_status.upper()}")
if self.controller and hasattr(self.controller, 'engine') and self.controller.engine and hasattr(self.controller.engine, '_pause_event'):
@@ -4876,6 +4916,9 @@ def hello():
if imgui.button("Go to Approval"): pass
def _render_mma_usage_section(self) -> None:
"""
[C: tests/test_gui_progress.py:test_render_mma_dashboard_progress]
"""
imgui.text("Tier Usage (Tokens & Cost)")
if imgui.begin_table("mma_usage", 5, imgui.TableFlags_.borders | imgui.TableFlags_.row_bg):
imgui.table_setup_column("Tier"); imgui.table_setup_column("Model"); imgui.table_setup_column("Input"); imgui.table_setup_column("Output"); imgui.table_setup_column("Est. Cost"); imgui.table_headers_row()
@@ -4939,6 +4982,9 @@ def hello():
if imgui.button(f"Delete##{self.ui_selected_ticket_id}"): self.active_tickets = [t for t in self.active_tickets if str(t.get('id', '')) != self.ui_selected_ticket_id]; self.ui_selected_ticket_id = None; self._push_mma_state_update()
def _render_mma_agent_streams(self) -> None:
"""
[C: tests/test_gui_progress.py:test_render_mma_dashboard_progress]
"""
imgui.text("Agent Streams")
if imgui.begin_tab_bar("mma_streams_tabs"):
for tier, label, sep_flag_attr in [("Tier 1", "Tier 1", "ui_separate_tier1"), ("Tier 2", "Tier 2 (Tech Lead)", "ui_separate_tier2"), ("Tier 3", None, "ui_separate_tier3"), ("Tier 4", "Tier 4 (QA)", "ui_separate_tier4")]:
@@ -4957,7 +5003,7 @@ def hello():
def _render_tier_stream_panel(self, tier_key: str, stream_key: str | None) -> None:
"""
[C: tests/test_mma_dashboard_streams.py:TestMMADashboardStreams.test_tier1_renders_stream_content, tests/test_mma_dashboard_streams.py:TestMMADashboardStreams.test_tier3_renders_worker_subheaders]
[C: tests/test_mma_dashboard_streams.py:TestMMADashboardStreams.test_tier1_renders_stream_content, tests/test_mma_dashboard_streams.py:TestMMADashboardStreams.test_tier3_renders_worker_subheaders]
"""
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_tier_stream_panel")
if self.is_viewing_prior_session:
@@ -5066,7 +5112,7 @@ def hello():
def bulk_execute(self) -> None:
"""
[C: tests/test_ticket_queue.py:TestBulkOperations.test_bulk_execute]
[C: tests/test_ticket_queue.py:TestBulkOperations.test_bulk_execute]
"""
for tid in self.ui_selected_tickets:
t = next((t for t in self.active_tickets if str(t.get('id', '')) == tid), None)
@@ -5075,7 +5121,7 @@ def hello():
def bulk_skip(self) -> None:
"""
[C: tests/test_ticket_queue.py:TestBulkOperations.test_bulk_skip]
[C: tests/test_ticket_queue.py:TestBulkOperations.test_bulk_skip]
"""
for tid in self.ui_selected_tickets:
t = next((t for t in self.active_tickets if str(t.get('id', '')) == tid), None)
@@ -5084,7 +5130,7 @@ def hello():
def bulk_block(self) -> None:
"""
[C: tests/test_ticket_queue.py:TestBulkOperations.test_bulk_block]
[C: tests/test_ticket_queue.py:TestBulkOperations.test_bulk_block]
"""
for tid in self.ui_selected_tickets:
t = next((t for t in self.active_tickets if str(t.get('id', '')) == tid), None)
@@ -5145,4 +5191,3 @@ def main() -> None:
if __name__ == "__main__":
main()