Repository navigation
Stream 11: Main window, menus, datasets, preferences, help - #574
Conversation
…F5 F38 F93 F95) part 1
…F49 F90 F94) part A
There was a problem hiding this comment.
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 finished @suraj-ranganath's task in 3m 17s —— View job Code review
BlockingNone. Important
Nits
Test gaps
EEGLAB parity notesNone. I compared these against EEGLAB:
The intentional deviations in the PR body (JSON preferences, Python size estimate, quit confirmation) are documented. The vendored Also checked: the menubar refresh path (the top-level menu set is fixed, so |
| if isinstance(value, bool): | ||
| return int(value) | ||
| return value | ||
| load_eegprep_options() |
There was a problem hiding this comment.
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_boundarytypeand never touchespop_editoptionsruns with the defaults fromeeg_options.py. - The same script behaves differently once it calls
eegprep.pop_editoptions(...)for one unrelated option. That import also pulls in the savedoption_storedisk,option_savetwofiles,option_memmapdata, andoption_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.
| 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: |
There was a problem hiding this comment.
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.
Claude review follow-upJudged each point against the stream brief and AGENTS.md: Fixed
Declined
Head after these fixes: |
Hands-on GUI retest (PR #574 / #556)Retested on box
Intentional differences (checked against #556 / EEGLAB)
GUIs stopped after the session so other streams can use |
|
Claude finished @suraj-ranganath's task in 2m 1s —— View job Code review (re-review at
|
| native_file_dialogs: bool | None = None, | ||
| ) -> None: | ||
| qt_core, qt_gui, qt_widgets = _require_qt() | ||
| load_eegprep_options() |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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 whatevereegis 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'])});"
)
Claude re-review follow-up (nits)Claude's re-review at
Not merging. |
|
Claude finished @suraj-ranganath's task in 43s —— View job Code review (re-review at
|
CI follow-upTests were red on the previous tip. Fixed and pushed:
Local: previously failing tests + |
The GUI rewrite emits MATLAB-style quoted paths (literal backslashes), not Python repr(). Matching with !r broke three MenuActionDispatcher tests on windows-latest.
|
@claude review Re-review after tip |
|
Claude finished @suraj-ranganath's task in 51s —— View job Code review (re-review at
|
|
@claude review Re-review after tip |
|
Claude finished @suraj-ranganath's task in 18s —— View job Code review (re-review at
|
Hands-on GUI retest (completed) — tip
|
| 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 recursivesys.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.
Claude nit:
|
|
@claude review Re-review after tip that emits |
|
Claude finished @suraj-ranganath's task in 28s —— View job Code review (re-review at
|
|
@claude review Tip |
|
Claude finished @suraj-ranganath's task in 13s —— View job Code review (re-review at
|
EEGLAB reference suite (jamming) — tip
|
| 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
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
chanlocs.ref, with ties resolved by first in sorted order;unknownonly when that value is empty, matching EEGLAB%6.3f-style formattingdata.nbytesonly)mixed, yes and nopop_newset)[1:32]colon ranges to PythonIntentional differences from EEGLAB
sys.getsizeofrecursion rather than MATLABwhos('EEG').Tests
tests/test_stream11_*.py(menus, datasets, preferences, help/errors, console colon ranges).QT_QPA_PLATFORM=offscreen uv run pytest tests/test_stream11_*.py→ 83 passed.Notes
EEGLAB reference suite (jamming, tip
8a02dd79)Same shard matrix and pins as Stream 5 (
bench_s11_ref.sh/run_s11_ref.shunderflock ~/eegprep-bench/matlab.lock).8a02dd79· EEGLABd0963be9· eeglab_testsfec88f9fFailures (root-caused; none loosened)
test_bids_preproc(test_crashability_slow,test_end2end) — missingdata/test_average_reference_matches_matlab_on_64_channel_float32— max_abs=0.109test_matlab_tutorial_figures_retain_their_plot_target_between_calls— gca parent mismatch8a02dd79and on develop1bdd1a28(same pins); also FAILED in concurrent S9 hybrid logtest_user_guide_example_runs[plot_reject_artifacts.py]— missing torchuv sync); installedtorch==2.12.0+cu130to match S5/S9; re-run → passedtest_icflag_and_subcomp_match_matlab_on_the_same_classification— missing torchNo Stream 11 production-code regressions found in the suite.