Skip to content

CMG-1057, CMG-1058 | Language Mapper and Locale Migration Fixes#1108

Open
chetan-contentstack wants to merge 4 commits into
devfrom
bugfix/cmg-1057-1058-locale-fix
Open

CMG-1057, CMG-1058 | Language Mapper and Locale Migration Fixes#1108
chetan-contentstack wants to merge 4 commits into
devfrom
bugfix/cmg-1057-1058-locale-fix

Conversation

@chetan-contentstack

Copy link
Copy Markdown

🔗 Jira Ticket

CMG-1057 · CMG-1058


📋 PR Type

  • ✨ Feature
  • 🐛 Bug Fix
  • 🔥 Hotfix
  • ♻️ Refactor
  • 🧹 Chore / Dependency Update
  • 📝 Documentation

📝 Description

What changed?

CMG-1057 — Language mapper (Step 2) fixes for delta restart:

  • Already-mapped locales no longer appear as selectable options in dropdowns on restart iteration
  • Add Language button no longer gets stuck disabled after adding one language — now stays available until all source locales are mapped
  • Newly-added rows in a restart iteration remain editable until the user advances past Step 2, so a wrong selection can be corrected without being locked immediately

CMG-1058 — Delta migration correctness and UI fixes:

  • New locales added in a delta iteration now correctly localize existing Contentstack entries rather than creating duplicate new entries
  • Entry mapper Save button is now visible whenever there is table data, not only when total counts are non-zero
  • Entry mapper footer is sticky so the Save button is not clipped below the viewport
  • Step 1 → Step 3 skip guard tightened to also require all source locales to be mapped, preventing Step 2 (locale mapping) from being bypassed

Why?

On a delta restart with extra locales added, the language mapper was showing already-consumed locales in dropdowns and blocking the user from adding more than one new language. On migration, new-locale entries were being imported as fresh entries (new UIDs) instead of being added as localizations to the entries created in the first iteration, breaking the localization relationship entirely.


🧩 Affected Areas

  • api — Node.js backend
  • ui — React frontend
  • upload-api — Upload API server
  • docker / docker-compose
  • CI / GitHub Actions workflows
  • Environment variables / config

🧪 How to Test

CMG-1057:

  1. Complete a first iteration with only the master locale mapped
  2. Start a second iteration (restart) on Step 2
  3. Verify already-mapped locales do not appear in source/destination dropdowns
  4. Add two new languages — verify the Add Language button stays enabled after the first addition
  5. Select both dropdowns for a newly added row — verify the row stays editable (not immediately disabled) so you can correct a wrong pick

CMG-1058:

  1. Run a first iteration migration with only the master locale
  2. Start a second iteration, add two new locales on Step 2, and complete the migration
  3. In Contentstack, verify the entries from iteration 1 now have localizations in the two new locales (same UIDs as the master locale entries, not new UIDs)
  4. On the entry mapper step, verify the Save button is visible and the footer does not disappear below the viewport

Expected result: No duplicate entries created for new locales; existing entries gain locale variants. Language mapper dropdowns filter correctly and rows remain editable until saved.


📸 Screenshots / Recordings

Before After
Already-mapped locales visible in dropdown Mapped locales filtered out
Add Language disabled after one addition Button stays enabled for additional locales
New-locale migration creates new entries (different UIDs) New-locale migration localizes existing entries (same UIDs)

🔗 Related PRs / Dependencies


✅ Author Checklist

  • Branch follows naming convention: feature/, bugfix/, or hotfix/ + 5–30 lowercase chars
  • Jira ticket linked above
  • Self-reviewed the diff — no debug logs, commented-out code, or TODOs left in
  • .env / example.env updated if new environment variables were added
  • No sensitive credentials or secrets committed
  • Existing tests pass locally (npm test)
  • New tests written (or not applicable — explain why)
  • README.md / docs updated if behaviour changed
  • Talisman pre-push scan passes (no secrets flagged)

👀 Reviewer Notes

  • The core backend change is in api/src/utils/entry-update.utils.ts — the removeEntriesFromDatabase function previously skipped new-locale directories entirely (continue), leaving their entries in the import data for the CLI to create as fresh entries. It now falls through and routes any entry with a known Contentstack UID into the localize path (entriesToUpdate), removing it from import data to prevent duplication.
  • All language mapper locking logic is in LoadLanguageMapper.tsx. The key invariant: locale.value is only set on rows rebuilt from a prior iteration's saved mapping; newly-added rows always have value = '', so isDisabled && !!locale.value correctly locks only rebuilt rows.

Migration v2 · Docs · Issues

CMG-1057: fix already-mapped locales appearing in dropdowns on restart,
Add Language button stuck disabled after one addition, and rows locking
prematurely before user advances past step 2.

CMG-1058: route new-locale entries through localize path instead of
creating duplicate entries; fix save button visibility and sticky footer
in entry mapper; tighten step-1→step-3 skip guard to require all source
locales mapped before bypassing step 2.
@chetan-contentstack chetan-contentstack self-assigned this Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 1 0 10 ✅ Passed
🟠 High Severity 2 382 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 1 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 382
  • Medium without fixes: 0
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@chetan-contentstack chetan-contentstack marked this pull request as ready for review July 3, 2026 14:48
@chetan-contentstack chetan-contentstack requested a review from a team as a code owner July 3, 2026 14:48
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 1 0 10 ✅ Passed
🟠 High Severity 2 382 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 1 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 382
  • Medium without fixes: 0
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens the delta-restart locale-mapping flow in the UI (preventing users from bypassing Step 2 when mappings are incomplete) and fixes backend delta behavior so newly-added locales localize existing entries instead of importing duplicates.

Changes:

  • UI: Strengthens Step 1 → Step 3 skip logic to require a complete source-locale mapping and improves language-mapper restart behavior (filtering/locking/editability).
  • UI: Makes Entry Mapper’s Save/footer reliably visible and adjusts Save disabling to reflect actual migration execution state.
  • API: Routes entries for newly-added delta locales through the localize/update path (when CS UID exists) to prevent duplicate entry creation.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ui/src/pages/Migration/index.tsx Tightens Step skip guard to avoid bypassing locale mapping on non-restart flows.
ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx Fixes delta-restart mapper option filtering, row locking/editability, and rehydration edge cases.
ui/src/components/ContentMapper/index.scss Makes the Entry Mapper footer sticky so Save remains reachable.
ui/src/components/ContentMapper/entryMapper.tsx Shows footer based on table data presence and disables Save only while migration is actively running.
api/src/utils/entry-update.utils.ts Ensures new-locale delta entries with existing CS UIDs are localized/updated instead of re-created.
.gitignore Adds additional ignored output directories.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/src/pages/Migration/index.tsx Outdated
Comment thread ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx Outdated
Comment thread ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx Outdated
- allSourceLocalesMapped: verify each source locale exists in mapped
  values instead of comparing raw counts (filters out placeholder keys
  like UNMAPPED_LOCALE_KEY and prevents duplicates from inflating count)
- LoadLanguageMapper: remove dead savedKey/savedValue/isRowSaved vars
- LoadLanguageMapper: fix recentMsterLocale typo -> recentMasterLocale
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 1 0 10 ✅ Passed
🟠 High Severity 2 382 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 1 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 382
  • Medium without fixes: 0
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 1 0 10 ✅ Passed
🟠 High Severity 2 382 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 1 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 382
  • Medium without fixes: 0
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants