Skip to content

fix: Verify $python_exec exists before running#79

Merged
kdvalin merged 2 commits into
mainfrom
fix/python_exec_exists
Jul 1, 2026
Merged

fix: Verify $python_exec exists before running#79
kdvalin merged 2 commits into
mainfrom
fix/python_exec_exists

Conversation

@kdvalin

@kdvalin kdvalin commented Jun 9, 2026

Copy link
Copy Markdown
Member

Description

Verifies that $python_exec is a valid PATH binary or absolute path before running.

Before/After Comparison

Before

No verification is done

After

Wrapper exits out if the executable isn't in the PATH or the absolute file isn't executable.

Clerical Stuff

Closes #57

Relates to JIRA: RPOPC-764

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 83087c43-c8f7-48fc-9088-67199b2f6a0a

📥 Commits

Reviewing files that changed from the base of the PR and between 7dc3c96 and 4151101.

📒 Files selected for processing (1)
  • pyperf/pyperf_run
💤 Files with no reviewable changes (1)
  • pyperf/pyperf_run

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Added earlier validation of the user-specified Python executable to detect invalid or non-executable values sooner.
    • Now presents clearer error messaging and stops the run immediately when the specified interpreter is not found or is not executable.

Walkthrough

The PR adds an early validation check in the pyperf_run script to verify that the user-specified Python interpreter exists and is executable. If the interpreter is unavailable, the script exits with an error code instead of silently succeeding, addressing issue #57.

Changes

Python interpreter validation

Layer / File(s) Summary
Early python_exec existence check
pyperf/pyperf_run
Adds a guard clause using command -v "$python_exec" immediately after argument parsing to validate the interpreter is available and executable. On failure, the script exits with an error message and appropriate error code via exit_out, preventing silent success when the specified Python executable is missing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding verification that $python_exec exists before running.
Description check ✅ Passed The description covers all required sections: it explains what the PR does, provides before/after comparison, and includes issue/JIRA ticket references.
Linked Issues check ✅ Passed The PR successfully implements the objective from issue #57: verifying that $python_exec is available and executable before running, preventing exit code 0 on failure.
Out of Scope Changes check ✅ Passed All changes are focused on verifying $python_exec exists before execution, directly addressing issue #57 requirements with no out-of-scope modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

This relates to RPOPC-764

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
pyperf/pyperf_run (1)

403-405: ⚡ Quick win

Remove redundant validation check.

This check is now unreachable. The new validation at lines 395-397 exits before this point if python_exec is invalid. Removing this redundant check improves code clarity and eliminates dead code.

♻️ Proposed cleanup
 	pkg_list="--packages `echo $python_pkgs | sed "s/,/ /g"`"
 fi
-if ! command -v $python_exec; then
-	exit_out "Error: Designated python executable, $python_exec, not present" $E_GENERAL
-fi
 
 if [[  $to_no_pkg_install -eq 0 ]]; then
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyperf/pyperf_run` around lines 403 - 405, Remove the unreachable redundant
validation block that checks for the python executable presence (the "if !
command -v $python_exec; then exit_out ... $E_GENERAL fi" block); since earlier
validation already exits on an invalid python_exec, delete this entire
conditional and its call to exit_out to eliminate dead code and avoid duplicate
checks, and verify no other code paths depend on this specific check or on side
effects of calling exit_out here.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pyperf/pyperf_run`:
- Around line 403-405: Remove the unreachable redundant validation block that
checks for the python executable presence (the "if ! command -v $python_exec;
then exit_out ... $E_GENERAL fi" block); since earlier validation already exits
on an invalid python_exec, delete this entire conditional and its call to
exit_out to eliminate dead code and avoid duplicate checks, and verify no other
code paths depend on this specific check or on side effects of calling exit_out
here.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 96499ab1-3aa4-48e7-9149-a7d95a887270

📥 Commits

Reviewing files that changed from the base of the PR and between 63058b0 and 7dc3c96.

📒 Files selected for processing (1)
  • pyperf/pyperf_run

@kdvalin kdvalin requested a review from a team June 30, 2026 14:53

@frival frival left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@frival frival added the group_review_lgtm Indicates approval after a group review meeting label Jul 1, 2026
@kdvalin kdvalin merged commit 1c35079 into main Jul 1, 2026
4 checks passed
@kdvalin kdvalin deleted the fix/python_exec_exists branch July 1, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

group_review_lgtm Indicates approval after a group review meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Script exits sucessfully when $python_exec is not available

2 participants