fix(import): preserve env-locale pairing for AM asset publish (DX-9772)#311
Open
naman-contentstack wants to merge 1 commit into
Open
fix(import): preserve env-locale pairing for AM asset publish (DX-9772)#311naman-contentstack wants to merge 1 commit into
naman-contentstack wants to merge 1 commit into
Conversation
publishAmSpaces flattened each asset's publish_details into independent environments[] and locales[] arrays, so the CMA republished the cartesian product. For a ragged AM publish state (different locales per environment) this over-published to env-locale pairs that never existed on the source. 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). Scope: AM (publishAmSpaces) only. The legacy publish() path carries the same flatten and will be fixed on development, then back-merged. 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
publishAmSpacesflattened each AM asset'spublish_detailsinto two independent arrays (environments[],locales[]) and handed them to the CMA publish endpoint, which republishes the cartesian product env × locale. AM 2.0 assets are published per-(env,locale) independently, so their publish state is routinely ragged — and the flatten then over-publishes to env-locale pairs that never existed on the source stack (silent: CLI reports success).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 one call (unchanged behavior + request count); only ragged assets fan out.Repro (verified)
pub-check-stackassetam3bd5a226c4fb7c95=[new/en-us, new/ar, blt5795/en-us]. Before: flatten → envs[new, blt5795]× locales[en-us, ar]→ phantomblt5795/ar. After: two calls —{new: [en-us, ar]},{blt5795: [en-us]}, no phantom.Notes
publishAmSpacesonly (thisv2-devtrack). The legacypublish()path carries the same flatten and is fixed ondevelopment(PR fix(import): preserve env-locale pairing for asset publish (DX-9772) #310); it will reconcile here on backmerge. Heads-up: that backmerge will conflict on the sharedbuildPublishGroupshelper (already present here) — keep one copy and let the legacypublish()edits land.contentstack-bulk-operationshas the same flatten (DX-9484).Tests
assets.test.ts— addedbuildPublishGroupsunit block (ragged→multi, rectangular→1, 1×1, DX-1656 env-drop, empty). 75 passing.