fix(gui): lock start-only fields on every surface, not just the page - #99
Merged
Merged
Conversation
A field marked start_only in the registry is meant to grey out for as long as a session runs (conventions 7 and 21). That held for the Control page, whose form App._sync_running_ui refreshes, and silently did not hold for a field rendered by a WINDOW: the Settings window owns a separate ControlForm, and nothing re-read the running state for it. So "Capture only the targeted traffic" stayed clickable for the whole session whenever that window was open before START. Opened after a start it came up correctly disabled, because the build path reads is_locked - which is why this never looked broken. Measured on the fake Tk both ways, before and after. - SettingsWindow.refresh() now refreshes its form's field states, so the lock heals on the tick whatever moved the state, not only on start/stop. - App._sync_running_ui() ticks the open windows, so the lock is immediate rather than up to one 700 ms tick late. - The guard now DERIVES its subjects from fields.FIELD_DEFS and resolves each one to the surface that renders it, instead of naming "duration" and the filter combobox by hand. The old shape tested two examples, which is how narrow_filter was added to the registry, shipped unlocked, and kept the suite green. Verified by mutation: removing either half turns it red. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
A field marked
start_onlyinfields.FIELD_DEFSmust grey out for as long as a session runs(conventions 7 and 21). That held for the Control page, whose form
App._sync_running_uirefreshes. It did not hold for a field rendered by a window: the Settings window owns a
separate
ControlForm, and nothing re-read the running state for it.So "Capture only the targeted traffic" (
narrow_filter) stayed clickable for the whole sessionwhenever the Settings window was open before START. Ticking it did nothing until the next session.
Measured on the fake Tk, both orders:
state="normal"- editable all sessiondisabled+ the "locked while running" notedisabled(already correct)disabledThe second row is why this never looked broken: the build path reads
is_locked, so the fieldcame up right whenever the window was opened during a run. Only the already-open window was stale.
The fix
SettingsWindow.refresh()refreshes its form's field states. It is ticked while the window isopen, so the lock now heals whatever moved the state, not only start/stop.
App._sync_running_ui()ticks the open windows, so the lock is immediate instead of up to one700 ms tick late.
The guard is the point
test_start_only_fields_are_locked_while_a_session_runsnameddurationand the filter comboboxby hand, so it tested two examples rather than the rule. That is exactly how
narrow_filterwas added to the registry, shipped unlocked, and kept the suite green.
It now derives its subjects from
FIELD_DEFSand resolves each one to the surface that renders it(
SECTIONS[].surface, withCHOICEbelonging toApprather than to a form), and it opens theSettings window before the session starts, which is the order that was broken. A fourth
start_onlyfield cannot repeat this.Verified by mutation: removing either half of the fix turns the test red.
Testing
python -m pytest testson an elevated shell: 908 passed, exit 0.Two earlier runs each lost one unrelated GUI test to an OS-level fault in the spawned test
subprocess (
_Py_HashRandomization_Initfailure once,MemoryErrorin the prelude once, bothwith empty stdout, both green in isolation). A control run on
masterand a re-run on this branchwere both clean, so that is machine load, not this change.
🤖 Generated with Claude Code