Skip to content

Stream 11: Main window, menus, datasets, preferences, help - #574

Merged
suraj-ranganath merged 25 commits into
developfrom
stream11-mainwindow
Nov 11, 2026
Merged

suraj-ranganath merged 25 commits into
developfrom
stream11-mainwindow

Conversation

@suraj-ranganath

@suraj-ranganath suraj-ranganath commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Fixes #556.

Summary

Release-readiness Stream 11: main window, menus, datasets, preferences, help, plus console-history translation of MATLAB colon ranges handed over from Stream 2.

Findings

Finding Fix
F54 / F121 / F30 Menubar retains Qt menu objects across nested dialogs, refreshes, and failed imports
F1 / F95 Select multiple datasets stays visible with one dataset
F2 Most frequent chanlocs.ref, with ties resolved by first in sorted order; unknown only when that value is empty, matching EEGLAB
F3 Epoch start/end use shared %6.3f-style formatting
F4 Dataset size counts recursive Python object memory (not data.nbytes only)
F5 ICLabel submenu and component-activation scroll follow EEGLAB enable rules without ICA
F93 Mixed ICA selection shows mixed, yes and no
F38 Empty selections are rejected before storage so menus stay usable
F42 Append/merge opens Dataset info (pop_newset)
F90 Multiple-dataset processing shows the overwrite warning
F27 / F49 / F94 Session / copy / multi-set history uses runnable EEGLAB forms; console expands [1:32] colon ranges to Python
F29 / F89 Preferences persist supported options and rebuild menus immediately; unsupported backends are disabled and documented
F47 Errors name the function, field, and fix
F64 / F81 Component items check for ICA before opening a dialog
F96 Help windows render markdown instead of raw source
F97 Check for updates uses an in-app modal

Intentional differences from EEGLAB

  • Dataset size uses Python sys.getsizeof recursion rather than MATLAB whos('EEG').
  • Preferences store JSON; controls whose backends are outside this stream (precision switches, remembered folders, ICA cache scaling, startup update checks) are visible but disabled and documented.
  • Empty selection results are rejected before storage (avoids the stuck 0-point GUI state).
  • File > Quit confirms unsaved changes.
  • Run script executes Python; exported history retains MATLAB syntax.
  • Help content, branding, and update checks use EEGPrep resources.

Tests

  • New: tests/test_stream11_*.py (menus, datasets, preferences, help/errors, console colon ranges).
  • Narrow shared assertion updates in related test modules.
  • Local: QT_QPA_PLATFORM=offscreen uv run pytest tests/test_stream11_*.py → 83 passed.

Notes

  • Does not edit methods owned by Streams 5 or 9.
  • Hands-on GUI retest vs pinned EEGLAB and MATLAB reference suite results are on this PR.
  • Do not merge without Suraj's explicit approval.

EEGLAB reference suite (jamming, tip 8a02dd79)

Same shard matrix and pins as Stream 5 (bench_s11_ref.sh / run_s11_ref.sh under flock ~/eegprep-bench/matlab.lock).

  • HEAD 8a02dd79 · EEGLAB d0963be9 · eeglab_tests fec88f9f
  • TOTAL: tests=3908 · passed=3845 · failed=6 · errors=0 · skipped=57
  • Shard exits: heavy 0 · hybrid 1 · stats 0 · study 0 · misc 0 · core 1 · parity 1

Failures (root-caused; none loosened)

Failure Classification
test_bids_preproc (test_crashability_slow, test_end2end) — missing data/ Known on develop
test_average_reference_matches_matlab_on_64_channel_float32 — max_abs=0.109 Known on develop
test_matlab_tutorial_figures_retain_their_plot_target_between_calls — gca parent mismatch Predates PR — isolated re-run under flock+batch engine: FAILED on tip 8a02dd79 and on develop 1bdd1a28 (same pins); also FAILED in concurrent S9 hybrid log
test_user_guide_example_runs[plot_reject_artifacts.py] — missing torch S11 venv setup (bare uv sync); installed torch==2.12.0+cu130 to match S5/S9; re-run → passed
test_icflag_and_subcomp_match_matlab_on_the_same_classification — missing torch Same setup gap; after torch + batch-engine re-run under flock → passed

No Stream 11 production-code regressions found in the suite.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 3m 17s —— View job


Code review

  • Overall assessment: Needs changes. The menu-refresh, dataset-history, ICA-gating and summary changes are correct. Two issues remain: saved preferences load as a side effect of importing a module, and the tests are organized against AGENTS.md.
  • Highest-risk area: Saved preferences in ~/.eegprep/options.json load whenever pop_editoptions.py is imported (pop_editoptions.py:205).
  • Merge recommendation: Needs changes.

Blocking

None.

Important

  1. Saved preferences load whenever pop_editoptions.py is imported, not just when the GUI/console starts. src/eegprep/functions/adminfunc/pop_editoptions.py:205

    • The module calls load_eegprep_options() on import.
    • The GUI and console import it through menu_actions and get the saved values. A script that only calls pop_saveset / eeg_checkset gets the defaults from eeg_options.py.
    • The same script switches to the saved option_storedisk, option_savetwofiles, option_memmapdata and option_boundary99 once it calls pop_editoptions for any option. storage.py and eeg_checkset.py read those options.
    • This contradicts configuration.rst ("loaded on the next GUI/console launch"). AGENTS.md also says to avoid hidden global state.
    • Fix: call load_eegprep_options() explicitly where the GUI and console start, instead of at module level. Fix this →
  2. New test files break AGENTS.md test-organization rules. AGENTS.md says:

    • "Test files generally mirror source module names."
    • "Search existing test files before creating new ones. Extend the closest existing test first."
    • "For features reachable from eegprep-console, add or update tests/test_console_workspace.py coverage."

    This PR instead adds five files named after the project stream (tests/test_stream11_{console,datasets,help_errors,menus,preferences}.py). Test names embed tracker IDs such as test_f27_... and test_f54_f121_f30_..., and docstrings say "Stream 2 handover". Matching test modules already exist: test_console_workspace.py, test_gui_main_window.py, test_pop_newset.py, test_guifunc_pophelp_chansel.py, test_eeg_options.py.

    • Fix: move the tests into those modules, or a test_pop_editoptions.py / test_menu_actions.py that mirrors the source. Rename them by behavior instead of finding ID.

Nits

  • menu_actions.py:1868-1876: _warn changes error messages by searching the exception text for "float", "number", "Channels not found" and "trial range". That can label unrelated pop_editset/pop_resample errors as "invalid numeric metadata", and it breaks quietly if the wording of an exception changes. Raise the specific message where the error happens and keep only the generic action: prefix here. (Inline comment posted.)
  • The PR body says F2 returns unknown "when no majority". The code returns the most frequent chanlocs.ref (ties go to the first in sorted order) and unknown only when that value is empty. This matches eeglab.m's unique_bc + max-count loop, so only the description needs correcting.

Test gaps

  • After you move the load call (Important refactor for packaging and test distribution #1), add a test that importing pop_editoptions with a ~/.eegprep/options.json present leaves EEG_OPTIONS unchanged, and that GUI startup applies the file.

EEGLAB parity notes

None. I compared these against EEGLAB:

  • Dataset-retrieve history ('retrieve', N, 'study', ~isempty(STUDY)+0).
  • pop_copyset history form.
  • pop_newset history with the concrete old set index and 'gui','off'.
  • Most-frequent reference.
  • Multiple-dataset overwrite warning text.

The intentional deviations in the PR body (JSON preferences, Python size estimate, quit confirmation) are documented. The vendored src/eegprep/eeglab/ checkout is not in this CI workspace, so the comparison used upstream EEGLAB semantics.

Also checked: the menubar refresh path (the top-level menu set is fixed, so zip over the existing actions is safe), the needs_ica gating (ERP pop_topoplot:erp/pop_headplot:erp are excluded), and the colon-range translation (applied only to history text in _console_python_command, not to Python typed into the console).

if isinstance(value, bool):
return int(value)
return value
load_eegprep_options()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important: saved preferences load only when this module is imported.

load_eegprep_options() runs when pop_editoptions.py is imported, so whether ~/.eegprep/options.json applies depends on import order:

  • The GUI and console import menu_actions, which imports this module, so they use the saved values.
  • A script that calls pop_saveset / eeg_checkset / eeg_boundarytype and never touches pop_editoptions runs with the defaults from eeg_options.py.
  • The same script behaves differently once it calls eegprep.pop_editoptions(...) for one unrelated option. That import also pulls in the saved option_storedisk, option_savetwofiles, option_memmapdata, and option_boundary99, which storage.py#L804-L814 and eeg_checkset.py#L246 read.

configuration.rst says the file is "loaded on the next GUI/console launch", which does not match this. AGENTS.md also says to avoid hidden global state and to "resolve environment-dependent defaults once".

Suggested fix: drop the module-level call and call load_eegprep_options() explicitly where the GUI and console start. That matches the documented scope, keeps scripts reproducible, and keeps a corrupt JSON file from breaking unrelated imports. Add a test that importing pop_editoptions leaves EEG_OPTIONS unchanged.

Comment on lines +1868 to +1876
action = self.session.active_gui_action().partition(":")[0]
if action and not message.startswith(action):
if action in {"pop_editset", "pop_resample"} and ("float" in message or "number" in message):
message = (
f"{action}: invalid numeric metadata (srate, pnts, nbchan, or xmin). "
"Enter a positive sampling rate (srate) in Hz, whole sample/channel counts, "
f"and an epoch start (xmin) in seconds.\n{message}"
)
elif "Channels not found" in message:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: _warn rewrites messages by searching the exception text for substrings.

_warn is shared by every warning path. Inside pop_editset or pop_resample, any message that contains "number" or "float" gets the prefix "invalid numeric metadata (srate, pnts, nbchan, or xmin)", even when the cause is something else (for example, a message about the number of channels or events). "Channels not found" and "trial range" work the same way, so changing the wording of an exception in a pop function silently changes or breaks the GUI message.

AGENTS.md / the review standard ask for errors that name the function, the field, and the fix. That message belongs where the error is raised.

Suggested fix: raise the specific ValueError text in pop_editset / pop_resample / channel parsing. Keep only the generic f"{action}: {message}" prefix here.

Copy link
Copy Markdown
Member Author

Claude review follow-up

Judged each point against the stream brief and AGENTS.md:

Fixed

  1. Important — prefs load on import (pop_editoptions.py). Valid. Removed the module-level load_eegprep_options() call. GUI (build_main_window) and console (EEGPrepConsoleWorkspace) now call it explicitly at interactive startup, matching configuration.rst. Added a regression test that importing pop_editoptions with a saved options.json leaves EEG_OPTIONS unchanged, and that startup applies the file.
  2. Nit — _warn substring rewriting. Valid. Dropped the float/number/Channels not found/trial range rewriting. _warn now keeps the generic {action}: {message} prefix (plus the existing loadset-style file-read prefix). Specific messages stay where the error is raised.
  3. Nit — F2 PR wording. Valid. Corrected: eegprep returns the most frequent chanlocs.ref (ties: first in sorted order) and unknown only when that value is empty, matching eeglab.m.

Declined

  1. Important — move test_stream11_*.py into mirrored modules. Declined. The release-readiness stream plan (fix_streams.md) requires each stream to add new tests in stream-named files (e.g. tests/test_stream11_*.py), not shared modules. Shared modules only get narrowly scoped assertion updates when an existing expectation conflicts with a finding fix. That matches Streams 2/4/6 practice and avoids cross-stream merge conflicts. Finding IDs in test names are intentional for audit traceability to [Release readiness] Stream 11: Main window, menus, preferences, help #556.

Head after these fixes: c50de58c (tree matches local e5c89680). Retriggering Claude on the new tip.

Copy link
Copy Markdown
Member Author

Hands-on GUI retest (PR #574 / #556)

Retested on box :3 with EEGPREP_REPO=/workspace/eegprep-s11, EEGLAB pinned 8ac485f6 on jamming drawn onto :3. Screenshots under /workspace/gui-parity/screenshots/pr574_*.

Finding Result Key evidence
F2 / F3 / F4 Pass (SBS) Both GUIs: Reference unknown, Epoch start 0.000. Size EEGLAB 4.4 Mb vs eegprep 4.3 Mb (Python getsizeof recursion; documented). pr574_sbs_main_20261107_093503.png
F54 / F121 / F30 Pass Opened Edit dialog then cancelled; top-level File/Edit/Tools/Plot/Study/Datasets/Help all remained. pr574_tools_after_dialog_*.png
F5 Pass Without ICA, Plot > Component activations (scroll) is enabled (matches EEGLAB). pr574_tools_menu_*.png / Plot menu shot
F1 / F95 Pass Datasets menu includes Select multiple datasets with one set loaded (Qt probe + EEGLAB select_multiple_count=1)
F64 / F81 Pass Component scroll without ICA errors before a dialog: pop_eegplot: EEG.icaweights is empty... Run Tools > Decompose data by ICA.... pr574_f64_result_*.png
F89 Pass (Qt) Preferences dialog opens; unsupported backend controls disabled. pr574_qt_preferences.png
Console colon ranges Pass [1:32] → list(range(1, 33, 1)) in _console_python_command
F27 / F49 copyset Pass (jamming) [ALLEEG EEG CURRENTSET] = pop_copyset( ALLEEG, 1, 2); ran OK in pinned EEGLAB

Intentional differences (checked against #556 / EEGLAB)

  • Dataset size — Python recursive memory vs MATLAB whos('EEG') (4.3 vs 4.4 on tutorial set). Documented.
  • Empty selection rejected before storage (F38) — justified. EEGLAB path is poor but recovers; prior eegprep left menus stuck on a 0-point set. Rejecting empty is the correct behavior and is locked with a test.
  • File > Quit confirms unsaved changes — justified. [Release readiness] Stream 11: Main window, menus, preferences, help #556 Quit item requires verifying no silent data loss; confirmation is the right eegprep behavior (audit never ran Quit in EEGLAB).
  • Preferences JSON + disabled unsupported backends; Run script = Python; Help/branding/updates = EEGPrep resources — documented.

GUIs stopped after the session so other streams can use :3. Not merging.

@suraj-ranganath
suraj-ranganath marked this pull request as draft November 7, 2026 17:45
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 7, 2026 17:45
@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 2m 1s —— View job


Code review (re-review at c50de58)

  • Overall assessment: Both earlier findings are fixed. I found no new blocking or important issues, only two nits.
  • Highest-risk area: Where saved preferences are loaded (load_eegprep_options() now runs in the constructors).
  • Merge recommendation: Safe to merge once the human GUI retest and approval are done. The nits below are optional.

Earlier findings: status

  • Prefs loaded on import: fixed. The module-level call is gone. EEGPrepMainWindow.__init__ (main_window.py:64) and EEGPrepConsoleWorkspace.__init__ (console.py:353) now load the file. test_importing_pop_editoptions_does_not_load_saved_preferences and test_interactive_startup_loads_saved_preferences (main_window / eeglab / console) cover this.
  • _warn substring rewriting: fixed. Only the generic {action}: prefix and the file-read prefix for loaders remain.
  • F2 description: corrected.
  • Test file organization: you declined this, citing the stream plan. I accept that and am not raising it again.

Blocking

None.

Important

None.

Nits

  1. Opening a GUI from a running console reloads options.json and discards scripted changes (main_window.py:64, inline comment).
    • Calling pop_editoptions("option_storedisk", 1) in eegprep-console and then gui() runs load_eegprep_options() a second time.
    • If a saved file exists, the scripted value goes back to the saved one without any message. That contradicts configuration.rst: "Scripted changes stay in the current process unless you pass persist=True."
    • Fix: load once, at the interactive launcher entry points, not in the constructors.
  2. The save-history command is rewritten in a shared helper by matching its prefix (menu_actions.py:1764-1769, inline comment).
    • _saveset builds one command string, and _store_current_from_gui then pattern-matches "EEG = pop_saveset(" and rewrites it.
    • Fix: emit the 'filename', …, 'filepath', … form directly in _saveset and delete the rewrite block.

Test gaps

None beyond the scripted-change case in Nit 1.

EEGLAB parity notes

None. I checked:

  • The retrieve/select history ('study', ~isempty(STUDY)+0 with the concrete previous set).
  • The pop_newset history ('gui','off', overwrite omitted when off).
  • eeg_store(ALLEEG, EEG, 0) after a new dataset.
  • The Study menu still being disabled for multi-dataset selections. The removed special case is covered by menu_enabled's tag == "study" rule.
  • Quit's unsaved check. pop_loadset's justloaded becomes saved = "yes" in eeg_store, so freshly loaded sets do not prompt.
  • Zero-basing of colon ranges for channel arguments, including negative steps.
  • needs_ica gating against every :components / :ica menu action.

native_file_dialogs: bool | None = None,
) -> None:
qt_core, qt_gui, qt_widgets = _require_qt()
load_eegprep_options()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: opening a GUI from a running console reloads options.json and discards scripted option changes.

The load now happens in the constructors of both EEGPrepMainWindow and EEGPrepConsoleWorkspace. Opening a window inside an existing process runs the load again. For example, in eegprep-console:

pop_editoptions("option_storedisk", 1)   # process-local, persist=False
gui()                                     # EEGPrepMainWindow.__init__ -> load_eegprep_options()

If ~/.eegprep/options.json exists (it does once Preferences has been saved through the GUI), option_storedisk silently goes back to the saved value. This contradicts configuration.rst: "Scripted changes stay in the current process unless you pass persist=True."

Suggested fix: load once per interactive launch. Call load_eegprep_options() from the eegprep-console / GUI launcher entry points (or from eeglab()/gui() only when they create a new session), not from the constructors. Extend test_interactive_startup_loads_saved_preferences with a case where a scripted change made before gui() on an existing session survives.

Comment on lines +1764 to +1769
if command and command.startswith("EEG = pop_saveset(") and "'savemode'" not in command:
command = (
f"EEG = pop_saveset(EEG, 'filename', {format_history_value(eeg['filename'])}, "
f"'filepath', {format_history_value(eeg['filepath'])});"
)
kwargs["command"] = command

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the save-history command is fixed up after the fact by matching the string prefix.

_saveset builds f"EEG = pop_saveset(EEG, {written[0]!r});" (menu_actions.py#L614-L619). The shared _store_current_from_gui helper then detects the "EEG = pop_saveset(" prefix and rewrites the command. This has the same problem as the _warn substring rewriting that was removed:

  • Every store path is coupled to the exact text of one caller's command.
  • It reads eeg['filename'] from whatever eeg is passed in, which would fail if a list ever reaches this branch.

Suggested fix: emit the final form in _saveset and delete the rewrite block here:

else (
    f"EEG = pop_saveset(EEG, 'filename', {format_history_value(datasets[0]['filename'])}, "
    f"'filepath', {format_history_value(datasets[0]['filepath'])});"
)

Copy link
Copy Markdown
Member Author

Claude re-review follow-up (nits)

Claude's re-review at c50de58 was safe to merge with two optional nits. Handled as follows:

  1. Nit — GUI from console reloads options.json over scripted changes. Valid. Moved load_eegprep_options() out of constructors into the interactive launchers (eeglab() / eegprep-gui and run_console / eegprep-console). Opening a second window or gui() from an already-running console no longer reloads the file over in-process scripted options. Tests cover import / launcher / live-console cases. Pushed on tip 6d863a02 (+ docs follow-up).

  2. Nit — rewrite pop_saveset history inside _saveset. Declined. _saveset is owned by Stream 1 (fix_streams.md). The 'filename'/'filepath' form for F27 is applied in S11's _store_current_from_gui helper so we do not edit S1's method in this PR. Leaving that rewrite in place is intentional ownership hygiene, not a latent bug in the history string users see.

Not merging.

@suraj-ranganath
suraj-ranganath marked this pull request as draft November 7, 2026 17:53
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 7, 2026 17:54
@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 43s —— View job


Code review (re-review at 700735d)

  • Overall assessment: Looks good. The last open nit is fixed and the new commits don't introduce any issues.
  • Highest-risk area: The console's gui() / eeglab() now open on the console's existing session (console.py _SESSION_LAUNCHERS).
  • Merge recommendation: Safe to merge once a human approves.

Earlier findings: status

  • Opening a GUI from the console reloaded options.json: fixed.
    • The constructors no longer call load_eegprep_options().
    • It now runs once in run_console (console.py:686), and in eeglab() only when no session is passed in (eeglab.py:53-54). gui() and eegprep-gui reach it through eeglab().
    • In the console, gui, eeglab, eegprep.gui, eegprep.eeglab and from eegprep import gui as x are all bound with partial(..., session=self.session). Opening a window from the console therefore keeps scripted persist=False changes.
    • test_console_gui_commands_preserve_scripted_options covers all five spellings. It checks that the in-process value survives, the file is unchanged, and the new window uses the same session.
  • pop_saveset history rewrite in _store_current_from_gui: you declined this because the method belongs to another stream. I'm not raising it again.
  • Test file organization: declined earlier with a reason; not raised again.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None.

EEGLAB parity notes

None. There is one behavior change from the previous code: gui() in eegprep-console used to start a separate, unsynchronized session and now opens a second window on the shared one. This matches the AGENTS.md rule that the GUI and console share one EEGPrepSession. EEGPrepSession._listeners already supports more than one window, and gui_console_session.rst documents the change.

I also checked:

  • eeglab("nogui") without a session still skips loading preferences, so headless scripts keep the defaults.
  • An explicit session= passed to the console partials still overrides the bound one.
  • The docs (configuration.rst, the changelog, gui_console_session.rst) match the new behavior.

I couldn't run the tests myself because this job's tool permissions don't allow pytest. I reviewed the new tests by reading them only.

Copy link
Copy Markdown
Member Author

CI follow-up

Tests were red on the previous tip. Fixed and pushed:

  1. copyset history assertion — shared test now expects the EEGLAB form without LASTCOM (F49).
  2. BrainVision import LASTCOM — assertion checks ALLCOM for the import command; LASTCOM correctly ends on eeg_store after commit.
  3. ICA gating — data_to_ica / ica_to_data mark transfers are no longer blocked by the F64/F81 ICA precondition (those findings cover component remove/inspect/plots). Stream6 export/reject tests pass again.
  4. Component action tests — phase4 fixtures now include ICA where the action is a component plot.
  5. Console prefs startup — hardened against a missing/closed stream (flush on None).

Local: previously failing tests + tests/test_stream11_*.py → all green. Waiting on CI for the new tip. Not merging.

The GUI rewrite emits MATLAB-style quoted paths (literal backslashes),
not Python repr(). Matching with !r broke three MenuActionDispatcher
tests on windows-latest.

Copy link
Copy Markdown
Member Author

@claude review

Re-review after tip e3edac0f (tree matches local 7e228ad6): Windows CI fix for saveset history asserts — use format_history_value instead of !r so MATLAB-style path literals match on windows-latest. No production code change.

@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 51s —— View job


Code review (re-review at e3edac0f)

  • Overall assessment: The Windows fix is correct, but it will fail CI's format check. All three new assertIn lines are longer than the 120-character limit, so ruff format --check will flag them. The rest of the code added since my last review (700735d) looks fine.
  • Highest-risk area: Formatting in tests/test_gui_main_window.py. Nothing else in this range affects behavior in a risky way.
  • Merge recommendation: Safe to merge after the formatting fix and a human's approval.

What changed since 700735d

e3edac0f changes tests only, as you said. The three CI-fix commits before it (33c2db0c, ed3cf01e, cc4db176) do change production code, so I reviewed them too:

  • ICA check for moving rejection marks (menu_actions.py:301): data_to_ica and ica_to_data no longer require ICA. Correct: _run_rejsuperpose only copies EEG.reject fields. Component plots and processing still require ICA, and the new pop_newcrossf:components, pop_eegplot:reject_ica and pop_rejepoch:ica cases cover that.
  • Console logging (console.py:1306, 1329-1339): handlers whose stream is missing (FileHandler(delay=True)) or closed are now skipped instead of wrapped, and flush() ignores a missing stream. Correct. The new startup test checks that both kinds of handler are left untouched.
  • Preferences dialog (pop_editoptions.py:144-186): the file path now also appears as a tooltip, and the dialog uses weighted_columns=True, which DialogSpec and qt.py already support. A long path no longer pushes controls off screen, and the parametrized test covers that.
  • macOS title check in the F90 test: OK. Qt ignores QMessageBox.setWindowTitle on macOS, so the empty title expected there is correct.
  • format_history_value in the save-history asserts (e3edac0f): correct. The assertions now build the expected string with the same helper as the code under test, so they no longer assume Python's repr quoting. That is what failed on Windows paths.

Blocking

None.

Important

None.

Nits

  1. The new lines in tests/test_gui_main_window.py fail ruff format --check (:601, :626, :722).
    • These lines are 150–170 characters long; pyproject.toml sets line-length = 120. The old !r versions fit within the limit.
    • CI runs uv run --no-sync ruff format --check ., and the formatter will want to split each assertIn(...) call.
    • Fix: run ./pre-commit.py --changed-from origin/develop --fix (or uv run ruff format tests/test_gui_main_window.py) and commit the result.
    • Fix this →

Test gaps

None.

EEGLAB parity notes

None. In EEGLAB, eeg_rejsuperpose moves rejection marks without checking for ICA weights, so removing that check here matches it.

Earlier findings

Every earlier finding is still either fixed or declined with a reason, and none has come back. I'm not raising the declined test-file layout or the _saveset history rewrite again.

I couldn't run any checks in this job, including pytest, ruff and awk, because its tool permissions require approval for them. I found the long lines with a regex search for lines over 120 characters.

Copy link
Copy Markdown
Member Author

@claude review

Re-review after tip 26bb2a21 (tree matches local 1b0dcfad): same Windows saveset-history assert fix as e3edac0f, plus ruff format on tests/test_gui_main_window.py so the Ruff format check passes. Still no production code change.

@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 18s —— View job


Code review (re-review at 26bb2a21)

  • Overall assessment: Looks good. The only change since e3edac0f is 26bb2a21, and it is formatting-only. As you said, no production code changed.
  • Highest-risk area: None in this range.
  • Merge recommendation: Safe to merge once a human approves.

What changed since e3edac0f

tests/test_gui_main_window.py (+12/−3): the three assertIn(...) calls at :601, :629 and :728 are now split across lines, with the string and session.LASTCOM on separate lines. The assertions themselves are unchanged and still build the expected history with format_history_value.

On line length:

  • Each f-string line is still about 125 characters. ruff format never splits string literals, so this is the formatter's stable output and ruff format --check passes.
  • The lint config (select = ["E4", "E7", "E9", "F"]) doesn't enable E501, so ruff check won't flag the length either.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None.

EEGLAB parity notes

None. This range changes only tests.

Earlier findings

Nothing has changed since my last review: every earlier finding is either fixed or was declined with a reason.

I couldn't run ruff or pytest here. uv run --no-sync ruff isn't installed in this job, and uvx needs tool approval, so I checked the formatting by reading the diff and the pyproject.toml ruff settings. Please confirm with the CI Ruff format job.

Copy link
Copy Markdown
Member Author

Hands-on GUI retest (completed) — tip 26bb2a21

Additional Qt offscreen probes on box :3 from /workspace/eegprep-s11 (same tree as remote). Screenshots under /workspace/gui-parity/screenshots/pr574_*.

Finding Result Evidence
F1 Pass Select multiple enabled with one dataset
F2 / F3 / F4 Pass (earlier SBS) Ref unknown, epoch 0.000; size EEGLAB 4.4 vs eegprep 4.3 Mb (Python getsizeof; intentional) — pr574_sbs_main_20261107_093503.png
F38 Pass Out-of-range pop_select yields empty data; _commit_processed_dataset_from_gui raises before store; menubar File…Help unchanged; dataset kept
F42 Pass Append/merge opens Merge dialog; after merge, Dataset info (pop_newset) — pr574_qt_f42_1.png, pr574_qt_f42_flow_1.png
F54 / F121 / F30 Pass (earlier) Menus retained across dialog cancel
F90 Pass Multi selection → Tools > Change sampling rate shows “Multiple dataset warning” with Proceed/Cancel (matches eeg_eval.m) — pr574_qt_f90_1.png
F96 Pass Help uses QTextBrowser rendered HTML, not raw markdown — pr574_qt_f96_rendered.png
F97 Pass In-app “latest version of EEGPrep (0.5.0)” modal — pr574_qt_f97_updates.png
Quit confirm Pass (intentional ≠ EEGLAB) File > Quit with unsaved → “Quit EEGPrep” Discard/Cancel — pr574_qt_quit_confirm.png. EEGLAB cb_quit is close-only

Intentional differences checked against EEGLAB 8ac485f6

  • Size 4.3 vs 4.4 Mb: EEGLAB whos('EEG'); eegprep recursive sys.getsizeof.
  • Empty-result reject (F38): EEGLAB can correct/clamp time limits or leave an empty selection; eegprep rejects before storage so menus stay usable (eeglab_migration.rst).
  • Quit confirm: EEGLAB File > Quit = close(gcf) only; eegprep confirms unsaved (audit [Release readiness] Stream 11: Main window, menus, preferences, help #556).
  • JSON prefs / disabled unsupported controls / EEGPrep help & branding / Python run-script: documented in PR body + configuration.rst.

Not merged.

Build the runnable EEGLAB history form at the call site instead of
rewriting command strings in _store_current_from_gui by prefix match.

Copy link
Copy Markdown
Member Author

Claude nit: _saveset history rewrite — fixed

Re-read against the tip after Stream 1 closed. Ownership was the wrong reason to decline: the nit is real.

_saveset was emitting EEG = pop_saveset(EEG, <path!r>);, then _store_current_from_gui rewrote any command starting with EEG = pop_saveset( (except 'savemode') by reading eeg['filename'] / eeg['filepath']. That couples every store path to one caller’s string shape and would break if a list selection ever hit the rewrite.

Fix (now on the branch): _saveset emits the runnable EEGLAB form directly:

EEG = pop_saveset(EEG, 'filename', …, 'filepath', …);

and the prefix-match rewrite in _store_current_from_gui is removed. Tests test_f27_save_history_separates_filename_and_filepath and the three MenuActionDispatcher save-history cases still pass.

Copy link
Copy Markdown
Member Author

@claude review

Re-review after tip that emits pop_saveset filename/filepath history in _saveset and removes the _store_current_from_gui prefix rewrite (addresses your earlier nit). Tree should match the push that follows the Windows assert/ruff format tip.

@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 28s —— View job


Code review (re-review at 80c18012)

  • Overall assessment: Looks good. 80c18012 fixes the last open nit, and I found no new problems.
  • Highest-risk area: Save history in _saveset (menu_actions.py:614-624).
  • Merge recommendation: Safe to merge once a human approves.

What changed since 26bb2a21

80c18012 changes only src/eegprep/functions/guifunc/menu_actions.py (+10/−11):

  • _saveset now writes the final history string. It emits EEG = pop_saveset(EEG, 'filename', …, 'filepath', …); directly, using datasets[0]['filename'] / ['filepath'].
    • These values are current when the string is built: _apply_save_metadata sets them from the file actually written (lines 609-611), just before line 619.
    • Single-dataset history is exactly the same string the old rewrite produced, so the existing format_history_value assertions in test_gui_main_window.py should still match.
  • The prefix-match rewrite in _store_current_from_gui is gone. The helper now passes command through unchanged.
    • This also removes a hidden failure: the old rewrite read eeg['filename'] from whatever it was given, so it would have raised TypeError if a list selection ever reached it. The new code reads from datasets[0], which is always a dict.
  • format_history_value is still imported and is now used here, so no import became unused.
  • The resave path ('savemode', 'resave') is unchanged.

Blocking

None.

Important

None.

Nits

  1. The new comment at menu_actions.py:617-618 describes code that no longer exists ("not via a later string rewrite in _store_current_from_gui"). AGENTS.md allows comments only for non-obvious intent or EEGLAB parity. Something like # EEGLAB history form: separate 'filename' and 'filepath' (F27). would keep the parity note without mentioning the old approach. Optional.

Test gaps

None. test_f27_save_history_separates_filename_and_filepath and the three MenuActionDispatcher save-history tests cover this path.

EEGLAB parity notes

None. pop_saveset.m writes its history as EEG = pop_saveset( EEG, 'filename', …, 'filepath', …);, and the new string matches that.

Earlier findings

  • _saveset history rewrite: fixed in this commit.
  • Everything else: fixed or declined with a reason earlier, and nothing has come back.

I couldn't run pytest in this job because its tool permissions need approval for it, so I checked these changes by reading the code only. Please confirm with CI.

Copy link
Copy Markdown
Member Author

@claude review

Tip 8a02dd79: comment-only follow-up to your optional nit on the _saveset history form (parity note, no mention of the removed rewrite). No behavior change.

@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 13s —— View job


Code review (re-review at 8a02dd79)

  • Overall assessment: Looks good. 8a02dd79 changes only the comment, as you said.
  • Highest-risk area: None in this range.
  • Merge recommendation: Safe to merge once a human approves, along with the pre-merge MATLAB reference-suite run that AGENTS.md requires for PRs that change core functions.

What changed since 80c18012

src/eegprep/functions/guifunc/menu_actions.py:617 (+1/−2): the two-line comment that mentioned the removed rewrite in _store_current_from_gui is now one line:

# EEGLAB history form: separate 'filename' and 'filepath' (F27).

The comment now only gives the EEGLAB parity reason and doesn't describe code that no longer exists, which is what AGENTS.md asks for. The code and the history string are the same as before.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None. Only the comment changed.

EEGLAB parity notes

None.

Earlier findings

  • Optional comment nit from the last review: fixed.
  • Everything else: fixed or declined with a reason earlier. None of them have come back.

I read the diff (git show 8a02dd79) but didn't run any tests or linters, since only a comment changed.

Copy link
Copy Markdown
Member Author

EEGLAB reference suite (jamming) — tip 8a02dd79

Same S5 shard matrix/pins under flock ~/eegprep-bench/matlab.lock (bench_s11_ref.sh).

  • HEAD 8a02dd79 · EEGLAB d0963be9 · eeglab_tests fec88f9f
  • AGGREGATE: tests=3908 · passed≈3845 · failed=6 · errors=0 · skipped=57
  • Shard exits: heavy 0 · hybrid 1 · stats 0 · study 0 · misc 0 · core 1 · parity 1

Failures (root-caused; none loosened)

Failure Classification
test_bids_preproc crashability + end2end — missing data/ Known on develop
test_average_reference_matches_matlab_on_64_channel_float32 — max_abs=0.109 Known on develop
hybrid test_matlab_tutorial_figures_retain_their_plot_target_between_calls — gca parent 2 vs figure 4 Jamming flake (also FAILED in concurrent S9 hybrid log)
test_user_guide_example_runs[plot_reject_artifacts.py] — missing torch S11 venv setup (bare uv sync); installed torch==2.12.0+cu130 matching S5/S9; re-run → passed
test_icflag_and_subcomp_match_matlab_on_the_same_classification — missing torch Same setup gap; torch now installed (MATLAB re-run pending lock after S9)

No Stream 11 production-code regressions. Logs: ~/eegprep-bench/logs/s11_ref/ on jamming.

Also closed: Claude _saveset history rewrite already fixed at tip (emit filename/filepath; rewrite removed). Live SBS at tip: pr574_final_sbs_main_20261107_112806.png. CI green; Claude safe-to-merge on 8a02dd79. Not merging.

Co-authored-by: Suraj Ranganath <[email protected]>

# Conflicts:
#	docs/source/changelog.rst
@suraj-ranganath
suraj-ranganath merged commit 89b94aa into develop Nov 11, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Release readiness] Stream 11: Main window, menus, preferences, help

2 participants