Skip to content

fix(sap-smartedit): keep the SAP label when the entry title falls back to the id - #1156

Open
pritesh-jain-cstk wants to merge 1 commit into
contentstack:feature/sap-smarteditfrom
pritesh-jain-cstk:bugfix/sap-nav-node-label
Open

pritesh-jain-cstk wants to merge 1 commit into
contentstack:feature/sap-smarteditfrom
pritesh-jain-cstk:bugfix/sap-nav-node-label

Conversation

@pritesh-jain-cstk

@pritesh-jain-cstk pritesh-jain-cstk commented Nov 2, 2026 •

Copy link
Copy Markdown

What

Keep the SAP label when an entry's title falls back to its SAP id.

The connector titles an entry by its id when the label is blank or shared, so titles stay unique. That rule stays. But it overwrote the only copy of the label: in a real electronics-spa export, two nav nodes labelled "Accessories" lost their text, and reconcile-sap.ts warned "label not stored" twice.

The content-type builder (upload-api/migration-sap-smartedit/libs/contentTypes.ts) now adds a source_<col> field mapped to the title's source column, only on types where some row's label is blank or shared. Types whose title is made up (no label column), or where every label is unique, get nothing.

Behaviour

  • Real electronics-spa export: only CMSNavigationNode gets source_title; all 19 SAP labels kept, both "Accessories" included; the 27 nodes with no label in SAP stay without one (nothing invented).
  • v2's own SAP datasets: the field appears only where titles collide (e.g. ContentSlotName.source_name, ContentPage.source_title in medium-500); translated labels are filled per locale like title.
  • It shows in the field-mapping screen, ticked by default. Its source label there reads "title", the same as the title row; a clearer label may be worth adding.

Testing

  • 4 unit tests in contentTypes.sourceLabel.test.ts (fixture in tests/fixtures/sap-smartedit-source-label/, outside fixtures/sap-smartedit/ so the folder-mode parser test is unaffected).
  • upload-api suite: 375/375 with npx vitest run --no-file-parallelism. In parallel, 4–6 random failures happen on the untouched branch too (test files share one cmsMigrationData folder).
  • Live v2 UI run on a test stack with this and the url fix: 219 entries, reconcile-sap.ts PASSED with no findings.

Found in an end-to-end run SAP SmartEdit → migration-v2 → Contentstack → Spartacus (Jira DX-30753, gap G28). Independent of the companion url PR; either can merge alone.

Unrelated, seen on every run with or without this change: "cs_contentslot update failed" in the api log.

🤖 Generated with Claude Code

Re-verified 2026-11-05

Re-run on this PR's head by an independent verification pass (spot-checked by re-running). Only what was run is listed as verified.

Ran on head 1c63c138, upload-api/: npx vitest run --no-file-parallelism 375/375 (32 files); contentTypes.sourceLabel.test.ts 4/4; tsc --noEmit 0 errors. npm ci fails on the lock file here and on the base ("Missing: migration-sap-smartedit@1.0.0"), so npm install was used. Merges cleanly with #1155.

Not verified: ESLint; the electronics-spa result (19 labels kept); the parallel-mode failures; the live v2 UI run and reconcile-sap.ts. CI security-sca is failing (log not yet read).

…k to the id

When a type's label column is blank or shared on some rows, the api titles those
entries by source id. That overwrote the only copy of the label (two nav nodes
titled Accessories lost it). Such types now also map the column to source_<col>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pritesh-jain-cstk
pritesh-jain-cstk requested a review from a team November 2, 2026 13:16
@snyk-io

snyk-io Bot commented Nov 2, 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.

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.

2 participants