fix: Skip documents missing in the Documenten API when listing case documents - #859
fix: Skip documents missing in the Documenten API when listing case documents#859mbritense wants to merge 1 commit into
Conversation
When a zaak still has a zaakinformatieobject that links to an enkelvoudiginformatieobject that no longer exists in the Documenten API (DRC), loading the documents tab failed entirely with an error. Documents that return 404 from the Documenten API are now skipped with a warning in the log, so the remaining documents of the case are still shown.
📝 WalkthroughSummary by CodeRabbit
WalkthroughRelated document retrieval now catches 404 responses from the Documenten API, logs a warning, and skips missing documents in related-file lists and pages. Other HTTP errors continue to propagate. Tests cover both 404 skipping and 403 propagation, and the 13.39.0 release notes describe the bugfix. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 153f4646-4a0b-42d7-b978-f9d12b2af0b8
📒 Files selected for processing (3)
backend/zgw/zaken-api/src/main/kotlin/com/ritense/zakenapi/service/ZaakDocumentService.ktbackend/zgw/zaken-api/src/test/kotlin/com/ritense/zakenapi/service/ZaakDocumentServiceTest.ktdocumentation/release-notes/13.x.x/13.39.0/README.md
| val zakenApiPlugin = getZakenApiPlugin(zaakUri) | ||
| val documenten = zakenApiPlugin.getZaakInformatieObjecten(caseDocumentId, zaakUri) | ||
| .map { mapDocumentenApiDocument(it, version, caseDocumentId, viewPermissions, modifyPermissions, deletePermissions) } | ||
| .mapNotNull { mapDocumentenApiDocument(it, version, caseDocumentId, viewPermissions, modifyPermissions, deletePermissions) } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Return an empty page when filtering moves the offset past the result set.
mapNotNull can shrink documenten below pageable.offset; toPage then calls subList(startIndex, endIndex) with startIndex > endIndex and throws. Guard that case in toPage and add a regression test for a non-filterable/sortable page with missing documents.
There was a problem hiding this comment.
@mbritense This is a bug ^. It goes wrong when:
- Have a case with 11 uploads, with ONE broken reference
- Open the case and go to the Documents tab
- Navigate to page 2 of the Documents tab
- Notice error
java.lang.IllegalArgumentException: fromIndex(10) > toIndex(9)
For 13. closes generiekzaakafhandelcomponent/gzac-issues#799 - original , the new one for V13: https://github.com/generiekzaakafhandelcomponent/atlas-internal/issues/568