Skip to content

Conversation

@jomardyan
Copy link
Owner

Summary

  • add a --dry-run CLI option that validates scripts and prints an execution plan instead of running
  • expose execution plan details via ScriptRunner, including config and history settings
  • extend unit and integration coverage to verify the dry-run plan output

Testing

  • pytest tests/test_runner_core.py::TestScriptRunnerBasics::test_execution_plan_summary tests/test_integration.py::TestExecutionWithHistory::test_cli_dry_run_shows_execution_plan -q

Codex Task

Copilot AI review requested due to automatic review settings November 20, 2025 13:05
@jomardyan jomardyan merged commit 3eeb4ee into main Nov 20, 2025
7 of 9 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds dry-run execution plan support to the runner CLI, allowing users to validate scripts and preview execution configuration without actually running the script.

  • Introduces a --dry-run CLI flag for validating and previewing execution plans
  • Exposes execution plan details via new get_execution_plan() method in ScriptRunner
  • Extends test coverage with unit and integration tests for dry-run functionality

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
runner.py Adds get_execution_plan() method to ScriptRunner, stores config_file and history_db_path fields, implements --dry-run CLI flag handling
tests/test_runner_core.py Adds unit test for get_execution_plan() method, removes trailing whitespace
tests/test_integration.py Adds integration test for CLI dry-run functionality via subprocess execution

Comment on lines +8511 to +8522
if args.dry_run:
try:
runner.validate_script()
except Exception as exc:
logging.error(f"Dry-run validation failed: {exc}")
return 1

plan = runner.get_execution_plan()
print("\nDRY-RUN: Execution plan (no script executed)")
for key, value in plan.items():
print(f" {key}: {value}")
return 0
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

Inconsistent exit pattern: Use sys.exit() instead of return to match the pattern used throughout the rest of the main() function. All other early exits in the function use sys.exit() (lines 8440, 8447, 8460, 8476, 8494, etc.).

Copilot uses AI. Check for mistakes.
Comment on lines +8511 to +8522
if args.dry_run:
try:
runner.validate_script()
except Exception as exc:
logging.error(f"Dry-run validation failed: {exc}")
return 1

plan = runner.get_execution_plan()
print("\nDRY-RUN: Execution plan (no script executed)")
for key, value in plan.items():
print(f" {key}: {value}")
return 0
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

Dry-run execution plan may show incomplete configuration. The dry-run check occurs before CLI arguments like --monitor-interval (line 8524) and retry configuration (lines 8527-8544) are applied to the runner. This means the execution plan will display default values instead of user-specified values for these settings. Consider either:

  1. Moving the dry-run check after all configuration is applied, or
  2. Passing these additional arguments to the ScriptRunner constructor

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants