feat(locations): add a cancel hook to the endpoints-to-locations backfill - #15701
Open
Maffooch wants to merge 1 commit into
Open
feat(locations): add a cancel hook to the endpoints-to-locations backfill#15701Maffooch wants to merge 1 commit into
Maffooch wants to merge 1 commit into
Conversation
…fill
The endpoints backfill can run for a long time. Add a cooperative
cancel_callback stealth option, polled at the chunk boundary next to the
existing progress hook, so an in-process caller (the Pro migration suite) can
stop the run cleanly between chunks. Chunks are separately committed and the
class is idempotent, so a cancelled run leaves a consistent, resumable state.
- cancel_callback() -> bool added to stealth_options and read in handle().
- _should_cancel() polled after _emit_progress at the chunk boundary; a raising
probe is treated as "keep going" so a transient error can't discard hours of
work.
- On cancel the run still applies tag inheritance for what it migrated and
reports {"cancelled": True} in the summary; CLI runs are unaffected.
Docs and the Pro changelog describe the new Cancel behaviour.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
blakeaowens
approved these changes
Aug 18, 2026
devGregA
approved these changes
Aug 18, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[sc-14596]
What
Adds a cooperative
cancel_callbackstealth option tomigrate_endpoints_to_locations, so an in-process caller can stop a long backfill cleanly at the next chunk boundary. This is the OSS half of adding Cancel + re-run to the Locations data-migration suite; the user-facing button lives in Pro and consumes this hook.Why
The endpoints backfill can run for a long time, and reportedly gets stuck with no way to stop it. There was no cancellation path in the command at all. Because each chunk is separately committed and the command is idempotent (it converges on re-run), stopping between chunks is safe and resumable.
How
cancel_callback() -> booladded tostealth_optionsand read inhandle(), alongside the existingprogress_callback/summary_callback._should_cancel()is polled at the chunk boundary, right after_emit_progress. A raising probe is treated as "keep going" (a transient error must not throw away hours of work), matching the existing swallow-and-continue convention for the other hooks.{"cancelled": True}in the summary so the caller can land the run as cancelled rather than completed.PRO__migrating_from_endpoints,PRO__feature_flags) and the Pro changelog (v3.2.300) describe the Cancel behaviour.Ordering
This must merge before the paired Pro PR: the Pro migration suite passes
cancel_callbackintocall_command, which raises on an unknown stealth option until this ships in the image the Pro build consumes.Testing
./run-unittest.sh --test-case unittests.test_migrate_endpoints_to_locations— 15/15 pass (4 new: cancel-between-chunks, re-run converges, raising probe doesn't abort, CLI path unchanged).manage.py checkandmakemigrations --checkclean; ruff clean.🤖 Generated with Claude Code