Skip to content

CMG-1108 | WordPress delta assets not showing on Map Entry Assets screen - #1143

Merged
umesh-more-cstk merged 4 commits into
devfrom
bugfix/cmg-1108-1109-wordpress-delta
Aug 11, 2026
Merged

CMG-1108 | WordPress delta assets not showing on Map Entry Assets screen#1143
umesh-more-cstk merged 4 commits into
devfrom
bugfix/cmg-1108-1109-wordpress-delta

Conversation

@chetan-contentstack

@chetan-contentstack chetan-contentstack commented Aug 10, 2026

Copy link
Copy Markdown

🔗 Jira Tickets


📋 PR Type

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

📝 Description

What changed?

  • extractAssets.ts — WordPress asset extraction tagged each asset's otherCmsAssetUid with the bare wp:post_id (e.g. "301"), but the CLI import stages that same asset under assets_301 and writes its resolved Contentstack uid back into uid-mapping.json under that prefixed key. The mismatch meant a WordPress asset's uid could never resolve, so on delta iterations (2+) — where the Map Entry Assets screen only showed rows with a resolved uid — every previously-migrated WordPress asset silently disappeared from the screen, even though it had migrated successfully. Fixed by prefixing otherCmsAssetUid with assets_ to match the CLI's key.
  • contentMapper.service.ts — separately, the Map Entry Assets screen filtered out brand-new (never-before-migrated) assets on iteration 2+ entirely, while the equivalent Map Entry (entries) screen always shows new and updated items together. Removed that filter so assets behave the same as entries. This logic is shared and CMS-agnostic, so it applies uniformly to WordPress, Drupal, Contentful, AEM, and Sitecore.

Why?

Reported in CMG-1108: assets added in a WordPress delta migration's second iteration were confirmed present in the destination stack but never appeared in the review UI, with no way to tell they'd migrated. Root-caused via a real test project's on-disk uid-mapper.json and CLI staging output (the initial static-analysis theory needed live confirmation — see PR discussion). While fixing it, confirmed the asset screen's "hide brand-new items" behavior was inconsistent with the entries screen and had no equivalent justification, so aligned the two.


🧩 Affected Areas

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

🧪 How to Test

  1. Reproduce (pre-fix): run a WordPress migration iteration 1 with an asset (wp:post_type=attachment) that gets a real Contentstack uid, then re-export the same asset in an iteration 2 WXR file and run the delta migration. Check Map Entry Assets on iteration 2 — the asset is missing, despite being visible in the destination stack's Assets list.
  2. Verify (post-fix): same steps — the asset now appears on Map Entry Assets, correctly resolved to its existing Contentstack uid.
  3. Brand-new asset visibility: add a second, genuinely new attachment item to the iteration-2 file only. Confirm it now also shows up in the list after migrating (previously it would upload silently with no row).
  4. cd api && npx vitest run tests/unit — 743/743 passing.
  5. cd upload-api && npx vitest run — 302/302 passing.

Expected result: WordPress assets correctly resolve their prior Contentstack uid on delta iterations, and the Map Entry Assets screen shows every asset (new and previously-migrated) consistently with how entries already display.


📸 Screenshots / Recordings

Before After

🔗 Related PRs / Dependencies

  • Same Delta Migration subsystem as #1136 (CMG-1101) and #1140 (CMG-1100) — no code dependency, opened as a standalone fix against dev.
  • CMG-1109 (taxonomy) was investigated in the same session but could not be reproduced with test fixtures — taxonomy creation and entry-tagging both worked correctly in testing. Left open pending the original WordPress export or more detail from the reporter.

✅ Author Checklist

  • Branch follows naming convention: bugfix/cmg-1108-1109-wordpress-delta
  • Jira ticket(s) linked above
  • Self-reviewed the diff
  • .env / example.env updated — N/A
  • No secrets committed
  • Existing tests pass (npx vitest run tests/unit in api/ — 743/743, npx vitest run in upload-api/ — 302/302)
  • New tests written — added a test pinning "brand-new assets shown on iteration 2+" in contentMapper.service.test.ts
  • README.md / docs updated — N/A
  • Talisman pre-push scan passes

👀 Reviewer Notes

  • Two commits, kept separate on purpose: the first is the actual root-cause bug fix (uid mismatch); the second is a related but distinct behavior change (removing the delta-iteration display filter) that came out of discussing why the first bug's filter existed at all. Happy to split into two PRs if preferred.
  • The uid mismatch was only confirmed by inspecting a real test project's uid-mapper.json and CLI-staged asset files on disk — reading the extraction/write code alone made it look plausible but not provably broken, since the two functions that produce/consume the uid live in different files (extractAssets.ts vs wordpress.service.ts).
  • CMG-1109 is referenced here only because it shared a branch during investigation — no taxonomy code was changed in this PR.

chetan-contentstack added 2 commits August 10, 2026 16:52
…ing key

extractAssets used the bare wp:post_id as otherCmsAssetUid, but the CLI
import stages assets under assets_<post_id>. The mismatch meant WordPress
asset uids never resolved, so migrated assets vanished from the Map Entry
Assets screen on delta iterations.
Assets were hidden on iteration 2+ unless already migrated, unlike entries
which always show new and updated items together. Removes that filter so
both screens behave consistently across all CMS connectors.
@chetan-contentstack
chetan-contentstack requested a review from a team as a code owner August 10, 2026 11:22
@snyk-io

snyk-io Bot commented Aug 10, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@chetan-contentstack chetan-contentstack self-assigned this Aug 10, 2026
@github-actions

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 0 0 10 ✅ Passed
🟠 High Severity 16 378 25 ✅ Passed
🟡 Medium Severity 19 11 500 ✅ Passed
🔵 Low Severity 2 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

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

🟠 High Severity - SLA Breached Issues (with fixes)

Showing 2 issue(s) that have exceeded the 30-day SLA threshold:

  1. Inefficient Algorithmic Complexity

    • ID: SNYK-JS-IMMUTABLE-17900558
    • Package: immutable@5.1.5
    • Published: 32 days ago (SLA: 30 days)
    • CVSS Score: 8.7
    • CVE: CVE-2026-59880
  2. Integer Overflow or Wraparound

    • ID: SNYK-JS-IMMUTABLE-17900573
    • Package: immutable@5.1.5
    • Published: 32 days ago (SLA: 30 days)
    • CVSS Score: 8.7
    • CVE: CVE-2026-59879

ℹ️ 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: 378
  • Medium without fixes: 11
  • Low without fixes: 0

❌ BUILD FAILED - Security checks failed

Please review and fix the security vulnerabilities before merging.

@chetan-contentstack chetan-contentstack changed the title fix(CMG-1108): WordPress delta assets not showing on Map Entry Assets screen CMG-1108 | WordPress delta assets not showing on Map Entry Assets screen Aug 10, 2026
@umesh-more-cstk
umesh-more-cstk requested a balanced review from Copilot August 10, 2026 11:42

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

Fixes delta-migration asset visibility and UID resolution.

Changes:

  • Aligns WordPress asset mapping IDs with CLI UID keys.
  • Displays new and existing assets on later iterations.
  • Adds coverage for iteration 2+ asset visibility.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
upload-api/migration-wordpress/libs/extractAssets.ts Prefixes WordPress asset UIDs.
api/src/services/contentMapper.service.ts Removes delta asset filtering.
api/tests/unit/services/contentMapper.service.test.ts Tests new-asset visibility.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread upload-api/migration-wordpress/libs/extractAssets.ts
cs_failed.json write on a failed WordPress attachment download used the
bare wp:post_id instead of customId (assets_<wp:post_id>), which is the
only key getAssetMapping looks up via otherCmsAssetUid. Failed WordPress
attachments were silently reported as "ok" instead of "failed".
@github-actions

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 0 0 10 ✅ Passed
🟠 High Severity 16 378 25 ✅ Passed
🟡 Medium Severity 19 11 500 ✅ Passed
🔵 Low Severity 2 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

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

🟠 High Severity - SLA Breached Issues (with fixes)

Showing 2 issue(s) that have exceeded the 30-day SLA threshold:

  1. Inefficient Algorithmic Complexity

    • ID: SNYK-JS-IMMUTABLE-17900558
    • Package: immutable@5.1.5
    • Published: 32 days ago (SLA: 30 days)
    • CVSS Score: 8.7
    • CVE: CVE-2026-59880
  2. Integer Overflow or Wraparound

    • ID: SNYK-JS-IMMUTABLE-17900573
    • Package: immutable@5.1.5
    • Published: 32 days ago (SLA: 30 days)
    • CVSS Score: 8.7
    • CVE: CVE-2026-59879

ℹ️ 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: 378
  • Medium without fixes: 11
  • Low without fixes: 0

❌ BUILD FAILED - Security checks failed

Please review and fix the security vulnerabilities before merging.

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (3)

upload-api/migration-wordpress/libs/extractAssets.ts:84

  • Aligning this UID with index.json also makes putTestData find prior metadata, but every WordPress asset is then guaranteed to be classified as changed: this extractor reports the source filename and file_size: '', while saveAsset stages assets_<id><ext> with a populated size, and contentMapper.service.ts:284-287 compares those fields literally. Consequently, an unchanged attachment is preselected for an in-place binary update on every delta run. Compare stable source metadata (for example the URL), omit unavailable fields from change detection, or emit metadata in the same canonical form as the staged asset.
        otherCmsAssetUid: `assets_${id}`,

api/src/services/wordpress.service.ts:1927

  • Changing the key does not make WordPress failures visible to getAssetMapping: this record is persisted through failedJSONFilePath, which is initialized under <data>/<stack>/logs/assets, while contentMapper.service.ts:2524-2529 only reads <data>/<stack>/assets/<ASSETS_FAILED_FILE>. The row will therefore still be reported as ok. Write/read a common operational failure file (while preserving any separate log copy if needed).
    failedJSON[customId] = {
      failedUid: customId,

api/src/services/wordpress.service.ts:1927

  • Once this WordPress failure is surfaced as status: 'failed', the shared Assets table renders a Retry button for it (assetMapper.tsx:346-365), but retryAssetDownload rejects every CMS except Contentful (contentMapper.service.ts:2419-2423). Either implement WordPress retry handling or suppress/disable the action for connectors that cannot retry; otherwise the newly exposed recovery control always fails.
      failedUid: customId,

@github-actions

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 0 0 10 ✅ Passed
🟠 High Severity 14 378 25 ✅ Passed
🟡 Medium Severity 19 11 500 ✅ Passed
🔵 Low Severity 2 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 371 30 / 120 days ⚠️ Warning
🟡 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: 378
  • Medium without fixes: 11
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@umesh-more-cstk
umesh-more-cstk merged commit 69ed0ba into dev Aug 11, 2026
10 checks passed
@umesh-more-cstk
umesh-more-cstk deleted the bugfix/cmg-1108-1109-wordpress-delta branch August 11, 2026 09:18
chetan-contentstack pushed a commit that referenced this pull request Aug 14, 2026
cs_failed.json write on a failed WordPress attachment download used the
bare wp:post_id instead of customId (assets_<wp:post_id>), which is the
only key getAssetMapping looks up via otherCmsAssetUid. Failed WordPress
attachments were silently reported as "ok" instead of "failed".
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.

4 participants