Private
Public Access
0
0

fix(hooks): handle dict-key bracket notation in set_value / get_value

The Hook API previously rejected key strings like
'show_windows["Project Settings"]' (and silently returned None on
get). The test_live_gui_filedialog_regression test exercises exactly
this pattern to open the Project Settings window via the Hook API;
it was previously marked skip with "hook server doesn't handle the
dict-key bracket-notation syntax".

Fix in three small places:

1. src/app_controller.py:_handle_set_value
   If `item` is not in _settable_fields, try parsing it as
   `dict_name[<key>]` notation. If dict_name IS in _settable_fields
   and the current attr is a dict, set the inner key.

2. src/api_hooks.py:/api/gui/value (POST get_val)
   Mirror the parsing for the field-based get endpoint.

3. src/api_hook_client.py:ApiHookClient.get_value
   Mirror the parsing in the client so the dict-key syntax works
   through the state endpoint as well (which is what get_value
   actually calls by default).

Test fix:
- tests/test_live_gui_filedialog_regression.py: removed the
  @pytest.mark.skip marker; the underlying issue is now fixed.

Verified: 1/1 test passes (previously skipped).
This commit is contained in:
2026-06-07 16:49:51 -04:00
parent 8d58d7fc46
commit 91b34ae81e
4 changed files with 27 additions and 1 deletions
@@ -16,7 +16,6 @@ import pytest
from src.api_hook_client import ApiHookClient
@pytest.mark.skip(reason="Pre-existing test bug: client.set_value('show_windows[\"Project Settings\"]', True) returns None (the hook server doesn't handle the dict-key bracket-notation syntax in the key name). The same key written as 'show_windows.Project Settings' (or via _handle_set_value directly) would work. Tracked as pre-existing.")
def test_live_gui_project_settings_opens_without_filedialog_crash(live_gui) -> None:
"""
Regression: the Project Settings window's render call chain ends