Skip to content

🪲 BUG-#143: Fix retry=0 causing zero execution attempts - #192

Merged
FernandoCelmer merged 6 commits into
developfrom
feature/143
Apr 8, 2026
Merged

🪲 BUG-#143: Fix retry=0 causing zero execution attempts#192
FernandoCelmer merged 6 commits into
developfrom
feature/143

Conversation

@FernandoCelmer

Copy link
Copy Markdown
Member

Description

  • dotflow/core/action.py: Extract max_attempts = max(1, self.retry) and use it in both the loop range and the raise guard, ensuring retry=0 executes exactly once and raises on failure
  • tests/core/test_action.py: Add tests for retry=0 happy path and failure path

Motivation and Context

With retry=0, range(1, 0+1) produces an empty range — the task never executes and returns None silently. Additionally, the raise guard if attempt == self.retry compared 1 == 0 which is always False, silently swallowing exceptions.

This PR resolves the conflict from PR #159 by combining max_attempts (from #159) with from None (already in develop from PR #157).

Closes #143

Types of changes

  • Bug fix (change that fixes an issue)
  • New feature (change which adds functionality)
  • Documentation

Checklist

  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the CHANGELOG
  • I have updated the documentation accordingly

Austin Varga and others added 6 commits April 6, 2026 20:00
Fixes #143 — the retry loop used range(1, self.retry + 1), so passing
retry=0 produced an empty range and the task never ran at all.

Wrap with max(1, self.retry) so the loop always executes at least one
attempt regardless of the retry value.
The raise guard previously compared attempt == self.retry, which is
always False when retry=0 (attempt is 1 after max(1, 0)). This caused
failing tasks with retry=0 to silently return None instead of raising.

Extract the clamped bound into max_attempts and use it in both the
range() and the raise guard. Also adds test_retry_zero_raises_on_failure
per review feedback.
fix: ensure retry=0 executes the task exactly once
@FernandoCelmer FernandoCelmer added bug Something isn't working edge-case Edge case handling labels Apr 8, 2026
@FernandoCelmer
FernandoCelmer merged commit 9b91bb7 into develop Apr 8, 2026
10 checks passed
@FernandoCelmer
FernandoCelmer deleted the feature/143 branch April 8, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working edge-case Edge case handling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant