Skip to content

feat(actor): Add reminder failure policy#953

Open
1Ninad wants to merge 5 commits intodapr:mainfrom
1Ninad:feat-reminder-failure-policy
Open

feat(actor): Add reminder failure policy#953
1Ninad wants to merge 5 commits intodapr:mainfrom
1Ninad:feat-reminder-failure-policy

Conversation

@1Ninad
Copy link

@1Ninad 1Ninad commented Mar 12, 2026

Description

Adds an optional failure_policy parameter to register_reminder() so actors can control what happens when a reminder fails to fire. The policy serialises into the existing JSON body the SDK already sends to the Dapr runtime.

Issue reference

closes: #896

Checklist

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Signed-off-by: Ninad Kale <ninadkale200@gmail.com>
@1Ninad 1Ninad requested review from a team as code owners March 12, 2026 15:07
Copy link
Member

@acroca acroca left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution.
Fix lint errors 🙏

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

Adds support for configuring an actor reminder “failure policy” in the Python SDK, allowing callers to control retry/drop behavior when reminder ticks fail, and serializing that policy into the reminder registration payload sent to the Dapr runtime.

Changes:

  • Introduces ActorReminderFailurePolicy (drop / constant retry) and unit tests for it.
  • Extends reminder registration (Actor.register_reminder, MockActor.register_reminder, ActorReminderData) to accept and serialize failure_policy.
  • Adds reminder-data serialization tests covering failurePolicy inclusion/omission.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
dapr/actor/runtime/_failure_policy.py New policy model with serialization to the Dapr reminder JSON shape.
dapr/actor/runtime/_reminder_data.py Stores/serializes failure_policy in reminder payload.
dapr/actor/runtime/actor.py Adds failure_policy parameter to reminder registration API and includes it in request body.
dapr/actor/runtime/mock_actor.py Mirrors reminder registration signature in the test/mock actor runtime.
dapr/actor/__init__.py Re-exports ActorReminderFailurePolicy as part of the public actor package surface.
tests/actor/test_failure_policy.py New unit tests for ActorReminderFailurePolicy.
tests/actor/test_reminder_data.py New tests ensuring failurePolicy is (not) emitted by ActorReminderData.as_dict().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

1Ninad and others added 2 commits March 13, 2026 15:38
Copilot's suggestion 1

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ninad Kale <145228622+1Ninad@users.noreply.github.com>
Signed-off-by: Ninad Kale <ninadkale200@gmail.com>
@1Ninad
Copy link
Author

1Ninad commented Mar 13, 2026

Thank you for the contribution. Fix lint errors 🙏

Fixed lint errors and addressed Copilot suggestions.
Please review when you get a chance. Thanks.

@1Ninad 1Ninad requested a review from acroca March 13, 2026 10:52
@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 98.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.04%. Comparing base (bffb749) to head (63edfc9).
⚠️ Report is 89 commits behind head on main.

Files with missing lines Patch % Lines
dapr/actor/runtime/_reminder_data.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #953      +/-   ##
==========================================
+ Coverage   86.63%   89.04%   +2.41%     
==========================================
  Files          84      104      +20     
  Lines        4473     7383    +2910     
==========================================
+ Hits         3875     6574    +2699     
- Misses        598      809     +211     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@acroca acroca left a comment

Choose a reason for hiding this comment

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

LGTM, just a small comment :)
Thanks!

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

Adds support for configuring Dapr actor reminder failure handling via an optional failure_policy parameter, serializing it into the reminder registration payload sent to the Dapr runtime.

Changes:

  • Introduces ActorReminderFailurePolicy (drop / constant) and wiring into reminder payloads.
  • Extends Actor.register_reminder() and MockActor.register_reminder() to accept failure_policy.
  • Adds/extends unit tests for reminder data and failure policy behavior.

Reviewed changes

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

Show a summary per file
File Description
dapr/actor/runtime/_failure_policy.py New failure policy model with as_dict() serialization.
dapr/actor/runtime/_reminder_data.py Adds failurePolicy field to reminder payload dict; normalizes empty reminder state handling.
dapr/actor/runtime/actor.py Adds failure_policy arg to register_reminder() and includes it in serialized request body.
dapr/actor/runtime/mock_actor.py Mirrors register_reminder() signature and stores policy in mock reminder data.
dapr/actor/__init__.py Exposes ActorReminderFailurePolicy from dapr.actor.
tests/actor/test_failure_policy.py New tests for policy factories, serialization, and validation.
tests/actor/test_reminder_data.py Adds tests covering reminder dict serialization with/without failurePolicy.
tests/actor/test_actor.py Adds test ensuring reminder registration payload includes failurePolicy.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@1Ninad
Copy link
Author

1Ninad commented Mar 13, 2026

I noticed Copilot left a few suggestions. Should I go ahead and address those Copilot suggestions in this PR, or leave it as is?

@acroca
Copy link
Member

acroca commented Mar 13, 2026

I noticed Copilot left a few suggestions. Should I go ahead and address those Copilot suggestions in this PR, or leave it as is?

I think the suggestions are useful

@1Ninad
Copy link
Author

1Ninad commented Mar 13, 2026

I noticed Copilot left a few suggestions. Should I go ahead and address those Copilot suggestions in this PR, or leave it as is?

I think the suggestions are useful

Done.

Signed-off-by: Ninad Kale <ninadkale200@gmail.com>
@1Ninad 1Ninad requested a review from acroca March 13, 2026 14:17
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.

[FEATURE REQUEST] support actor reminder failure policy

3 participants