Skip to content

fix(push-publishing): archived Site no longer deleted on receiver (#36034)#36174

Open
dsilvam wants to merge 1 commit into
mainfrom
issue-36034-archived-site-push-delete
Open

fix(push-publishing): archived Site no longer deleted on receiver (#36034)#36174
dsilvam wants to merge 1 commit into
mainfrom
issue-36034-archived-site-push-delete

Conversation

@dsilvam

@dsilvam dsilvam commented Jun 15, 2026

Copy link
Copy Markdown
Member

Proposed Changes

  • Guard HostAPI.delete() in ContentHandler.archiveOrDeleteContent() behind !isPushedContentArchived so that pushing an archived Site with a non-Remove operation archives it on the receiver instead of deleting it.
  • Add integration tests to HostBundlerHandlerTest covering both the fixed path (PUBLISH + archived → site preserved) and the regression path (UNPUBLISH + archived → site deleted).

Root Cause

In ContentHandler.archiveOrDeleteContent(), the Host/Site branch (lines 1277–1282) ignored the isPushedContentArchived parameter and unconditionally called archive() then delete(). The regular-content else branch already guarded destroy() behind !isPushedContentArchived correctly — the Host branch simply lacked the same guard.

Checklist

  • Tests
  • Translations
  • Security Implications Contemplated (no security impact — this tightens deletion criteria, it does not relax them)

Additional Info

Fixes #36034. When a Site is archived on the sender and pushed with any non-Remove / Push Remove action, the receiver now sets the Site to archived state instead of deleting it and all its content. The explicit Remove/Push Remove path is unaffected.

Screenshots

N/A — backend-only change

…6034)

When pushing an archived Site with a non-Remove operation, the receiver
was unconditionally calling HostAPI.delete() after archive(), ignoring
the isPushedContentArchived flag. Added a guard so delete() is only
called for explicit Remove/Push Remove operations, matching the existing
pattern used for regular content in the same method.

Refs: #36034

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

❌ Codex Review failed — openai.gpt-5.5

The review job failed before producing output. See the run for details.

Run: #27571110688

@claude

claude Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Claude finished @dsilvam's task in 5m 30s —— View job


dotCMS Backend Review

  • Gather context and read conventions
  • Get Java diff
  • Run specialized sub-agent reviews (Security, Database, Java Standards, Logic/Correctness)
  • Consolidate findings
  • Post final review

Review posted as a separate comment. Summary:

  • Security: No findings
  • Database/Cache: No findings
  • Java Standards: No findings
  • Logic/Correctness: One 🟡 Medium finding — tempDir.delete() in finally blocks silently fails on non-empty directories (latent resource leak in tests, pre-existing pattern replicated by the two new tests)
  • Fix correctness: Verified correct. The archive() call before the guard is idempotent on already-archived sites, routing logic is intact, and the isPushedContentArchived=false (delete) path is unaffected.

No Critical or High findings — PR is clear to merge after optional cleanup.

@claude

claude Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

🔍 dotCMS Backend Review

[🟡 Medium] dotcms-integration/src/test/java/com/dotcms/enterprise/publishing/remote/HostBundlerHandlerTest.java:269 (also lines ~346, ~136, ~194)

File.delete() silently returns false on non-empty directories — it does not recurse. The bundler writes XML files (and potentially binary assets) under tempDir, so tempDir.delete() in the finally block will fail silently, leaking temp files under ASSET_REAL_PATH/bundles/<timestamp> on every test run. Both new tests replicate this pattern from the pre-existing tests.

} finally {
    tempDir.delete();   // ← silently fails when bundler output files remain inside

💡 Replace with FileUtils.deleteDirectory(tempDir) (Apache Commons IO — already on the dotCMS classpath) or Files.walk(tempDir.toPath()).sorted(Comparator.reverseOrder()).forEach(p -> p.toFile().delete()) to avoid a dependency.


Next steps

  • 🟡 You can ask me to handle mechanical fixes inline: @claude fix tempDir cleanup in HostBundlerHandlerTest.java
  • Every new push triggers a fresh review automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Push publishing an archived Site deletes it on receiver instead of syncing its archived state

3 participants