fix(demo-url): resolve tenant slug from IMS, not the brand name - #362
tkotthakota-adobe wants to merge 1 commit into
Conversation
The onboarding "Access your environment here" demo URL derived the
Experience Cloud tenant slug by slugifying the SpaceCat org's name when
the IMS lookup failed (name.toLowerCase().replace(/\s+/g,'')). Internally
onboarded sites live under the shared "Sites Internal" IMS org, so the org
name is the customer brand (e.g. "Dave and Busters") and slugifying it
produced a non-existent tenant ("daveandbusters") -> a broken deep link
that forced users to manually switch IMS orgs.
Resolve the tenant slug in order:
1. IMS_ORG_TENANT_ID_MAPPINGS[imsOrgId] - explicit ops-curated override
(this secret was referenced by tests but the handler never read it)
2. imsClient.getImsOrganizationDetails(imsOrgId).tenantId (only when truthy)
3. DEFAULT_TENANT_ID - known-good fallback
Remove the brand-name slugification entirely and the dead
organization.tenantId read (the Organization model has no such attribute).
Tenant resolution now depends only on the IMS org id, not the org record.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Reviewed thoroughly and verified every load-bearing claim against source — this is a correct, well-tested fix that strictly improves the failure mode (worst case is now a real default, never an invented brand slug). Root cause is real: the old Verified:
Tests cover all branches (mapping override, IMS fallback, malformed mapping, IMS-throws→default, no-tenantId→default, org-not-found, findById-throws); 100% coverage; CI green. Three non-blocking notes:
LGTM. |
What & why
The onboarding "Access your environment here" demo URL was rendering the wrong Experience Cloud tenant slug (e.g.
#/@daveandbusters/...instead of#/@sitesinternal/...), producing a broken deep link that forced users to manually switch IMS orgs.Root cause in
src/tasks/demo-url-processor/handler.js: when the IMS lookup threw,getImsTenantIdfell back to slugifying the SpaceCat org name (name.toLowerCase().replace(/\s+/g,'')). Internally onboarded sites all live under the shared Sites Internal IMS org, so the org name is the customer brand ("Dave and Busters") → a fabricated tenantdaveandbustersthat does not exist in Experience Cloud.Change
Resolve the tenant slug in order:
IMS_ORG_TENANT_ID_MAPPINGS[imsOrgId]— explicit ops-curated override (this secret was referenced by the tests but the handler never actually read it — the wiring had been dropped).imsClient.getImsOrganizationDetails(imsOrgId).tenantId— now only used when truthy.DEFAULT_TENANT_ID— known-good fallback.organization.tenantIdread (theOrganizationdata model has no such attribute).Reviewer notes / operational follow-up
The code guarantees it will not emit a brand slug, but for prod to render
sitesinternalyou need, indx_mysticat/prod/task-processor, one of:IMS_ORG_TENANT_ID_MAPPINGSmapping the Sites Internal IMS org id →"sitesinternal", and/orDEFAULT_TENANT_ID=sitesinternal, and/orgetImsOrganizationDetailswas throwing/empty for that org.Testing
npm test— 426 passing;demo-url-processor/handler.jsat 100% stmts/branch/funcs/lines. Rewrote the handler's unit tests to cover the new precedence (mapping override, IMS fallback, malformed mapping, IMS-throws → default, no-tenantId → default, org-not-found, findById-throws).Related Issues
None linked.
Change Management
🤖 Generated with Claude Code