fix(src): update load_context_preset to handle Result from load_all

After migrating ContextPresetManager.load_all to return Result[Dict],
the caller in app_controller.load_context_preset needs to extract
.data from the Result before checking 'name not in presets'.

Updates:
- src/app_controller.py:load_context_preset - check result.ok and
  extract result.data before iterating; raise RuntimeError if
  result.ok is False (consistent with the convention).
- tests/test_context_presets_manager.py:test_manager_load_all -
  extract result.data before assertions.

Tests verified:
- tests/test_context_presets_manager.py (4 tests) PASS
- tests/test_project_switch_persona_preset.py::
  test_load_context_preset_missing_raises_keyerror PASS (KeyError
  raised correctly when preset not found)
- tests/test_phase6_engine.py (3 tests) PASS
This commit is contained in:
ed
2026-06-17 23:15:57 -04:00
parent 294f92386d
commit 052881ec20
3 changed files with 16 additions and 2 deletions
+3 -1
View File
@@ -21,7 +21,9 @@ def project_dict():
def test_manager_load_all(project_dict):
manager = ContextPresetManager()
presets = manager.load_all(project_dict)
result = manager.load_all(project_dict)
assert result.ok, f"load_all failed: {result.errors}"
presets = result.data
assert "test_preset" in presets
assert len(presets["test_preset"].files) == 2
assert presets["test_preset"].files[0].path == "file1.py"