Skip to content

PULP-2709: remove the scheduled Lightwell Python sync - #1719

Open
decko wants to merge 2 commits into
pulp:mainfrom
decko:pulp-2709-disable-lightwell-sync
Open

decko wants to merge 2 commits into
pulp:mainfrom
decko:pulp-2709-disable-lightwell-sync

Conversation

@decko

@decko decko commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Removes the daily scheduled sync that pulled the trusted-libraries remote into the lightwell domain's python-validated-landing repository (PULP-2709, follow-up to PULP-1871 / #1277).

  • Drop lightwell_sync_schedule() from app/tasks/util.py and its post_migrate registration in app/signals.py.
  • Delete app/tasks/lightwell_period_sync.py and tests/unit/test_lightwell_period_sync.py.
  • New migration service.0027_remove_lightwell_sync_schedule.py deletes the existing TaskSchedule row.
  • CHANGES/2709.removal; dropped the module from docs/ARCHITECTURE.md.

Why a migration

Dropping the post_migrate receiver stops new registrations, but stage and prod already have the TaskSchedule row from prior rollouts, and pulpcore's scheduler keeps dispatching whatever is in the table. The data migration removes the row; its reverse recreates it, so rolling back the image also restores the schedule.

Validation

  • ruff format --check clean on touched files; no ruff findings in them.
  • make lint on upstream/main still reports 16 pre-existing findings in unrelated test files (unused noqa directives).
  • Not run: pytest (no dev venv / oci-env container available in this environment). The removed unit tests only covered the deleted task.

After merge

Migration runs on the next rollout; the schedule stops dispatching then. No app-interface change required.

Summary by Sourcery

Remove the scheduled Lightwell Python repository synchronization and clean up its existing scheduler entry.

Enhancements:

  • Remove the obsolete Lightwell-to-Trusted Libraries Python synchronization task and its scheduled registration.
  • Delete the persisted Lightwell schedule during migration, with rollback support to restore it.

Documentation:

  • Remove the deleted Lightwell synchronization task from the architecture documentation.

Chores:

  • Record the Lightwell synchronization removal in the changelog.

The daily TaskSchedule that synced the lightwell domain's
python-validated-landing repository from the trusted-libraries remote is
no longer wanted.

- Drop lightwell_sync_schedule() and its post_migrate registration.
- Remove the task module and its unit tests.
- Migration service.0027 deletes the existing TaskSchedule row, since
  dropping the receiver alone leaves already-migrated environments
  dispatching the task forever. Reverse restores the row for rollback.

Assisted-by: Pi
@decko decko added the ai-assisted Changes assisted by AI label Nov 23, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Schema and migrations

Add a reversible migration that removes existing Lightwell sync schedules, matching by schedule name or task name so renamed schedules are removed too.

  • pulp_service/pulp_service/app/migrations/0027_remove_lightwell_sync_schedule.py L1-45

Implementation

Remove the Lightwell sync task and the code that registered its daily schedule.

  • pulp_service/pulp_service/app/signals.py L32 (removed lines), L39 (removed lines)
  • pulp_service/pulp_service/app/tasks/lightwell_period_sync.py (deleted)
  • pulp_service/pulp_service/app/tasks/util.py L62 (removed lines)

Documentation

Update the changelog and architecture documentation to record the removal of the Lightwell sync task.

  • CHANGES/2709.removal L1
  • docs/ARCHITECTURE.md L311 (removed lines)

Tests

Remove the unit tests for the deleted Lightwell sync task.

  • pulp_service/pulp_service/tests/unit/test_lightwell_period_sync.py (deleted)

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="pulp_service/pulp_service/app/migrations/0027_remove_lightwell_sync_schedule.py" line_range="14" />
<code_context>
+    keeps dispatching whatever is in the table.
+    """
+    TaskSchedule = apps.get_model("core", "TaskSchedule")
+    TaskSchedule.objects.filter(name=SCHEDULE_NAME).delete()
+
+
</code_context>
<issue_to_address>
**Renamed sync keeps running**

When an operator previously changed the TaskSchedule name without changing its task name, the migration misses the renamed row, so the scheduler continues dispatching its `python_repository_sync` task name after the module is deleted; those tasks fail on new-image workers and the obsolete schedule remains active.

Delete the obsolete schedule by its task name as well as its original name.
</issue_to_address>

### Comment 2
<location path="pulp_service/pulp_service/app/migrations/0027_remove_lightwell_sync_schedule.py" line_range="14" />
<code_context>
+    keeps dispatching whatever is in the table.
+    """
+    TaskSchedule = apps.get_model("core", "TaskSchedule")
+    TaskSchedule.objects.filter(name=SCHEDULE_NAME).delete()
+
+
</code_context>
<issue_to_address>
**Dispatched syncs fail during rollout**

When a Lightwell sync is dispatched shortly before or during the migration and remains queued until new-image workers handle it, `TaskSchedule.objects.filter(...).delete()` removes only the schedule row, not the dispatched task. New-image workers cannot resolve the removed task path and mark the queued sync failed; old workers can also run one more sync.

Drain or cancel dispatched Lightwell tasks before removing their task module.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 2 findings to address first, and the migration deletes the persisted schedule, so the Lightwell repository will stop receiving daily updates; reverting can restore the schedule, and a later sync can catch up, though content may remain stale until then.

Blocking findings: pulp_service/pulp_service/app/migrations/0027_remove_lightwell_sync_schedule.py:14, pulp_service/pulp_service/app/migrations/0027_remove_lightwell_sync_schedule.py:14


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Task schedules are editable through the REST API, so the row can be renamed
while still pointing at the removed task module. Deleting by name alone would
then leave it dispatching python_repository_sync every day forever, with each
dispatch failing on the new image. Match on task_name as well.

Assisted-by: Pi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted Changes assisted by AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant