Skip to content

Conversation

@danfimov
Copy link
Contributor

Fixed issues:

  • When labels are passed inside schedule, the ScheduledTask.labels field contained a recursive structure - discussion;
  • When a user provided schedule_id inside schedule, it was always replaced with a random UUID.

Also deleted duplicated tests: tests/schedule_sources/test_label_based.py are literally the same as in tests/scheduler/test_label_based_sched.py.

@Copilot Copilot AI review requested due to automatic review settings October 22, 2025 19:25
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

This PR fixes two issues in the LabelScheduleSource class related to schedule discovery: preventing recursive dictionary structures in task labels when labels are passed within schedules, and preserving user-provided schedule_id values instead of always overwriting them with random UUIDs. The fix involves deep copying task labels and excluding the schedule key to avoid recursion, and respecting user-provided schedule IDs.

Key changes:

  • Modified label handling in LabelScheduleSource.startup() to deep copy task labels and remove the schedule key before merging
  • Updated schedule ID generation to use user-provided schedule_id when available
  • Removed duplicate test file and enhanced existing tests with new test cases

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
taskiq/schedule_sources/label_based.py Fixed recursive label structure by deep copying and filtering task labels, and preserved user-provided schedule IDs
tests/scheduler/test_label_based_sched.py Added test cases for labels inside schedules and custom schedule IDs, plus verification that original task labels remain unchanged
tests/schedule_sources/test_label_based.py Deleted duplicate test file

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@danfimov danfimov force-pushed the fix-recursive-dict-in-labels branch from 8547085 to db06ba1 Compare October 22, 2025 19:31
s3rius
s3rius previously approved these changes Oct 22, 2025
@s3rius s3rius merged commit 392a02d into taskiq-python:master Oct 23, 2025
33 checks passed
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.

2 participants