feat(gui): Tier stream panels as separate dockable windows (Tier 1-4)

This commit is contained in:
2026-03-01 15:57:46 -05:00
parent a7903d3a4b
commit 2ce7a87069
3 changed files with 132 additions and 85 deletions

View File

@@ -20,6 +20,10 @@ def _make_app(**kwargs):
app.mma_status = kwargs.get("mma_status", "idle")
app.active_tier = kwargs.get("active_tier", None)
app.mma_step_mode = kwargs.get("mma_step_mode", False)
app._pending_mma_spawn = kwargs.get("_pending_mma_spawn", None)
app._pending_mma_approval = kwargs.get("_pending_mma_approval", None)
app._pending_ask_dialog = kwargs.get("_pending_ask_dialog", False)
app._tier_stream_last_len = {}
return app
@@ -35,46 +39,38 @@ def _make_imgui_mock():
class TestMMADashboardStreams:
def test_all_four_tier_headers_rendered(self):
"""collapsing_header must be called for all four tiers (new behaviour)."""
app = _make_app(mma_streams={
"Tier 1": "strat",
"Tier 2 (Tech Lead)": "lead",
"Tier 3 (Worker): T-001": "work",
"Tier 4 (QA)": "qa",
})
def test_tier1_renders_stream_content(self):
"""_render_tier_stream_panel for Tier 1 must call text_wrapped with the stream content."""
app = _make_app(mma_streams={"Tier 1": "hello"})
imgui_mock = _make_imgui_mock()
with patch("gui_2.imgui", imgui_mock):
App._render_mma_dashboard(app)
header_args = " ".join(str(c) for c in imgui_mock.collapsing_header.call_args_list)
assert "Tier 1" in header_args, "collapsing_header not called with 'Tier 1'"
assert "Tier 2" in header_args, "collapsing_header not called with 'Tier 2'"
assert "Tier 3" in header_args, "collapsing_header not called with 'Tier 3'"
assert "Tier 4" in header_args, "collapsing_header not called with 'Tier 4'"
def test_tier3_aggregates_multiple_worker_streams(self):
"""Tier 3 section must render a sub-header for each worker stream key."""
app = _make_app(mma_streams={
"Tier 3 (Worker): T-001": "output1",
"Tier 3 (Worker): T-002": "output2",
})
imgui_mock = _make_imgui_mock()
imgui_mock.collapsing_header.return_value = True
imgui_mock.begin_child.return_value = True
with patch("gui_2.imgui", imgui_mock):
App._render_mma_dashboard(app)
App._render_tier_stream_panel(app, "Tier 1", "Tier 1")
text_wrapped_args = " ".join(str(c) for c in imgui_mock.text_wrapped.call_args_list)
assert "hello" in text_wrapped_args, "text_wrapped not called with stream content 'hello'"
def test_tier3_renders_worker_subheaders(self):
"""_render_tier_stream_panel for Tier 3 must render a sub-header for each worker stream key."""
app = _make_app(mma_streams={
"Tier 3 (Worker): T-001": "out1",
"Tier 3 (Worker): T-002": "out2",
})
imgui_mock = _make_imgui_mock()
imgui_mock.begin_child.return_value = True
with patch("gui_2.imgui", imgui_mock):
App._render_tier_stream_panel(app, "Tier 3", None)
text_args = " ".join(str(c) for c in imgui_mock.text.call_args_list)
assert "T-001" in text_args, "imgui.text not called with 'T-001' worker sub-header"
assert "T-002" in text_args, "imgui.text not called with 'T-002' worker sub-header"
def test_old_single_strategy_box_removed(self):
"""input_text_multiline must NOT be called with '##mma_strategy' in the new design."""
def test_mma_dashboard_no_longer_has_strategy_box(self):
"""_render_mma_dashboard must NOT call collapsing_header with any 'Tier' string."""
app = _make_app(mma_streams={"Tier 1": "strategy text"})
imgui_mock = _make_imgui_mock()
with patch("gui_2.imgui", imgui_mock):
App._render_mma_dashboard(app)
for c in imgui_mock.input_text_multiline.call_args_list:
first_arg = c.args[0] if c.args else None
assert first_arg != "##mma_strategy", (
"input_text_multiline called with '##mma_strategy' — old single strategy box must be removed"
for c in imgui_mock.collapsing_header.call_args_list:
first_arg = c.args[0] if c.args else ""
assert "Tier" not in str(first_arg), (
f"collapsing_header called with 'Tier' string — tier panels must be separate windows now"
)