fix(bulk-operations): publish only to scoped targets - #354
Open
naman-contentstack wants to merge 1 commit into
Open
fix(bulk-operations): publish only to scoped targets#354naman-contentstack wants to merge 1 commit into
naman-contentstack wants to merge 1 commit into
Conversation
Per-item environments/locales were collapsed into batch-level arrays, so every item inherited the batch union: backup-dir assets published to every environment found in the backup, and revert unpublished using the first log entry's environments. Batches are now keyed on (locale, environment set). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
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.
What
cm:stacks:bulk-assetspublished assets to environments and locales they werenever scoped to.
The bulk-publish API is a flat cross product —
{ items, environments, locales }expands server-side into one record per
(item × locale × environment). Per-itemtargets were computed and then collapsed into batch-level arrays, so every item in
a batch inherited the union of that batch.
Fix
Batches are keyed on
(locale, environment set), so the arrays sent equal thebatch's real scope.
--backup-dirassetsenvironments, unpublishing from environments it never reacheditems[0].publish_detailsfor the whole batchMulti-environment assets are unaffected: grouping is on the whole environment set,
so an asset in dev+prod still goes out in one request carrying both.
Entries keep
entry.localeas the resolution hint whilepublish_detailscarriesthe requested locale, so fallback-locale publishing still works.
Testing
backup-dir-asset-fetcher.test.ts— the module had zero coverage; includesthe regression case (a dev-only asset stays dev-only)
batch-helper.test.tspreviously asserted mixed-locale flattening as correct;that expectation is inverted