Skip to content

fix: exit non-zero from makestudy and makedocker on failure - #680

Open
chikolavosaki-sys wants to merge 1 commit into
ControlCore-Project:devfrom
chikolavosaki-sys:fix/makestudy-exit-codes
Open

chikolavosaki-sys wants to merge 1 commit into
ControlCore-Project:devfrom
chikolavosaki-sys:fix/makestudy-exit-codes

Conversation

@chikolavosaki-sys

Copy link
Copy Markdown

Fixes #679

Problem: makestudy and makedocker exit 0 when they fail. Every error path ends with a bare exit, which returns the status of the echo just before it. In makedocker, the "already exists" branch has no exit at all and falls through to the end of the script. As a result, the FRI server (fri/server/main.py, /build) treats a failed study creation as a success. It runs these scripts with subprocess.check_output, which only raises on a non-zero exit code, so it returns 201 "Directory successfully created" even though nothing was created.

Steps to reproduce (dev @ 8f3e444, Ubuntu 24.04 on WSL2):

./makestudy demo/does_not_exist; echo $?          # "does not exist", exit 0
./makestudy demo/sample.graphml /tmp; echo $?     # "already exists", exit 0
./makedocker demo/sample.graphml /tmp; echo $?    # "already exists", exit 0

Change: the error paths now exit 1. This covers a missing graphml, an existing study directory, and no arguments, in both scripts. The no-arguments case matches mkconcore.py, which already calls sys.exit(1) when it gets too few arguments. The success path is unchanged: the script still ends with python3 mkconcore.py, so mkconcore's own exit code is passed through as before. makestudy.bat and makedocker.bat have no checks of their own and end with the mkconcore call, so I left them alone. I could not test them on Windows.

Testing:

  • New tests/test_makestudy_exit_codes.py: 6 tests covering the 3 failure cases for each script. The "already exists" case uses a pytest tmp_path, so nothing is created in the repo. All 6 fail on current dev and pass with this change.
  • Manually checked that a successful makestudy / makedocker still exits 0, and that a mkconcore crash (unwritable output dir) still exits 1.
  • subprocess.check_output(["./makestudy", "demo/does_not_exist"]) now raises CalledProcessError, so FRI returns its 500 error path.
  • Full suite: 244 passed, 4 skipped. ruff check and ruff format --check pass.

Copilot AI balanced review requested due to automatic review settings November 13, 2026 12:04

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

makestudy and makedocker ended their error paths with a bare `exit`,
which returns the status of the preceding `echo`, so they exited 0
when the graphml was missing, the study directory already existed,
or no arguments were given. makedocker's "already exists" branch had
no exit at all. They now exit 1 on these paths.
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.

2 participants