diff --git a/api/src/services/aem.service.ts b/api/src/services/aem.service.ts index 2996e608..d217a408 100644 --- a/api/src/services/aem.service.ts +++ b/api/src/services/aem.service.ts @@ -1363,8 +1363,11 @@ const createEntry = async ({ const entryMapping: Record = {}; const usedEntryUids = new Set(); - // Process each entry file - for await (const fileName of read(entriesDir)) { + // Process each entry file. Sorted (not raw fs-readdir-recursive order) so that when two + // files legitimately collide on the same modelId+locale (see CMG-1112), which one "wins" + // and gets migrated is deterministic and reproducible across machines/runs, rather than + // depending on filesystem directory order. + for await (const fileName of [...read(entriesDir)].sort()) { const filePath = path.join(entriesDir, fileName); if (filePath?.startsWith?.(damPath)) { continue; @@ -1373,23 +1376,6 @@ const createEntry = async ({ if (typeof content === 'string') { const parseData = JSON.parse(content); - // AEM can export a page TEMPLATE's own structure/schema definition (e.g. - // /conf/.../settings/wcm/templates/