Skip to content

fix: preserve keyword markers in themes for default export configuration#1387

Open
ankita10119 wants to merge 1 commit into
masterfrom
DXCDT-1724
Open

fix: preserve keyword markers in themes for default export configuration#1387
ankita10119 wants to merge 1 commit into
masterfrom
DXCDT-1724

Conversation

@ankita10119
Copy link
Copy Markdown
Contributor

🔧 Changes

Fixes keyword preservation for themes when AUTH0_EXPORT_IDENTIFIERS is false (the default configuration).

Root cause: ThemesHandler used identifiers: ['themeId'] to match local theme entries during keyword preservation. However, themeId is stripped from exported files by default (AUTH0_EXPORT_IDENTIFIERS: false), so the preservation logic could never find a matching identifier and silently skipped preservation, causing keyword markers
like ##CDN_URL## to be overwritten with raw values on re-export.

Changes:

  • ThemesHandler: Added displayName as a secondary identifier alongside themeId, providing a match path for users who have named their theme but do not use AUTH0_EXPORT_IDENTIFIERS
  • getPreservableFieldsFromAssets in keywordPreservation.ts:
    • Fixed the identifier reduce to skip missing identifiers instead of resetting the accumulator, allowing multi-identifier fallback to work correctly
    • Added positional index fallback when registered identifiers are absent from the local file, safe for themes since Auth0 supports only one theme per tenant

📚 References

🔬 Testing

Unit tests added covering the following scenarios:

  1. themeId present in local file (AUTH0_EXPORT_IDENTIFIERS: true) - preserved via themeId identifier
  2. displayName present but not themeId - preserved via displayName identifier
  3. Neither themeId nor displayName present (default export, exact customer scenario) - preserved via positional index fallback
  4. identifiers: [] (no identifiers registered for array type) - NOT preserved, confirming the fallback does not apply to unrecognized arrays

Manual end-to-end test:

  1. Set AUTH0_PRESERVE_KEYWORDS: false in config, run export to get a baseline tenant.yaml
  2. Edit tenant.yaml - replace raw URLs with quoted keyword markers e.g. font_url: '##CDN_URL##/fonts/custom.woff2'
  3. Set AUTH0_PRESERVE_KEYWORDS: true, re-run export
  4. Confirm tenant.yaml still contains ##CDN_URL## markers instead of resolved URLs

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@ankita10119 ankita10119 requested a review from a team as a code owner May 15, 2026 07:00
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.84%. Comparing base (eb215ab) to head (d1ec576).

Files with missing lines Patch % Lines
src/keywordPreservation.ts 71.42% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1387      +/-   ##
==========================================
- Coverage   79.84%   79.84%   -0.01%     
==========================================
  Files         153      153              
  Lines        7052     7056       +4     
  Branches     1547     1549       +2     
==========================================
+ Hits         5631     5634       +3     
  Misses        781      781              
- Partials      640      641       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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