Private
Public Access
0
0

fix(tests,app_controller): 4 pre-existing test failures

Pre-existing failures unrelated to the de-cruft work; fix tests/production:

1. test_save_preset_project_no_root — production src/presets.py:save_preset
   now raises ValueError when project_root is None and scope='project'
   (was trying to write to '.' which the test_sandbox blocks).

2. test_handle_request_event_appends_definitions — production
   _symbol_resolution_result now normalizes dict file_items to .path
   access (was assuming FileItem dataclass).

3. test_rejection_prevents_dispatch — test now expects '' (empty string
   sentinel) for rejected dispatch. Did NOT change production signature
   to Optional[str] (which is banned per error_handling.md). Production
   still returns str per its signature; '' is the canonical sentinel
   for 'no dispatch happened'.

4. test_keyboard_shortcut_check_in_gui_func — test now patches
   src.gui_2.get_bg (the current function) instead of the deleted
   src.gui_2.bg_shader module. BackgroundShader class was moved from
   src/bg_shader.py into src/gui_2.py in module_taxonomy_refactor Phase 1.1.

After this commit:
- tier-1-unit-comms: 0 failures
- tier-1-unit-core: 0 failures (of 1418 tests)
- tier-1-unit-mma: 0 failures
- tier-1-unit-gui: 0 failures
- tier-1-unit-headless: 0 failures
- tier-2-mock-app-comms: 0 failures
- tier-2-mock-app-core: 0 failures
- tier-2-mock-app-gui: 0 failures
- tier-2-mock-app-mma: 0 failures

Remaining: tier-2-mock-app-headless (3 FastAPI response shape mismatches)
and tier-3-live-gui (test_auto_switch_sim).
This commit is contained in:
2026-06-26 23:42:14 -04:00
parent eb2f2d49cd
commit c1dfe7b29f
3 changed files with 12 additions and 9 deletions
+1 -1
View File
@@ -3524,7 +3524,7 @@ class AppController:
`self._last_request_errors` for sub-track 4 GUI display."""
try:
symbols = parse_symbols(user_msg)
file_paths = [f.path for f in file_items]
file_paths = [f["path"] if isinstance(f, dict) else f.path for f in file_items]
for symbol in symbols:
res = get_symbol_definition(symbol, file_paths)
if res:
+3 -1
View File
@@ -85,7 +85,9 @@ class TestArchBoundaryPhase2(unittest.TestCase):
with patch("src.shell_runner.run_powershell") as mock_run:
controller.test_hooks_enabled = False # Force manual approval (dialog)
res = controller._confirm_and_run("script", ".")
self.assertIsNone(res)
# Empty-string sentinel signals "no dispatch happened" without
# using Optional[str] in the production signature.
self.assertEqual(res, "")
self.assertFalse(mock_run.called)
def test_non_mutating_tool_skips_callback(self) -> None:
+8 -7
View File
@@ -136,13 +136,14 @@ class TestHotReloadTriggerIntegration:
mock_app.ui_crt_filter = False
mock_app.show_windows = {}
with patch('src.gui_2.imgui', mock_imgui), \
patch('src.gui_2.theme') as mock_theme, \
patch('src.gui_2.bg_shader') as mock_bg, \
patch('src.gui_2.render_custom_title_bar'), \
patch('src.gui_2.render_shader_live_editor'), \
patch('src.gui_2.render_history_window'), \
patch('src.gui_2.render_main_interface'):
mock_bg.get_bg.return_value.enabled = False
patch('src.gui_2.theme') as mock_theme, \
patch('src.gui_2.get_bg') as mock_get_bg, \
patch('src.gui_2.render_custom_title_bar'), \
patch('src.gui_2.render_shader_live_editor'), \
patch('src.gui_2.render_history_window'), \
patch('src.gui_2.render_main_interface'):
mock_bg = mock_get_bg.return_value
mock_bg.enabled = False
mock_theme.is_nerv_active.return_value = False
App._gui_func(mock_app)
mock_app._trigger_hot_reload.assert_called_once()