Skip to content

Materialize notification rules before serialization - #704

Merged
ffumero2003 merged 1 commit into
masterfrom
fix-py-rules-list
Nov 21, 2026
Merged

ffumero2003 merged 1 commit into
masterfrom
fix-py-rules-list

Conversation

@ffumero2003

Copy link
Copy Markdown
Contributor

Context

Bucket.set_notification_rules is typed as accepting any iterable, but a generator or set failed during JSON serialization of the request.

Changes

Materialize list(rules) before sending the request.

Verification

Generator and set regressions (red before, green after). v2/v3 bucket suites, static tests, towncrier check pass.

Refs #703

@ffumero2003 ffumero2003 self-assigned this Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Bucket.set_notification_rules now converts the supplied rules iterable to a list before calling the session method. Regression tests cover a one-rule generator and an empty set, and check the serialized JSON arrays. The changelog documents support for notification rules supplied as any iterable.

Merge Risk: Minimal · up to b2f10

Bucket.set_notification_rules now accepts any iterable, including generators and sets, which previously failed during request serialization. The change is small and tested, and no merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: notification rules are converted to a list before serialization, which fixes failures with generator or set inputs. The diff changes one line in Bucket.set_notificati…
Description check Passed The description explains the problem: set_notification_rules is typed to accept any iterable, but generators or sets fail during JSON serialization. It states the fix (list(rules) before sending), lis…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: notification rules are converted to a list before serialization, which fixes failures with generator or set inputs. The diff changes one line in Bucket.set_notification_rules to call list(rules), so the title matches the changeset.

Full details: Description check

Explanation

The description explains the problem: set_notification_rules is typed to accept any iterable, but generators or sets fail during JSON serialization. It states the fix (list(rules) before sending), lists the regression tests and the checks run, and references issue #703. This matches the changeset.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e9d4a0ad-33ce-4b92-9886-07fc966ef0c3
Commits

Reviewing files that changed from the base of the PR and between 03b99b3 and b2f10bc.

Files selected for processing: 3

  • b2sdk/_internal/bucket.py
  • changelog.d/+notification-rule-iterables.fixed.md
  • test/unit/bucket/test_regression_bucket.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@ffumero2003
ffumero2003 merged commit 84ce6f5 into master Nov 21, 2026
29 checks passed
@ffumero2003
ffumero2003 deleted the fix-py-rules-list branch November 21, 2026 20:31
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