Private
Public Access
0
0

Refactor docstrings to resolve DAG Context with SSDL shape and remove Threading sections

Keeps the ASCII layout map previews, baseline summaries, and state mutation blocks, while cleanly removing Threading & Safety sections and replacing DAG references with SSDL Shape notations.
This commit is contained in:
2026-06-12 21:47:21 -04:00
parent 56e1950b4b
commit b521b4523c
+36 -114
View File
@@ -311,13 +311,8 @@ class App:
self.controller, self.perf_monitor, self.history,
self.show_command_palette, self.workspace_manager.
DAG Render Context:
Called by: main() at startup
Calls: AppController.init_state(), AppController.start_services(),
WorkspaceManager.load_all_profiles()
Threading & Safety:
Must run synchronously on the Main Thread during app startup.
SSDL Shape:
`[I:init_controller] -> [I:init_workspace] -> [I:load_profiles]`
[C: src/mcp_client.py:_DDGParser.__init__, src/mcp_client.py:_TextExtractor.__init__]
"""
@@ -612,12 +607,8 @@ class App:
Initializes the ImGui runner (HelloImGui) and starts the main application loop.
Loads system themes, default styling metrics, fonts, and sets up window docking layouts.
DAG Render Context:
Called by: main()
Calls: hello_imgui.run(), _profiled_setup_style(), _profiled_post_init(), _load_fonts()
Threading & Safety:
Invokes the blocking GUI loop on the Main Thread.
SSDL Shape:
`[I:hello_imgui] -> o-> [I:main_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]
"""
@@ -844,12 +835,8 @@ class App:
State Mutations:
None (read-only state capture).
DAG Render Context:
Called by: _handle_undo(), _handle_redo(), _handle_jump_to_history(), _handle_history_logic()
Calls: None
Threading & Safety:
Must run synchronously on the Main Thread to avoid concurrent collection mutations.
SSDL Shape:
`[Q:ui_state] -> [I:copy] -> [T:snapshot]`
"""
from src import history
import copy
@@ -878,12 +865,8 @@ class App:
Modifies active UI variables (self.ui_ai_input, self.temperature, self.files, self.context_files, etc.)
self._is_applying_snapshot (temporarily set to True)
DAG Render Context:
Called by: _handle_undo(), _handle_redo(), _handle_jump_to_history()
Calls: FileItem.from_dict()
Threading & Safety:
Must run synchronously on the Main Thread. Sets a lock flag during application.
SSDL Shape:
`[I:lock_flag] -> [S:ui_state] -> [I:unlock]`
"""
self._is_applying_snapshot = True
try:
@@ -927,12 +910,8 @@ class App:
State Mutations:
self._ini_capture_ready (set to True on first invocation to bypass initial ImGui frame bugs).
DAG Render Context:
Called by: save_workspace_profile()
Calls: imgui.save_ini_settings_to_memory()
Threading & Safety:
Must run synchronously on the Main Thread. Defer-not-catch pattern prevents uncatchable C-level crashes.
SSDL Shape:
`[Q:ui_states] -> [B:ini_ready] -> [T:profile]`
"""
if not getattr(self, "_ini_capture_ready", False):
self._ini_capture_ready = True
@@ -971,12 +950,8 @@ class App:
State Mutations:
Modifies window visibility and panel configuration state variables.
DAG Render Context:
Called by: load_workspace_profile()
Calls: imgui.load_ini_settings_from_memory()
Threading & Safety:
Must run synchronously on the Main Thread to apply layout constraints safely.
SSDL Shape:
`[I:load_ini] -> [S:ui_states]`
"""
imgui.load_ini_settings_from_memory(profile.ini_content)
self.show_windows.update(profile.show_windows)
@@ -1026,12 +1001,8 @@ class App:
self.history (mutated to record index changes)
Modifies active UI variables via _apply_snapshot()
DAG Render Context:
Called by: _gui_func() (via hotkey Ctrl+Y) or redo button click.
Calls: _take_snapshot(), _apply_snapshot(), HistoryManager.redo()
Threading & Safety:
Must run synchronously on the Main Thread.
SSDL Shape:
`[I:snapshot] -> [B:history] => [I:state]`
"""
sys.stderr.write(f"[DEBUG History] _handle_redo called. can_redo={self.history.can_redo}\n")
sys.stderr.flush()
@@ -1052,12 +1023,8 @@ class App:
State Mutations:
runner_params settings are flushed to disk (imgui.save_ini_settings_to_disk).
DAG Render Context:
Called by: HelloImGui on exit.
Calls: AppController.shutdown()
Threading & Safety:
Executes synchronously on the Main Thread.
SSDL Shape:
`[I:save_ini] -> [I:controller_shutdown]`
[C: tests/conftest.py:app_instance, tests/conftest.py:mock_app]
"""
@@ -1152,10 +1119,8 @@ class App:
self.show_command_palette (toggled via Ctrl+Shift+P)
self._hot_reload_error (updated on Ctrl+Alt+R)
DAG Render Context:
Called by: HelloImGui runner loop on every frame.
Calls: render_main_interface(), render_custom_title_bar(),
_toggle_command_palette(), _trigger_hot_reload()
SSDL Shape:
`o-> [I:hotkeys] -> [I:title_bar] -> [I:main_interface] -> [I:modals]`
ASCII Layout Map:
+---------------------------------------------------------+
@@ -1168,11 +1133,7 @@ class App:
| | | |
| +----------------+ | [AI] | [Exec clutch] |
| | Presets | | Analyzing code... | |
| +----------------+ | | |
+--------------------+-------------------+----------------+
Threading & Safety:
Must run synchronously on the Main Thread.
"""
# One-shot: log when immapp first hands control to our render callback. The
# span init -> here is window/GL/context creation + the font/style/post_init
@@ -1851,12 +1812,8 @@ def render_diagnostics_panel(app: App) -> None:
State Mutations:
Updates app.perf_profiling_enabled and visibility in app.show_windows["Diagnostics"].
DAG Context / Render Flow:
Called by: render_main_interface()
Calls: app.perf_monitor.get_metrics()
Threading & Safety:
Must run synchronously on the Main Thread.
SSDL Shape:
`[I] -> [B:perf_metrics] => [I:detailed_timings]`
"""
if app.perf_profiling_enabled: app.perf_monitor.start_component("_render_diagnostics_panel")
with imscope.window("Diagnostics", app.show_windows.get("Diagnostics", False)) as (exp, opened):
@@ -2360,14 +2317,8 @@ def render_ai_settings_hub(app: App) -> None:
State Mutations:
None directly (delegated to child panels).
DAG Context / Render Flow:
Called by: render_main_interface()
Calls: render_persona_selector_panel(), render_provider_panel(),
render_system_prompts_panel(), render_rag_panel(),
render_agent_tools_panel()
Threading & Safety:
Must run synchronously on the Main Thread.
SSDL Shape:
`[I] -> [B:headers] => [I:sub-panels]`
"""
render_persona_selector_panel(app)
if imgui.collapsing_header("Provider & Model"): render_provider_panel(app)
@@ -2472,12 +2423,8 @@ def render_agent_tools_panel(app: App) -> None:
State Mutations:
Modifies app.ui_active_tool_preset and local UI flags.
DAG Context / Render Flow:
Called by: render_ai_settings_hub()
Calls: app._get_active_capabilities()
Threading & Safety:
Must run synchronously on the Main Thread.
SSDL Shape:
`[Q:caps] -> [B:tool_calling] => [S:preset]`
"""
caps = app._get_active_capabilities()
if not caps.tool_calling:
@@ -3416,10 +3363,8 @@ def render_context_composition_panel(app: App) -> None:
app.context_files (adds/removes file records)
app.screenshots (adds/removes screen image attachments)
DAG Context / Render Flow:
Called by: render_main_interface()
Calls: render_context_batch_actions(), render_context_files_table(),
render_context_presets(), render_context_screenshots()
SSDL Shape:
`[I:stats] -> [I:batch_actions] -> [I:files_table] -> [I:presets] -> [I:screenshots]`
ASCII Layout Preview:
+-------------------------------------------------------------+
@@ -3433,9 +3378,6 @@ def render_context_composition_panel(app: App) -> None:
| > Screenshots |
+-------------------------------------------------------------+
Threading & Safety:
Must run synchronously on the Main Thread.
[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"):
@@ -3460,9 +3402,8 @@ def render_ast_inspector_modal(app: App) -> None:
app.ui_editing_slices_file.ast_mask (mutated on node click)
app.ui_editing_slices_file.custom_slices (mutated on slice modification)
DAG Context / Render Flow:
Called by: render_main_interface() (as popup modal render)
Calls: ts_c_get_code_outline(), py_get_code_outline()
SSDL Shape:
`[B:open_modal?] -> [Q:outline] -> [I:render_ast_tree]`
ASCII Layout Preview:
+-------------------------------------------------------------+
@@ -3478,9 +3419,6 @@ def render_ast_inspector_modal(app: App) -> None:
+--------------------+----------------------------------------+
| [Add selected slices] [Close] |
+-------------------------------------------------------------+
Threading & Safety:
Must run synchronously on the Main Thread.
"""
if getattr(app, 'show_structural_editor_modal', False):
imgui.open_popup('Structural File Editor')
@@ -3739,9 +3677,8 @@ def render_context_files_table(app: App) -> None:
app.context_files[index].view_mode (Def/Sig/Hide)
app.context_files (elements removed via delete action)
DAG Context / Render Flow:
Called by: render_context_composition_panel()
Calls: aggregate.group_files_by_dir()
SSDL Shape:
`[I:group_by_dir] -> o-> [I:dir_node] -> o-> [I:file_row]`
ASCII Layout Preview:
+-------------------------------------------------------------+
@@ -3751,9 +3688,6 @@ def render_context_files_table(app: App) -> None:
| [x] gui_2.py | [Sig v] [Inspect] [X] |
| [x] models.py | [Def v] [Inspect] [X] |
+--------------------------------------+----------------------+
Threading & Safety:
Must run synchronously on the Main Thread.
"""
imgui.dummy(imgui.ImVec2(0, 4))
grouped_files = aggregate.group_files_by_dir(app.context_files)
@@ -4172,9 +4106,8 @@ def render_discussion_entry(app: App, entry: dict, index: int) -> None:
app.disc_entries[index]['read_mode'] (toggled by header button)
app.disc_entries[index]['role'] (changed by combo selection)
DAG Render Context:
Called by: _render_discussion_hub() / render_discussion_hub()
Calls: render_discussion_entry_read_mode(), thinking_parser.parse()
SSDL Shape:
`[I:header] -> [B:collapsed] => [I:preview] | [I:body] -> [I:footer]`
ASCII Layout Preview:
+-------------------------------------------------------------+
@@ -4188,9 +4121,6 @@ def render_discussion_entry(app: App, entry: dict, index: int) -> None:
+-------------------------------------------------------------+
| [Ins] [Del] [Branch] |
+-------------------------------------------------------------+
Threading & Safety:
Must run synchronously on the Main Thread.
"""
with imscope.id(f"disc_{index}"):
role = entry.get("role", "User")
@@ -4286,12 +4216,8 @@ def render_discussion_entry_read_mode(app: App, entry: dict, index: int) -> None
app.text_viewer_title, app.text_viewer_content, app.text_viewer_type (populated on [Source] click)
app.show_windows["Text Viewer"] (set to True on [Source] click)
DAG Render Context:
Called by: render_discussion_entry()
Calls: markdown_helper.render(), mcp_client.read_file()
Threading & Safety:
Must run synchronously on the Main Thread.
SSDL Shape:
`[I:extract_rag] -> [B:definitions?] => [I:markdown]`
"""
with imscope.id(f"read_{index}"):
content = entry["content"]
@@ -4687,18 +4613,14 @@ def render_discussion_entry_controls(app: App) -> None:
app.ui_auto_add_history (toggled via checkbox)
app.ai_status (updated upon saving)
DAG Render Context:
Called by: render_discussion_hub()
Calls: AppController._handle_compress_discussion(), App._flush_to_project()
SSDL Shape:
`[I:buttons] -> [B:clicks] => [S:entries_or_config]`
ASCII Layout Preview:
+-------------------------------------------------------------+
| [+ Entry] [-All] [+All] [Clear All] [Save] [Compress] |
| [x] Auto-add message & response to history |
+-------------------------------------------------------------+
Threading & Safety:
Must run synchronously on the Main Thread.
"""
if imgui.button("+ Entry"): app.disc_entries.append({"role": app.disc_roles[0] if app.disc_roles else "User", "content": "", "collapsed": True, "ts": project_manager.now_ts()})
imgui.same_line()