Skip to content

Conversation

@danielibarrola
Copy link

This PR introduces a dry run mode to the culprit_finder tool. This mode allows users to simulate the bisection process and visualize the steps it would take (branch creation, workflow triggering, and branch deletion) without making any actual state-changing API calls to GitHub.

Key Changes

Core Logic (culprit_finder.py)

  • Added a dry_run parameter to the CulpritFinder constructor.
  • Updated _test_commit to skip triggering GitHub workflows when dry_run is enabled, returning True by default to allow the bisection loop to proceed.
  • Modified run_bisection to:
    • Log "DRY RUN" messages instead of calling create_branch and delete_branch.
    • Skip the standard "Commit is good/bad" status logging to avoid confusion with the mock results.

CLI Interface (cli.py & README.md)

  • Added a new --dry-run flag to the CLI.
  • When --dry-run is used, the script will exit after the simulation without attempting to print a final culprit (since no real testing occurred).
  • Updated the documentation to include the new flag and its usage.

Testing (test_culprit_finder.py & test_cli.py)

  • Added comprehensive unit tests for the dry run mode:
    • test_run_bisection_dry_run: Verifies that no state-changing API calls (create_branch, delete_branch, trigger_workflow) are made.
    • test_test_commit_dry_run: Ensures _test_commit behaves correctly in dry run mode.
  • Updated existing CLI tests to account for the new constructor signature.

How to use

Run the culprit finder with the --dry-run flag:

python -m culprit_finder.cli --repo owner/repo --start <good_sha> --end <bad_sha> --workflow ci.yml --dry-run

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