Skip to content

[GUI] Verify both checkouts before capturing dialogs - #889

Open
arnodelorme wants to merge 1 commit into
developfrom
agent/issue-875-capture-checkouts
Open

arnodelorme wants to merge 1 commit into
developfrom
agent/issue-875-capture-checkouts

Conversation

@arnodelorme

Copy link
Copy Markdown
Collaborator

Check that both capture checkouts are clean and contain the latest origin/develop before drawing. Verify that Python imported EEGPrep from the requested checkout and record both commits for the report.

Part of #875.

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

Copy link
Copy Markdown
Contributor

Claude finished @arnodelorme's task in 38s —— View job


PR review: Verify both checkouts before capturing dialogs

  • Read the diff (README.md, check_capture.py, run_linux.sh)
  • Check the shell and Python control flow
  • Post the review

Summary: This is a small tooling change, and the direction is right. Before this PR, the runner only printed how far each checkout was behind develop. Now it refuses to capture from a stale or dirty checkout, or from an EEGPrep imported out of another tree. It's tooling only, so no EEGLAB parity run is needed.

What works

  • revisions=$(python check_capture.py …) under set -e stops the script before Xvfb or MATLAB starts. SystemExit messages go to stderr, so the user still sees them.
  • Resolving both sides before is_relative_to handles symlinked checkouts.
  • Creating $out after the check means a failed check leaves no empty output folder behind.
  • HEAD..origin/develop lets a feature branch that is up to date with develop pass, which is the case this tool exists for (testing a PR branch).

Suggestions (non-blocking, details in the inline comments)

  1. run_linux.sh:37: The script no longer sets PYTHONPATH, so the user has to. The script already knows $eegprep, so export PYTHONPATH="$eegprep/src${PYTHONPATH:+:…}" near the top would do it once. The README could then drop PYTHONPATH="$PWD/src", which is wrong when you run from a subdirectory. Keep the import-path check.
  2. check_capture.py:19: Requiring a clean status including untracked files and submodules is strict for EEGLAB trees with local plugin changes. Consider limiting the EEGLAB check to functions/. Also, an output folder inside the EEGPrep checkout passes the first run and fails every later one.
  3. Minor: The fetch refspec refs/heads/develop:refs/remotes/origin/develop has no +, so a force-pushed develop makes the fetch fail with a raw CalledProcessError traceback. That's rare, but +refs/heads/develop:… matches what a plain git fetch does.

Not checked: I couldn't run ruff, because the sandbox needed approval for the command. I also didn't run the script, since it needs MATLAB and an EEGLAB checkout.

matlab -nosplash -nodesktop -r "try, addpath('$eeglab/functions/guifunc', '$eeglab/functions/adminfunc', '$eeglab/functions/sigprocfunc', '$eeglab/functions/miscfunc', '$here/matlab'); cases = dir('$here/cases/*.json'); for iCase = 1:length(cases), draw_geometry(fullfile(cases(iCase).folder, cases(iCase).name), fullfile('$out/matlab', cases(iCase).name(1:end-5))); end, catch err, disp(getReport(err)); exit(1); end, exit(0);"
for casefile in "$here"/cases/*.json; do
QT_QPA_PLATFORM=xcb PYTHONPATH="$eegprep/src" python "$here/draw_geometry.py" "$casefile" "$out/python/$(basename "$casefile" .json)"
QT_QPA_PLATFORM=xcb python "$here/draw_geometry.py" "$casefile" "$out/python/$(basename "$casefile" .json)"

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.

Dropping the forced PYTHONPATH="$eegprep/src" means each user now has to set it (README step), and check_capture.py only fails afterwards if they forget. The script already knows $eegprep, so it could set it once near the top and the check would then only catch a broken environment:

export PYTHONPATH="$eegprep/src${PYTHONPATH:+:$PYTHONPATH}"

That also lets the README drop the PYTHONPATH="$PWD/src" prefix, which points at the wrong place when the command runs from a subdirectory. Keep the is_relative_to check either way. It still catches an editable install from a different checkout that wins on sys.path.

[*git, "fetch", "--quiet", "origin", "refs/heads/develop:refs/remotes/origin/develop"], check=True
)
if subprocess.check_output(
[*git, "status", "--porcelain", "--untracked-files=all", "--ignore-submodules=none"]

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.

--untracked-files=all --ignore-submodules=none is strict for the EEGLAB checkout. Many local EEGLAB trees have modified plugin submodules or untracked plugin folders, and those do not change the guifunc/adminfunc/sigprocfunc/miscfunc files that draw_geometry.m uses. If that strictness is what you want, fine. If it's too strict, limiting the EEGLAB status check to -- functions would remove false failures without hiding stale GUI code.

Also, when the output folder sits inside the EEGPrep checkout, the first run passes and every later run fails with "uncommitted changes", unless the folder is gitignored. The README mentions this, but the error message doesn't hint at it.

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

🤖 Review (Claude Fable 5.2): ready to merge. The guard was run on jamming in the four situations it is written for, and it does what it says.

The earlier automatic review could not run the script. This one did, on jamming, on develop (068ad174) merged with this branch (a3d597cb), with EEGLAB at 3dd650cc.

Situation Result
No PYTHONPATH (the shared environment loads another checkout) Stops before MATLAB starts: Loaded EEGPrep from …/repos/eegprep/src/eegprep/__init__.py. Set PYTHONPATH to …/wt/src. No output folder is created.
An untracked file in the EEGPrep checkout Stops: EEGPrep checkout has uncommitted changes
EEGPrep checkout behind develop Stops: EEGPrep checkout is 9 commits behind origin/develop
Clean and up to date Runs to the end: 95 cases drawn by MATLAB and by EEGPrep, revisions.txt holds both commits with their paths, and no dialog is more than 1 pixel off in height or rows.

The first line is the case that went wrong on November 29, when a script drew from an old copy of the package without a word. It can no longer happen silently.

Not blocking, for a later change:

  • The script could set PYTHONPATH itself from its own location, as it did before, and keep the check. Today a forgotten PYTHONPATH costs one failed start with a clear message, which is acceptable.
  • The output folder must be outside both checkouts, or the second run stops on "uncommitted changes". The README says so; the error message does not.
  • This is tooling only: no EEGLAB reference run is needed.

This branch has not been deployed

No deployments
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