Skip to content

fix(tasks): add domain support to TaskSchedule and fix related href r…#1308

Draft
git-hyagi wants to merge 1 commit into
pulp:mainfrom
git-hyagi:patch-taskschedule-domain-issue
Draft

fix(tasks): add domain support to TaskSchedule and fix related href r…#1308
git-hyagi wants to merge 1 commit into
pulp:mainfrom
git-hyagi:patch-taskschedule-domain-issue

Conversation

@git-hyagi

@git-hyagi git-hyagi commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

…endering

Patches pulpcore to make TaskSchedule domain-aware (unique per name+domain) and fixes RelatedField rendering wrong domain in hrefs. Updates the Lightwell sync schedule to dispatch in the lightwell domain and cleans up stale schedules from the default domain.

ref: https://redhat.atlassian.net/browse/PULP-1992

Summary by Sourcery

Add domain awareness to scheduled Lightwell sync tasks and patch pulpcore to support domain-scoped task schedules and correct domain href rendering.

Bug Fixes:

  • Ensure RelatedField hrefs are rendered with the correct domain.
  • Remove stale Lightwell sync schedules created in the default domain before domain support was added.

Enhancements:

  • Scope the Lightwell sync TaskSchedule to the lightwell domain and make TaskSchedule entries unique per name and domain.
  • Apply pulpcore patches to add domain support to TaskSchedule and fix domain handling in RelatedField rendering via the Docker image build.

…endering

Patches pulpcore to make TaskSchedule domain-aware (unique per name+domain)
and fixes RelatedField rendering wrong domain in hrefs. Updates the Lightwell
sync schedule to dispatch in the lightwell domain and cleans up stale
schedules from the default domain.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds domain awareness to TaskSchedule and Lightwell sync scheduling, and patches pulpcore to ensure TaskSchedules are unique per (name, domain) and RelatedField hrefs use the correct domain.

Sequence diagram for lightwell_sync_schedule domain-aware scheduling

sequenceDiagram
    participant Scheduler as lightwell_sync_schedule
    participant DomainModel as Domain
    participant TaskScheduleModel as TaskSchedule

    Scheduler->>DomainModel: objects.get(name="lightwell")
    alt [Domain exists]
        Scheduler->>TaskScheduleModel: objects.filter(name=name)
        Scheduler->>TaskScheduleModel: exclude(pulp_domain=lightwell_domain)
        Scheduler->>TaskScheduleModel: delete()
        Scheduler->>TaskScheduleModel: objects.update_or_create(name=name, pulp_domain=lightwell_domain)
    else [Domain.DoesNotExist]
        Scheduler-->>Scheduler: return
    end
Loading

Entity relationship diagram for TaskSchedule domain support

erDiagram
    Domain {
        int id
        string name
    }

    TaskSchedule {
        int id
        string name
        int pulp_domain_id
    }

    Domain ||--o{ TaskSchedule : pulp_domain

    TaskSchedule }o--o{ TaskSchedule : name_pulp_domain_unique
Loading

File-Level Changes

Change Details Files
Make Lightwell sync schedule domain-aware and clean up stale default-domain schedules.
  • Import Domain model to resolve the lightwell domain before scheduling.
  • Guard scheduling logic by returning early if the lightwell domain does not exist.
  • Delete any existing TaskSchedule entries with the Lightwell schedule name that are not in the lightwell domain to clean up pre-domain schedules.
  • Update or create the Lightwell TaskSchedule scoped to the lightwell domain, with the same task name and dispatch interval.
pulp_service/pulp_service/app/tasks/util.py
Apply pulpcore patches to add domain support to TaskSchedule and fix RelatedField href domain rendering.
  • Add patch 0059 to pulpcore installation to introduce domain support to TaskSchedule, likely making schedules unique per (name, domain).
  • Add patch 0060 to pulpcore installation to fix RelatedField href generation so that links are rendered with the correct domain context.
  • Ensure both patches are copied into the image and applied during Docker image build.
Dockerfile
images/assets/patches/0059-Add-domain-support-to-TaskSchedule.patch
images/assets/patches/0060-Fix-RelatedField-rendering-wrong-domain-in-hrefs.patch

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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