addcontent hangs when default fallback is enabled causing multilingual contentlets to be re submitted#35030
Conversation
|
Claude finished @dario-daza's task in 4m 37s —— View job PR Review
Issues1. 2. Silent duplicate skip could hide incomplete deletes 3. 4. 5. 6. Minor
Overall: fixes are well-targeted and the SQL logic for the language-pair delete is correct. Test coverage for the three-language case is solid. The silent-skip on duplicate in |
…-is-enabled-causing-multilingual-contentlets-to-be-re-submitted
dotCMS/src/main/java/com/dotmarketing/factories/MultiTreeAPIImpl.java
Outdated
Show resolved
Hide resolved
…-is-enabled-causing-multilingual-contentlets-to-be-re-submitted
…-is-enabled-causing-multilingual-contentlets-to-be-re-submitted
dotCMS/src/main/java/com/dotmarketing/factories/MultiTreeAPIImpl.java
Outdated
Show resolved
Hide resolved
dotCMS/src/main/java/com/dotmarketing/factories/MultiTreeAPIImpl.java
Outdated
Show resolved
Hide resolved
dotcms-integration/src/test/java/com/dotmarketing/factories/MultiTreeAPITest.java
Show resolved
Hide resolved
...egration/src/test/java/com/dotcms/rendering/velocity/services/HTMLPageAssetRenderedTest.java
Outdated
Show resolved
Hide resolved
dotCMS/src/main/java/com/dotcms/rendering/velocity/services/PageRenderUtil.java
Outdated
Show resolved
Hide resolved
|
Pull Request Unsafe to Rollback!!! Category: M-4 — OSGi Plugin API Breakage
Category: M-3 — REST / Headless API Contract Change
|
dotCMS/src/main/java/com/dotmarketing/factories/MultiTreeAPIImpl.java
Outdated
Show resolved
Hide resolved
…-is-enabled-causing-multilingual-contentlets-to-be-re-submitted
|
Pull Request Unsafe to Rollback!!! Category: M-4 — OSGi Plugin API Breakage
Category: M-3 — REST / Headless API Contract Change
|
Regarding to the rollback scenario Category: M-3 — REST / Headless API Contract Change:A rollback from N to N-1 restores the buggy behavior, not a feature. Any headless consumer that "adapted to the corrected behavior" after N is deployed was adapting to correct, spec-compliant output. Restoring the bug on rollback would re-expose third-language content leaking into the response — an outcome no intentional API design would document. The existing DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE flag is already the appropriate gate. Regarding to the rollback scenario Category: M-4 — OSGi Plugin API BreakageSolved. |
…-is-enabled-causing-multilingual-contentlets-to-be-re-submitted
|
Pull Request Unsafe to Rollback!!! Category: M-3 — REST / Headless API Contract Change
Note on previously flagged M-4 (OSGi Plugin API Breakage): The concern from earlier analysis reviews is now resolved in the current commit (
|
Regarding to the rollback scenario Category: M-3 — REST / Headless API Contract Change:A rollback from N to N-1 restores the buggy behavior, not a feature. Any headless consumer that "adapted to the corrected behavior" after N is deployed was adapting to correct, spec-compliant output. Restoring the bug on rollback would re-expose third-language content leaking into the response — an outcome no intentional API design would document. The existing DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE flag is already the appropriate gate. |
Fix 1 — addContent() hangs with multilingual content
File: dotCMS/src/main/java/com/dotmarketing/factories/MultiTreeAPIImpl.java
Context
When
DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE=true, render() returns mixed-language content. When the client re-submits it to addContent(), the language-scoped DELETE left fallback-language entries in multi_tree. copyMultiTree() then hit a duplicate on INSERT and threw IllegalArgumentException, rolling back the transaction and hanging the client indefinitely.Proposed Changes
overridesMultitreesByPersonalization(): Added adefaultContentToDefaultLanguageboolean gate. When true, performs a full DELETE (all entries for the page/personalization/variant) instead of the language-scoped DELETE, ensuring a clean state before re-inserting.copyMultiTree(): replaced the IllegalArgumentException on duplicate detection with a debug log + skip as defence-in-depth.Fix 2 — entity.containers.uuid includes wrong-language contentlets
File: dotCMS/src/main/java/com/dotcms/rendering/velocity/services/PageRenderUtil.java
Context
When
DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE=true, an ESP-only contentlet (e.g. content3) added to the page was appearing inentity.containers.uuidwhen rendering the ENG page. The rendered HTML was correct (content3 absent), creating an inconsistency that confuses headless/EMA consumers of the JSON response.Proposed Changes
getContentletOrFallback(): removed afindContentletByIdentifierAnyLanguagefallback that was too broad. AfterfindContentletByIdentifierOrFallbackreturns empty (no version in requested language or default language), the method now returns null, correctly excluding the contentlet from the response. The contract is now strictly:requested language → default language → exclude.
Relationship between the two fixes
Both stem from the same root:
DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE=truecauses the page to surface content from multiple languages simultaneously, and the rest of the stack wasn't accounting for that. Fix 1 protects the write path (addContent), Fix 2 corrects the read path (render).UI test
Here is a test in the UI with 3 languages, the same happens if we have content even in more languages.
multiple-language-content-test.mp4
Fixes
This PR fixes: #35029
This PR fixes: #35029