fix(import): preserve env-locale pairing for asset publish (DX-9772)#310
Open
naman-contentstack wants to merge 1 commit into
Open
fix(import): preserve env-locale pairing for asset publish (DX-9772)#310naman-contentstack wants to merge 1 commit into
naman-contentstack wants to merge 1 commit into
Conversation
publish() flattened each asset's publish_details into independent environments[] and locales[] arrays, so the CMA republished the cartesian product. For a ragged publish state (different locales on different environments) this over-published to env-locale pairs that never existed on the source stack. Add buildPublishGroups: group publish_details by environment, coalesce environments with an identical locale set, and emit one publish call per group so each call is a single rectangle the CMA reproduces exactly. A rectangular asset still collapses to one call (unchanged behavior). The DX-1656 invalid-environment guard is preserved (envs absent from the destination are still skipped). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
Consider reviewing these vulnerabilities when fixes become available. |
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
Asset publish (
ImportAssets.publish()) flattened each asset'spublish_detailsinto two independent arrays (environments[],locales[]) and handed them to the CMA publish endpoint, which republishes the cartesian product env × locale. For a ragged publish state (different locales on different environments) this over-published to env-locale pairs that never existed on the source stack — a silent over-publish (CLI reports success; destination gets extra combos).Fix
New
buildPublishGroupshelper: grouppublish_detailsby environment, coalesce environments that share an identical locale set, and emit one publish call per group — so each call is a single rectangle the CMA reproduces exactly. A fully-rectangular asset still collapses to a single call (unchanged behavior); only ragged assets fan out.Repro (verified)
Crafted a ragged legacy asset
bltf91eeb09ee37ef51=[production/en-us, preview/fr-fr]. Before: destination published to 4 pairs (phantomproduction/fr-fr,preview/en-us). After: exactly the 2 source pairs.Notes
publish()only (thisdevelopmenttrack). The AMpublishAmSpacespath carries the same flatten and is fixed separately onv2-dev; both will reconcile on backmerge (heads-up: the sharedbuildPublishGroupshelper will conflict as a duplicate — keep one copy).contentstack-bulk-operationshas the same flatten (DX-9484).Tests
assets.test.ts—buildPublishGroupsunit block (ragged→multi, rectangular→1, 1×1, DX-1656 env-drop, empty) + ragged regression throughpublish(). 69 passing.