You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(api): map the failure field of the task status response - #835
Add FailureCategory (9 values) and FailurePhase (4 values, plus a library-added UNKNOWN) enums to ai.docling.serve.api.task.response, mirroring upstream docling.datamodel.base_models.FailureCategory / docling.datamodel.service.responses.FailurePhase. Both carry a @JsonEnumDefaultValueUNKNOWN constant so a value added upstream after this library's enum was last updated deserializes gracefully instead of failing.
Enable READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE (Jackson 2) / EnumFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE (Jackson 3) by default in DoclingServeJackson2Client and DoclingServeJackson3Client, next to the existing FAIL_ON_UNKNOWN_PROPERTIES configuration. This is the first time the repo needs an unknown-enum-value policy; consumers supplying their own Jackson mapper need to enable the equivalent feature themselves to get the same graceful fallback (documented on the enums' Javadoc).
Add TaskFailureInfo (category, message, retryable, phase, details) and wire it into TaskStatusPollResponse.failure. Only populated by Docling Serve deployments using the Ray orchestrator (v1.25.0+); other orchestrators continue to report only errorMessage, which is left unchanged.
Fold in two related upstream-drift gaps flagged in the issue: TaskStatusMetadata.numPartiallySucceeded and ErrorItem.category/ErrorItem.pageNo.
New tests: TaskFailureInfoTests, TaskStatusMetadataTests, TaskStatusPollResponseTests, extended ErrorItemTests, and FailureDeserializationTests (verifies known and unrecognized FailureCategory/FailurePhase values deserialize correctly with both Jackson 2 and Jackson 3 default mappers, including the UNKNOWN fallback).
TaskStatusPollResponse now exposes failure (TaskFailureInfo), the
structured category/message/retryable/phase/details Docling Serve
reports for a failed task when the Ray orchestrator is in use.
FailureCategory and FailurePhase are modeled as extensible enums
with an UNKNOWN default so a value added upstream after this
library's enum was last updated deserializes gracefully instead of
failing, when using the default docling-serve-client JSON mappers.
Also fold in two related upstream-drift gaps: TaskStatusMetadata
gains numPartiallySucceeded, and ErrorItem gains category and
pageNo.
Refs docling-project#778
Assisted-By: Claude Code <noreply@anthropic.com>
Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The new fields can be null in older-server responses but advertise non-null getter contracts under @NullMarked, exposing callers to runtime NPEs unless annotated @Nullable.
Adds structured task-failure information to the Java API for Ray-backed Docling Serve deployments, addressing #778 while preserving existing errorMessage behavior.
Changes:
Adds TaskFailureInfo and failure enums, with unknown-value fallback in both default Jackson clients.
Maps error categories, page numbers, and partially successful document counts.
Adds model and deserialization tests, updates existing expectations, and documents the additions.
Satisfies the spotless formatting rules, which rejected the wrapped
form of the constant.
Assisted-By: Claude Code <noreply@anthropic.com>
Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
These tests configure independent mappers, so removing either production builder's unknown-enum feature flag would still leave all four tests passing. Add regression tests that deserialize through default-built DoclingServeJackson2Client and DoclingServeJackson3Client instances without supplying custom mappers; their protected readValue methods are accessible from this test package. This will cover the promised default UNKNOWN fallback for unfamiliar categories and phases.
Review effort: Balanced
This branch has not been deployed
No deployments
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
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
FailureCategory(9 values) andFailurePhase(4 values, plus a library-addedUNKNOWN) enums toai.docling.serve.api.task.response, mirroring upstreamdocling.datamodel.base_models.FailureCategory/docling.datamodel.service.responses.FailurePhase. Both carry a@JsonEnumDefaultValueUNKNOWNconstant so a value added upstream after this library's enum was last updated deserializes gracefully instead of failing.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE(Jackson 2) /EnumFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE(Jackson 3) by default inDoclingServeJackson2ClientandDoclingServeJackson3Client, next to the existingFAIL_ON_UNKNOWN_PROPERTIESconfiguration. This is the first time the repo needs an unknown-enum-value policy; consumers supplying their own Jackson mapper need to enable the equivalent feature themselves to get the same graceful fallback (documented on the enums' Javadoc).TaskFailureInfo(category,message,retryable,phase,details) and wire it intoTaskStatusPollResponse.failure. Only populated by Docling Serve deployments using the Ray orchestrator (v1.25.0+); other orchestrators continue to report onlyerrorMessage, which is left unchanged.TaskStatusMetadata.numPartiallySucceededandErrorItem.category/ErrorItem.pageNo.docs/src/doc/docs/whats-new.md.Test plan
./gradlew --no-daemon :docling-serve-api:test :docling-serve-client:test./gradlew --no-daemon spotlessCheckTaskFailureInfoTests,TaskStatusMetadataTests,TaskStatusPollResponseTests, extendedErrorItemTests, andFailureDeserializationTests(verifies known and unrecognizedFailureCategory/FailurePhasevalues deserialize correctly with both Jackson 2 and Jackson 3 default mappers, including theUNKNOWNfallback).Refs #778
Assisted-By: Claude Code noreply@anthropic.com