Skip to content

Comments

Add Dry Run Mode to Culprit Finder#112

Open
danielibarrola wants to merge 1 commit intogoogle-ml-infra:feature/culprit-finderfrom
danielibarrola:feature/culprit-finder-dry-run
Open

Add Dry Run Mode to Culprit Finder#112
danielibarrola wants to merge 1 commit intogoogle-ml-infra:feature/culprit-finderfrom
danielibarrola:feature/culprit-finder-dry-run

Conversation

@danielibarrola
Copy link

@danielibarrola danielibarrola commented Dec 31, 2025

This pull request introduces a Dry Run mode to the Culprit Finder tool. This feature allows users to simulate the bisection process and see exactly which GitHub API calls would be executed without actually triggering workflows, creating branches, or deleting them.

Key Changes

1. Command-Line Interface

  • Added a new --dry-run flag to the CLI.
  • When enabled, the tool logs simulated actions (e.g., triggering workflows, branch management) instead of performing them.
  • Final output (reporting the culprit) is suppressed in dry-run mode to reflect that no real bisection was concluded.

2. DryRunGithubClient Implementation

  • Created a DryRunGithubClient class in github_client.py that wraps the standard GithubClient.
  • Write Operations: Methods like trigger_workflow, create_branch, and delete_branch are intercepted and replaced with logging statements.
  • Read Operations: Methods like compare_commits and get_workflow continue to use the real client to fetch metadata required for the simulation.
  • Mocking: Uses unittest.mock to generate simulated WorkflowRun and WorkflowJob objects, allowing the bisection logic to proceed through its state transitions.

3. Core Logic Integration

  • Updated culprit_finder.py to accept either the standard or the dry-run client via type hinting.
  • In cli.py, the application now conditionally instantiates the DryRunGithubClient based on the user's input.

4. Testing & Documentation

  • Added a comprehensive test case in test_culprit_finder.py to ensure that dry-run mode correctly avoids calling write-heavy methods on the real GitHub client.
  • Updated README.md to document the new --dry-run flag.

How to use

Run the tool with the --dry-run flag to preview the bisection steps:

culprit-finder <failed-run-url> --dry-run

@danielibarrola danielibarrola force-pushed the feature/culprit-finder-dry-run branch 3 times, most recently from 08d2280 to c3ce76d Compare January 14, 2026 16:36
@danielibarrola danielibarrola force-pushed the feature/culprit-finder-dry-run branch 2 times, most recently from b93fb74 to c5544f6 Compare January 29, 2026 18:28
@danielibarrola danielibarrola marked this pull request as ready for review January 29, 2026 18:33
@danielibarrola danielibarrola force-pushed the feature/culprit-finder-dry-run branch from c5544f6 to 033681e Compare February 5, 2026 14:19
@danielibarrola danielibarrola force-pushed the feature/culprit-finder-dry-run branch from 033681e to bae64d9 Compare February 5, 2026 14:20
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