feat(push-publishing): add per-endpoint failure details to failure events (#34356)#35765
Open
dsolistorres wants to merge 2 commits into
Open
feat(push-publishing): add per-endpoint failure details to failure events (#34356)#35765dsolistorres wants to merge 2 commits into
dsolistorres wants to merge 2 commits into
Conversation
…ents (#34356) Enhance AllPushPublishEndpointsFailureEvent and SinglePushPublishEndpointFailureEvent with an optional List<EndpointFailureDetail> payload so subscribers can distinguish authentication, authorization, server, network and bundle failures, capture HTTP status codes, and inspect a retryable hint. Existing 1-arg constructors keep working unchanged — getEndpointDetails() returns an empty list when the legacy constructor is used, preserving backward compatibility for current subscribers. PushPublisher.process() now records an EndpointFailureDetail at every failure branch (HTTP 401, 403, other non-2xx, missing auth key, and exception) and passes the list into the failure events at the existing emit sites. Includes unit tests for FailureCategory.from() mapping, EndpointFailureDetail builder defaults, backward-compat constructors on both events, and an end-to-end subscriber test exercising the LocalSystemEventsAPI delivery path. Refs: #34356 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Claude finished @dsolistorres's task in 3m 52s —— View job ✅ dotCMS Backend Review — pipeline complete
SummaryAll four sub-reviews came back clean:
The earlier defensive-copy concern raised on the previous push is resolved — both event classes now use |
Contributor
✅ dotCMS Backend ReviewNo issues found. Security, database, Java-standards and REST-API sub-reviews all came back clean. The previous defensive-copy concern is resolved — both event classes now use |
…nts (#34356) Collections.unmodifiableList only wraps the caller's list with a read-only view — mutations to the original list remain visible through the view. Switch to List.copyOf so each failure event holds a true immutable snapshot of its endpointDetails payload at construction time. Also adds a regression test that mutates the source list after construction and asserts the event's view stays unchanged. Refs: #34356 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dsilvam
approved these changes
May 20, 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.
Summary
AllPushPublishEndpointsFailureEventandSinglePushPublishEndpointFailureEventwith an optionalList<EndpointFailureDetail>payload (newEndpointFailureDetailvalue object +FailureCategoryenum). Subscribers can now distinguish authentication, authorization, server, network and bundle failures, capture HTTP status codes, and inspect a per-endpointretryablehint.getEndpointDetails()returns an empty (never-null) list when the legacy constructor is used, so existing subscribers compiled against the old API keep working without recompiling.PushPublisher.process()records anEndpointFailureDetailat every failure branch (HTTP 401, 403, other non-2xx, missing auth key, and exception) and passes the list into the failure events at the existing emit sites — no new I/O, no schema changes.Closes #34356
What's new
EndpointFailureDetail(immutable, builder-based value object)dotCMS/src/main/java/com/dotcms/system/event/local/type/pushpublish/EndpointFailureDetail.javaFailureCategoryenum (AUTHENTICATION,AUTHORIZATION,CLIENT_ERROR,SERVER_ERROR,NETWORK_ERROR,BUNDLE_ERROR,UNKNOWN) withfrom(httpStatus, auditStatus, throwable)classifier and per-categoryretryabledefaultdotCMS/src/main/java/com/dotcms/system/event/local/type/pushpublish/FailureCategory.javaAllPushPublishEndpointsFailureEvent.java,SinglePushPublishEndpointFailureEvent.javabuildFailureDetail(...)helper + per-failure-branch capturedotCMS/src/main/java/com/dotcms/publisher/pusher/PushPublisher.javaFailure-category mapping (built into
FailureCategory.from())INVALID_TOKEN/ HTTP 401 / missing auth keyAUTHENTICATIONLICENSE_REQUIRED/ HTTP 403AUTHORIZATIONCLIENT_ERRORSERVER_ERRORNETWORK_ERRORFAILED_TO_BUNDLEBUNDLE_ERRORUNKNOWNBackward compatibility
new AllPushPublishEndpointsFailureEvent(assets)Collections.emptyList()getPublishQueueElements,getName,getDate)getEndpointDetails()after legacy ctorCollections.unmodifiableListExternal plugins compiled against the prior API continue to work without recompiling.
Subscriber usage example (what a customer plugin would do)
A reference subscriber exercising the live
LocalSystemEventsAPIships inPushPublishFailureEventSubscriberTest.Test plan
FailureCategoryTest— 13 tests covering everyfrom(...)mapping branch and theretryabledefaultsEndpointFailureDetailTest— 4 tests covering the builder defaults, theretryableoverride path, and theUNKNOWN-fallback pathPushPublishFailureEventsTest— 6 tests covering backward-compat constructors, payload propagation, and list-immutability on both event classesPushPublishFailureEventSubscriberTest— 3 end-to-end tests wiring a real@SubscriberPOJO intoLocalSystemEventsAPI, firing each event variant, and asserting per-endpoint payload, category grouping, HTTP status, audit status andretryablepropagate through the bus./mvnw compile -pl :dotcms-core— clean./mvnw test -pl :dotcms-core -Dtest='FailureCategoryTest,EndpointFailureDetailTest,PushPublishFailureEventsTest,PushPublishFailureEventSubscriberTest'—Tests run: 26, Failures: 0, Errors: 0, Skipped: 0failureCategory = AUTHENTICATIONandhttpStatusCode = 401Notes / follow-ups
FAILED_TO_PUBLISHstate when receiver polling throws on a permanent auth or network failure. Filed as Bug: PublisherQueueJob never reaches FAILED_TO_PUBLISH when receiver audit poll fails (token/network) #35764 (Team : Maintenance) — out of scope for this PR.Phase 2install-time outcomes (bundle install on receiver) are not currently exposed via these events. Mentioned in the issue thread as a future enhancement.🤖 Generated with Claude Code