PROD-1506: create/update URL redirections on sync/push with ID mappings#186
Merged
Conversation
URL redirections were downloaded on pull (via the Content Sync SDK) but never
pushed to the target. Add a full push path using the new Management API batch
endpoint POST /api/v1/instance/{guid}/url-redirections (up to 250 per request,
one transaction per request; items without a urlRedirectionID are created,
items with one are updated).
- New "UrlRedirections" element, included in the default --elements list and
registered as a guid-level push operation. Runs after Containers and BEFORE
Templates: the template pusher deliberately throws on mapping
inconsistencies, which aborts the rest of the guid-level loop, and
dependency-free redirections must not be collateral damage of that stop.
- Pusher diffs pulled source vs target items directly (redirections carry no
modifiedOn): mapped+identical -> skip, mapped+different -> update,
same origin URL without mapping -> map-on-adopt, otherwise -> create.
A mapped redirect deleted on the target is re-created. Deletes do not
propagate (consistent with the other pushers).
- Creates and updates are sent together in batches of 250; the per-item
response indexes are used to write sourceUrlRedirectionID ->
targetUrlRedirectionID rows to a new central mapping file
(mappings/{source}-{target}/urlredirections/mappings.json). API-side skips
(validation/origin collisions) are logged with their reason. A failed batch
marks only that batch failed and continues.
- Full --preflight support under a "URL Redirections" phase; mapping writes
stay behind the existing preflight hard guard.
- New urlRedirection log namespace; README and --help updated.
- Tests: 47 new tests across getter, mapper, API caller, and pusher.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5PK
approved these changes
Jul 15, 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.
Summary
URL redirections were downloaded on pull (via the Content Sync SDK) but never pushed to the target. This adds a full create/update push path with source→target ID mappings, using the new Management API batch endpoint:
POST /api/v1/instance/{guid}/url-redirections— accepts up to 250 redirections per request (one transaction per request). Items without aurlRedirectionIDare created; items with one are updated (full replace). Per-item results come back grouped intocreated/updated/skipped.How it works
UrlRedirectionselement, included in the default--elementslist and registered as a guid-level push operation. It runs after Containers and before Templates — the template pusher deliberately throws on mapping inconsistencies (rename protection), which aborts the rest of the guid-level loop, and dependency-free redirections must not be collateral damage of that stop.modifiedOn): mapped + identical → skip; mapped + different → update; same origin URL without a mapping → map-on-adopt (self-heal, consistent with galleries/models); otherwise → create. A mapped redirect deleted on the target is re-created. Deletes do not propagate (consistent with all other pushers).index(position within that request's payload) is used to writesourceUrlRedirectionID → targetUrlRedirectionIDrows to a new central mapping file atagility-files/mappings/{source}-{target}/urlredirections/mappings.json. API-side skips (validation failures / origin URL collisions) are logged with their reason. A failed batch marks only its own items failed and the run continues with the next batch; re-runs self-heal via the diff + map-on-adopt.id/statusCode; the payload sendsurlRedirectionID/httpCode.--preflightsupport under a "URL Redirections" phase; mapping writes remain behind the existing preflight hard guard.@agility/management-sdkyet, sourl-redirection-api.tscalls it directly with the same token/base-URL resolution the SDK client uses.Behavior notes
agility syncnow pushes redirections by default (they were already always downloaded). Scope with--elementsto exclude them.