Repository navigation
Conversation
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
Reviewer's GuideSchema and migrationsAdd a reversible migration that removes existing Lightwell sync schedules, matching by schedule name or task name so renamed schedules are removed too.
ImplementationRemove the Lightwell sync task and the code that registered its daily schedule.
DocumentationUpdate the changelog and architecture documentation to record the removal of the Lightwell sync task.
TestsRemove the unit tests for the deleted Lightwell sync task.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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
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
Summary
Removes the daily scheduled sync that pulled the
trusted-librariesremote into thelightwelldomain'spython-validated-landingrepository (PULP-2709, follow-up to PULP-1871 / #1277).lightwell_sync_schedule()fromapp/tasks/util.pyand itspost_migrateregistration inapp/signals.py.app/tasks/lightwell_period_sync.pyandtests/unit/test_lightwell_period_sync.py.service.0027_remove_lightwell_sync_schedule.pydeletes the existingTaskSchedulerow.CHANGES/2709.removal; dropped the module fromdocs/ARCHITECTURE.md.Why a migration
Dropping the
post_migratereceiver stops new registrations, but stage and prod already have theTaskSchedulerow 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 --checkclean on touched files; no ruff findings in them.make lintonupstream/mainstill reports 16 pre-existing findings in unrelated test files (unusednoqadirectives).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:
Documentation:
Chores: