Skip to content

fix: Skip documents missing in the Documenten API when listing case documents - #859

Open
mbritense wants to merge 1 commit into
next-minorfrom
bugfix/799-fix-documents-tab-13
Open

fix: Skip documents missing in the Documenten API when listing case documents#859
mbritense wants to merge 1 commit into
next-minorfrom
bugfix/799-fix-documents-tab-13

Conversation

@mbritense

@mbritense mbritense commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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.
@mbritense
mbritense requested review from a team as code owners July 28, 2026 10:54
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • The Documents tab now continues loading when a linked document is missing.
    • Missing documents are skipped, allowing the remaining case documents to be displayed.
    • Other access or server errors continue to be reported normally.
  • Documentation

    • Added this improvement to the 13.39.0 release notes.

Walkthrough

Related 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)
Check name Status Explanation
Linked Issues check ✅ Passed The PR matches #799 by skipping 404-missing DRC documents and still returning the remaining case documents.
Out of Scope Changes check ✅ Passed The changes stay within the bugfix scope; code, tests, and release notes all support the missing-document handling fix.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/799-fix-documents-tab-13

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f2c2e32 and 8bd83dc.

📒 Files selected for processing (3)
  • backend/zgw/zaken-api/src/main/kotlin/com/ritense/zakenapi/service/ZaakDocumentService.kt
  • backend/zgw/zaken-api/src/test/kotlin/com/ritense/zakenapi/service/ZaakDocumentServiceTest.kt
  • documentation/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) }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbritense This is a bug ^. It goes wrong when:

  1. Have a case with 11 uploads, with ONE broken reference
  2. Open the case and go to the Documents tab
  3. Navigate to page 2 of the Documents tab
  4. Notice error java.lang.IllegalArgumentException: fromIndex(10) > toIndex(9)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documents tab breaks when document in DRC can't de found

2 participants