fix(cache): add triggering user to cache flush log messages (#36830) - #36917
Open
dsilvam wants to merge 1 commit into
Open
fix(cache): add triggering user to cache flush log messages (#36830)#36917dsilvam wants to merge 1 commit into
dsilvam wants to merge 1 commit into
Conversation
Cache flush operations discarded the InitDataObject returned by WebResource.init(), so the authenticated user never reached the log line while other maintenance tasks (reindex, restarts) already logged it. - CacheResource: capture the user in the five flush endpoints and include user.getUserId() in the message; promote four flush logs from debug to info so the operations are visible at default log levels. - ViewCMSMaintenanceAction: resolve the portlet user (null-guarded) for the legacy Struts cache branch, which is the path the Maintenance tab's Flush Cache button actually posts to. - Register CacheResourceIntegrationTest in MainSuite3a; the class was never in a suite, so none of its tests ran in CI. Refs: #36830 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
gortiz-dotcms
approved these changes
Aug 6, 2026
dsolistorres
approved these changes
Aug 6, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36830
Proposed Changes
CacheResource— the five flush endpoints (flushAll,flushRegion,flushGroup,flushObject,deleteMenuCache) built anInitDataObjectviaWebResource.InitBuilderpurely for its auth side effect and discarded the return value, so the authenticatedUsernever reached the log line. They now capture the user and includeuser.getUserId(), matching the pattern already used throughoutMaintenanceResource.debugtoinfo—flushAll,flushGroup,flushObjectanddeleteMenuCachewere debug-only, so under default log levels those flushes left no trace at all. Also fixed a latent gap whereflushObjectlogged the group but never the objectid.ViewCMSMaintenanceAction— the legacy Struts cache branch now resolves the portlet user (null-guarded via_getUser(req), falling back to"unknown"). This is the path the Maintenance tab's Flush Cache button actually posts to (view_cms_maintenance.jsp→submitform('flushCache')→cmd=cache); it is still wired instruts-config.xmlandportlet.xml, and emitted the exact un-attributedFlushing All Cachesline from the report.CacheResourceIntegrationTestinMainSuite3a— the class was not referenced by any suite, so none of its tests ran in CI. Pre-existing gap from when the class was added in maintenance portlet | Implement Cache Management Apis #35190 #35218; all 11 pre-existing tests pass.Checklist
Only the internal
userIdis logged (e.g.dotcms.org.1), not email or other PII. No auth logic changed:rejectWhenNoUser(true)+requiredBackendUser(true)+requiredPortlet(...)already guarantee a non-null user before the log line inCacheResource, so no extra guard is needed there. The legacy portlet path can returnnull, so it is explicitly null-guarded. Low-level flush primitives (MaintenanceUtil.flushCache(),CacheMaintenanceHelper,CMSMaintenanceFactory) were deliberately left user-agnostic — they are invoked from cluster events, startup and search-and-replace, which have no triggering user.Additional Info
openapi.yamlneeds no regeneration — no Swagger annotations or method signatures changed.Verified in a running instance (both legacy branches):
Integration tests —
Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, including REST-path attribution:Not addressed here:
CMSMaintenanceAjax.flushIndiciesCache()(DWR path, ES index cache) has the identical gap, but fixing it requires changingvalidateUser()frombooleantoUser, touching ~15 unrelated call sites in that class.🤖 Generated with Claude Code