fix(bulk-operations): chunk CS Assets bulk delete/move to the 100-item API cap (DX-9732)#297
Open
naman-contentstack wants to merge 1 commit into
Open
fix(bulk-operations): chunk CS Assets bulk delete/move to the 100-item API cap (DX-9732)#297naman-contentstack wants to merge 1 commit into
naman-contentstack wants to merge 1 commit into
Conversation
…m API cap (DX-9732)
CS Assets bulk delete/move sent the entire asset array in one POST, so any
request over 100 items failed with HTTP 422 "Assets cannot exceed the max
limit of 100." — blocking bulk deletes of >100 assets entirely.
- CSAssetsAdapter.bulkDeleteAssets/bulkMoveAssets now split the payload into
<=100-item batches (CS_ASSETS_BULK_MUTATE_MAX_ITEMS) dispatched with bounded
concurrency (makeConcurrentCall) and per-batch retry (429/5xx; 4xx not retried).
- Continue-on-partial-failure: failed batches are collected, not rethrown, since
each request commits independently. Aggregate carries job_ids, batch counts,
and per-batch failures (with the failed uids).
- postJson throws a typed CsAssetsPostError carrying HTTP status (no error-string
parsing).
- Runner reports partial outcomes, writes failed uids to a {"uids":[...]} file in
the bulk-operation log folder for re-run via --asset-uids-file, and states that
a submitted delete job is submission (not completion) since delete is async.
Tests: adapter chunking/partial-failure/uid-capture; runner partial-failure file write.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.
Problem
DX-9732:
cm:stacks:bulk-assets --operation deletefails with HTTP 422 when the asset-uids file has >100 entries:The adapter sent the entire asset array in one POST. The CS Assets bulk delete/move endpoints cap each request at 100 items, so any bulk delete over 100 assets was completely blocked with no CLI workaround.
bulkMoveAssetshad the same shape.Fix
Chunk to the cap and dispatch the batches — the publish-side
QueueManagerwas the wrong tool (SDK/CMS-auth coupled; the delete path deliberately skips that pipeline), so this reuses the asset-management adapter's own concurrency primitives.CSAssetsAdapter.bulkDeleteAssets/bulkMoveAssetssplit the payload into ≤100-item batches (CS_ASSETS_BULK_MUTATE_MAX_ITEMS) via a shareddispatchBulkMutateBatches, dispatched with bounded concurrency (makeConcurrentCall) and per-batch retry (postJson({retry:true})— 429/5xx retried, 4xx like the 422 cap not).job_ids,notices,batchesTotal,batchesSucceeded, andfailures[]({batchIndex, count, status, error, uids}).postJsonthrowsCsAssetsPostErrorcarrying the HTTP status — no error-string parsing.{"uids":[...]}file in the bulk-operation log folder, and prints a re-run hint (--asset-uids-file). No--retry-failed(CMS-only). Delete messaging states a submitted job is submission, not completion (delete is async).Testing
contentstack-asset-management: 245 passing — adapter chunking (250→3 batches ≤100), partial-failure aggregation, failed-uid capture.contentstack-bulk-operations: 831 passing — service aggregate mapping, runner partial-failure file write.🤖 Generated with Claude Code