Skip to content

Complete STUDY dataset editor interactions - #235

Open
suraj-ranganath wants to merge 2 commits into
developfrom
feature/pop-study-interactive-completion-1005222119350501959
Open

Complete STUDY dataset editor interactions#235
suraj-ranganath wants to merge 2 commits into
developfrom
feature/pop-study-interactive-completion-1005222119350501959

Conversation

@suraj-ranganath

@suraj-ranganath suraj-ranganath commented Jun 24, 2026

Copy link
Copy Markdown
Member

Complete row-level controls in the STUDY dataset editor so users can clear dataset metadata and select ICA component subsets without placeholder callbacks. Fixes component command generation for untouched buttons and list-valued selections, with regression coverage for GUI renderer results.

- Implement 'clear_widgets' callback in QtDialogRenderer to reset row metadata.
- Implement 'select_study_components' callback for ICA component selection.
- Update pop_study_dialog_spec to use new callbacks for 'Clear' and 'All comp.' buttons.
- Update _dataset_row_commands to include selected components in the STUDY history command.
- Remove redundant pagination buttons as the dialog is already scrollable.
- Ensure component count is correctly determined from ALLEEG metadata when available.

Co-authored-by: suraj-ranganath <14310165+suraj-ranganath@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@claude

claude Bot commented Jun 24, 2026

Copy link
Copy Markdown

Claude finished @suraj-ranganath's task in 5m 11s —— View job


Code review

  • Overall assessment: Needs changes
  • Highest-risk area: comps round-trip between the components pushbutton and std_editset (crashes the default GUI flow)
  • Merge recommendation: Needs changes

Blocking

Untouched components button crashes the editor on OKpop_study.py:316-317 (inline comment posted). In the real Qt renderer, inputgui reads every widget into result (qt.py:123). Pushbuttons never store their ControlSpec.value as a Qt property at creation (qt.py:209-210 ignores value for the pushbutton branch), so an untouched components button is read via _read_widget's widget.text() fallback (qt.py:1421) as its label "All comp.". That string flows into comps, and std_editset calls parse_numeric_sequence("All comp.", dtype=int)float("All")ValueError. Opening the editor with any loaded dataset and clicking OK without touching the components button therefore raises.

The tests pass only because the mock _Renderer in test_gui_pop_study.py omits dataset_*_components from its result dict — so the crashing path is never exercised.

Suggested fix (also avoids emitting a bogus comps for untouched rows; existing comps are preserved by std_editset regardless):

if isinstance(result.get(f"{prefix}components"), list):
    commands.extend(["comps", result.get(f"{prefix}components")])

Fix this →

Important

None.

Nits

  • _format_components_button (pop_study.py:362) and value=info.get("comps") or [] (pop_study.py:202) both use truthiness on comps. If info["comps"] can ever be a multi-element NumPy array (e.g. a STUDY loaded from a MATLAB .set), if not comps / comps or [] raise ValueError: truth value of an array is ambiguous. After std_editset/parse_numeric_sequence comps is always a list, so this is only a concern for externally-loaded studies — worth a len()/is None guard if that path is reachable. Low confidence.
  • After clear_widgets empties the components button, its label becomes blank rather than resetting to "All comp." — minor cosmetic inconsistency.

Test gaps

  • Add a test_pop_study_gui case whose renderer result includes dataset_1_components: "All comp." (matching the real renderer, which returns the button label for untouched pushbuttons) and assert pop_study completes without raising. This directly guards the blocking bug above.
  • A positive-path test where dataset_1_components: [1, 2] asserts the generated command/history contains comps with [1, 2] would lock in the intended round-trip.

EEGLAB parity notes

  • Component indices: pop_chansel returns 1-based chanlist, and the stored/emitted comps are 1-based — consistent with EEGLAB std_editset comps semantics. Good.
  • _dataset_component_count correctly maps the 1-based row index to datasets[index - 1] and reads icaweights.shape[0]. Looks right.
  • Removing the non-functional < / Page 1 / > paging controls is reasonable given the dialog is already scrollable; the known_differences note still reflects the table-based editing model.

Checked correctness/regressions, EEGLAB parity, EEG dict/comps semantics, changed-behavior tests, and AGENTS.md compliance.

Comment thread src/eegprep/functions/studyfunc/pop_study.py Outdated
@suraj-ranganath suraj-ranganath changed the title Complete STUDY Dataset Editor interactive features Complete STUDY dataset editor interactions Jun 24, 2026

Copy link
Copy Markdown
Member Author

🤖 Addressed the blocking STUDY components review in commit 1d3e4aa. The GUI command path now ignores untouched pushbutton labels, preserves list-valued component selections through std_editset, and has regression coverage for both cases.

Local verification: uv run pytest tests/test_gui_pop_study.py tests/test_study_metadata.py and ./pre-commit.py --fix on the staged PR files.

@google-labs-jules

Copy link
Copy Markdown

🤖 Addressed the blocking STUDY components review in commit 1d3e4aa. The GUI command path now ignores untouched pushbutton labels, preserves list-valued component selections through std_editset, and has regression coverage for both cases.

Local verification: uv run pytest tests/test_gui_pop_study.py tests/test_study_metadata.py and ./pre-commit.py --fix on the staged PR files.

Acknowledged. Thank you for the confirmation.

Copy link
Copy Markdown
Member Author

🤖 Re-audited at 1d3e4aac. Looks good. The follow-up correctly ignores the untouched All comp. button label, preserves list-valued component selections, handles NumPy component arrays, and adds regression coverage for both untouched and selected-component paths. The full check matrix is green.

@google-labs-jules

Copy link
Copy Markdown

🤖 Re-audited at 1d3e4aac. Looks good. The follow-up correctly ignores the untouched All comp. button label, preserves list-valued component selections, handles NumPy component arrays, and adds regression coverage for both untouched and selected-component paths. The full check matrix is green.

Acknowledged. Thank you for the re-audit and confirmation.

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.

1 participant