Skip to content

[tests] Keep the MATLAB batch figure across idle pause - #604

Merged
suraj-ranganath merged 1 commit into
developfrom
cursor/fix-matlab-figure-target-580-608f
Nov 11, 2026
Merged

suraj-ranganath merged 1 commit into
developfrom
cursor/fix-matlab-figure-target-580-608f

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Keep the MATLAB batch server's selected figure across its idle pause. That pause processes graphics events and was moving groot.CurrentFigure onto an older figure, so the next plot landed in the wrong window. The empty-pending branch restores the selection, including no current figure, and leaves request-made changes alone. Locked by test_matlab_tutorial_figures_retain_their_plot_target_between_calls, which needs MATLAB. R2025b on jamming: 192/192 parent comparisons; hybrid shard 143 passed, 4 existing skips.

Fixes #580

Open in Web Open in Cursor 

pause processes pending figure activation and can move
groot.CurrentFigure onto an older figure before the next plot.

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

@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 11, 2026 •

Copy link
Copy Markdown
Contributor

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


Code review

  • Overall assessment: Looks good. The idle branch of eegprep_batch_engine_serve.m reads groot.CurrentFigure before pause(0.01) and sets it back afterwards. The restore only runs when no request is pending, so a figure change made by a served request is never overwritten. It restores an empty selection as it was, and it skips the restore if the saved figure was closed during the pause (isgraphics(current_figure, 'figure')).
  • Highest-risk area: None identified. The change only touches the MATLAB batch test transport under tests/matlab/. No EEGPrep runtime or core-function code changes, so the pre-merge EEGLAB reference run from AGENTS.md is not required.
  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None. The fix is covered by the existing test_matlab_tutorial_figures_retain_their_plot_target_between_calls in tests/test_eeglab_hybrid.py:673. That test plots four times across separate engine calls and checks that each new axes belongs to the figure created just before it. It needs MATLAB, and the PR body reports it passing on R2025b.

EEGLAB parity notes

None. This is test infrastructure only and does not change any EEGLAB-ported behavior.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance.

@suraj-ranganath
suraj-ranganath marked this pull request as draft November 11, 2026 18:42
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 11, 2026 18:42
@claude

claude Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

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


PR review: keep the MATLAB batch figure across idle pause

  • Pre-review gate: PR is open and not a draft, there's no earlier review marker, and the head is 50f34b5, same as the checkout
  • Read AGENTS.md / CLAUDE.md, including the Testing section
  • Read the diff and all of tests/matlab/eegprep_batch_engine_serve.m
  • Read the test that locks this behaviour (tests/test_eeglab_hybrid.py:673)
  • Checked rules, conventions and correctness

Verdict

No blocking or important issues. This is a small fix aimed at the cause: the idle pause(0.01) processes graphics events, and that was moving groot.CurrentFigure.

What I checked

  • Correctness of the restore (eegprep_batch_engine_serve.m:13-19):
    • With no current figure, get(groot,'CurrentFigure') returns an empty placeholder. isempty is then true and set(groot,'CurrentFigure',[]) restores "no current figure". That's valid and matches the PR description.
    • If the saved figure was closed during the pause, isgraphics(...,'figure') is false and the restore is skipped, so no invalid-handle error can occur.
    • Requests only run in the non-empty branch, so the restore never overwrites a figure change a request made. A request that lands during the pause is still served on the next iteration, after the selection has been restored.
    • set(groot,'CurrentFigure',f) does not raise the figure or take focus the way figure(f) does, so it adds no new focus side effects. It costs almost nothing at a 10 ms poll.
  • Scope: it only changes the MATLAB-batch test transport. There's no runtime package code and no core EEGLAB-ported function, so AGENTS.md doesn't require a reference-suite run.
  • Test coverage: test_matlab_tutorial_figures_retain_their_plot_target_between_calls is already on develop and needs MATLAB, so I couldn't run it here. It creates a figure, plots, and checks the parent of gca, four times in a row. That covers the repeated-call regression without being tautological, so no extra test is needed.
  • Comments: none were added, which is consistent with the AGENTS.md comment rules.

Out of scope (FYI only)

A request that calls drawnow/pause itself can still move CurrentFigure during that request. This PR doesn't try to handle that, which is right given its scope.

@suraj-ranganath
suraj-ranganath merged commit f95682f into develop Nov 11, 2026
12 of 13 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.

MATLAB hybrid reference test loses the tutorial figure target between calls

2 participants