Skip to content

fix: add files to PR and switch reretry with tenacity#119

Open
fgvieira wants to merge 9 commits intosnakemake:mainfrom
fgvieira:deps
Open

fix: add files to PR and switch reretry with tenacity#119
fgvieira wants to merge 9 commits intosnakemake:mainfrom
fgvieira:deps

Conversation

@fgvieira
Copy link
Contributor

@fgvieira fgvieira commented Mar 13, 2026

Summary by CodeRabbit

  • New Features

    • Pull request drafts now automatically include updated snakefile content before creation.
  • Improvements

    • Enhanced retry mechanism with exponential backoff for improved reliability.
  • Chores

    • Updated CI/CD workflow configuration for build environment handling.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7b6a0bc8-6492-43de-8f53-138be541b748

📥 Commits

Reviewing files that changed from the base of the PR and between 2697ec2 and 642fdcd.

📒 Files selected for processing (1)
  • snakedeploy/templates/plugins/release_please.yml.j2

📝 Walkthrough

Walkthrough

This PR updates the retry mechanism from reretry to tenacity with exponential backoff, adds explicit snakefile content recording to PR drafts before creation, and adjusts release workflow configuration by removing hardcoded Python version and disabling pixi cache/locking.

Changes

Cohort / File(s) Summary
Retry Mechanism Migration
snakedeploy/prs.py
Replaced reretry.retry decorator with tenacity.retry and updated retry configuration to use stop_after_attempt(2) with exponential backoff; removed top-level github import and updated exception reference to GithubException.UnknownObjectException.
PR File Content Recording
snakedeploy/snakemake_wrappers.py
Added pr.add_file() call to explicitly record updated snakefile content into PR draft before invoking pr.create() when create_prs is enabled.
Release Workflow Configuration
snakedeploy/templates/plugins/release_please.yml.j2
Removed workflow-level PYTHON_VERSION environment variable and modified setup-pixi step inputs to disable caching (cache: false) and locked dependency resolution (locked: false).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the two main changes: switching from reretry to tenacity and adding files to PR before creation.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@snakedeploy/prs.py`:
- Line 5: The current import and decorator use reretry-style parameters (tries,
delay) which tenacity doesn't support; update the import to bring in tenacity's
helpers (e.g., from tenacity import retry, stop_after_attempt, wait_fixed) and
replace the decorator usage "@retry(tries=..., delay=...)" with tenacity
equivalents, e.g. "@retry(stop=stop_after_attempt(<tries>),
wait=wait_fixed(<delay_seconds>))" so the retry behavior maps correctly; apply
this change where the `@retry` decorator is used (around line 59) and adjust
numeric values as needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f8af5ad0-1b26-404f-b662-a90d515dc3ad

📥 Commits

Reviewing files that changed from the base of the PR and between f482e35 and 512b900.

⛔ Files ignored due to path filters (1)
  • pyproject.toml is excluded by !pyproject.toml
📒 Files selected for processing (1)
  • snakedeploy/prs.py

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@snakedeploy/prs.py`:
- Line 5: The import statement in prs.py has a syntax error: "from tenacity
import retry,, stop_after_attempt, wait_exponential" contains a double comma;
open the file and correct the import to list the symbols properly (ensure you
import retry, stop_after_attempt, and wait_exponential from tenacity without the
extra comma) so the module can be parsed and imported successfully.
- Around line 85-87: The except clause currently references
GithubException.UnknownObjectException (invalid attribute); update the handler
in snakedeploy/prs.py so it catches the correct exception: either import
UnknownObjectException and use "except UnknownObjectException as e" (add the
proper import at the top) or change the clause to catch the parent
"GithubException" like the earlier handler; make the rest of the logic (if
e.status != 404: raise e) remain unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e36da201-c827-444d-92ef-1246d00d3420

📥 Commits

Reviewing files that changed from the base of the PR and between 512b900 and f5e99cd.

📒 Files selected for processing (1)
  • snakedeploy/prs.py

fgvieira and others added 2 commits March 13, 2026 14:03
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@fgvieira fgvieira moved this to In review in Snakemake Hackathon 2026 Mar 13, 2026
@fgvieira fgvieira self-assigned this Mar 13, 2026
@fgvieira fgvieira added the bug Something isn't working label Mar 13, 2026
@fgvieira fgvieira changed the title perf: switch reretry with tenacity fix: add files to PR and switch reretry with tenacity Mar 13, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
snakedeploy/snakemake_wrappers.py (1)

189-202: ⚠️ Potential issue | 🔴 Critical

pr.create() is called multiple times when per_snakefile_prs=False.

The pr.create() call at line 198 executes on every loop iteration regardless of the per_snakefile_prs flag. When per_snakefile_prs=False, this causes multiple create() calls on the same PR object—once per snakefile in the loop, plus once more at line 202.

Previously this was masked because self.files was empty (per context snippet from snakedeploy/prs.py:61-63), causing create() to return early. Now that pr.add_file() populates files, the bug becomes active and will likely cause GitHub API errors or unexpected behavior.

Proposed fix
             if create_prs:
                 assert pr is not None
                 pr.add_file(
                     snakefile,
                     snakefile_content,
                     is_updated=True,
                     msg=f"perf: update {snakefile}.",
                 )
 
-                pr.create()
+                if per_snakefile_prs:
+                    pr.create()
 
         if create_prs and not per_snakefile_prs:
             assert pr is not None
             pr.create()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snakedeploy/snakemake_wrappers.py` around lines 189 - 202, The loop currently
calls pr.create() on every iteration and again after the loop when create_prs is
true, causing duplicate creates when per_snakefile_prs is False; update the code
so the per-iteration pr.create() (the call immediately after pr.add_file in the
loop) is only executed when per_snakefile_prs is True (i.e., guard or move that
call into the per_snakefile_prs branch) and leave the single post-loop
pr.create() for the per_snakefile_prs == False case; reference pr.add_file,
pr.create, create_prs, and per_snakefile_prs to locate the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@snakedeploy/snakemake_wrappers.py`:
- Around line 189-202: The loop currently calls pr.create() on every iteration
and again after the loop when create_prs is true, causing duplicate creates when
per_snakefile_prs is False; update the code so the per-iteration pr.create()
(the call immediately after pr.add_file in the loop) is only executed when
per_snakefile_prs is True (i.e., guard or move that call into the
per_snakefile_prs branch) and leave the single post-loop pr.create() for the
per_snakefile_prs == False case; reference pr.add_file, pr.create, create_prs,
and per_snakefile_prs to locate the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6d1c50b8-2eb7-43f5-bb9c-ec6749ecbd32

📥 Commits

Reviewing files that changed from the base of the PR and between f5e99cd and 2697ec2.

📒 Files selected for processing (3)
  • snakedeploy/prs.py
  • snakedeploy/snakemake_wrappers.py
  • snakedeploy/templates/plugins/scheduler-plugins/init.py
✅ Files skipped from review due to trivial changes (1)
  • snakedeploy/templates/plugins/scheduler-plugins/init.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • snakedeploy/prs.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant