Skip to content

Removed eager fetch in list - #846

Open
ivo-ritense wants to merge 3 commits into
next-minorfrom
bugfix/collection-fetch
Open

Removed eager fetch in list#846
ivo-ritense wants to merge 3 commits into
next-minorfrom
bugfix/collection-fetch

Conversation

@ivo-ritense

Copy link
Copy Markdown
Collaborator

@ivo-ritense
ivo-ritense requested review from a team as code owners July 23, 2026 09:13
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Enhancements
    • Case lists and document searches now load only the current page of results, improving performance for large result sets.
    • Case tags are reliably included when viewing documents or displaying search and list results.
    • Document reindexing now handles pagination more reliably and continues processing when individual documents cannot be converted.

Walkthrough

The change initializes lazily loaded document case tags within transactional retrieval and search methods, adds REST integration coverage for document and search responses, and changes the entity mapping to batched lazy loading. OpenSearch reindexing now converts entities within read-only transactions and advances using the last fetched row. Release notes document page-by-page loading for case lists and searches.

🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The OpenSearch reindex refactor appears unrelated to [#823]'s pagination issue and changes cursor/transaction behavior beyond list fetching. Move the OpenSearch reindex fix to a separate PR or link it to its own issue, unless it is required for [#823].
✅ Passed checks (1 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The lazy-loading and explicit initialization changes address [#823] by removing collection fetches from list pagination and keeping serialization inside the transaction.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/collection-fetch

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.

@Klaas-Ritense Klaas-Ritense added the test env Create a remote test environment for this PR in the Ritense product development cluster label Jul 24, 2026
@valtimo-platform

valtimo-platform Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Will create a test environment. This comment will be updated once it is available. This usually takes a few minutes.
Closing or merging this PR will automatically delete the test environment. Pushing commits to this PR will update the test environment.
Progress:

  • Created test environment
  • Waiting for frontend and backend images with tag "testEnv.pr846_commit.<commit sha>_contents.<contents sha>_build.<build number>". Check the GitHub Actions logs for progress on the build / image tagging.
  • Starting test environment
  • Waiting for environment to run

@Klaas-Ritense

Copy link
Copy Markdown
Member

Integration test gives an error

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

🧹 Nitpick comments (3)
backend/case/src/test/java/com/ritense/document/web/rest/JsonSchemaDocumentCaseTagsSerializationIntegrationTest.java (1)

155-183: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the two document-list paths as well.

This regression test exercises single-document GET and search, but not getAllByDocumentDefinitionName or getAll—the two list methods changed in JsonSchemaDocumentService. Add list-response coverage here, or confirm equivalent existing tests cover lazy caseTags serialization for both methods.

backend/case-opensearch/src/main/kotlin/com/ritense/document/opensearch/service/DocumentOpenSearchReindexService.kt (2)

109-113: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Update the stale "short transaction" doc comment.

The class-level comment on reindex (Lines 109-113) still describes each page as read in a "short read-only transaction," but conversion now happens inside that same transaction, including batch-lazy-loading of caseTags for every document in the batch. This can meaningfully extend how long the transaction (and its DB snapshot/connection) is held, especially for large page sizes. Worth updating the doc to reflect the new duration characteristics, and considering whether page size needs re-tuning now that conversion work is inside the transaction boundary.

Also applies to: 125-155


129-149: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add coverage for partial-batch conversion failures.

DocumentOpenSearchReindexServiceTest.kt only covers lock acquisition/cancellation; add a case where a batch converter throws partway through so the cursor advances past failed documents and the skipped count is recorded.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a58300b7-5b26-4cea-a8f4-335c8e7c7233

📥 Commits

Reviewing files that changed from the base of the PR and between b04845b and 53aa0d2.

📒 Files selected for processing (6)
  • backend/case-opensearch/src/main/kotlin/com/ritense/document/opensearch/service/DocumentOpenSearchReindexService.kt
  • backend/case/src/main/java/com/ritense/document/domain/impl/JsonSchemaDocument.java
  • backend/case/src/main/java/com/ritense/document/service/impl/JsonSchemaDocumentSearchService.java
  • backend/case/src/main/java/com/ritense/document/service/impl/JsonSchemaDocumentService.java
  • backend/case/src/test/java/com/ritense/document/web/rest/JsonSchemaDocumentCaseTagsSerializationIntegrationTest.java
  • documentation/release-notes/13.x.x/13.38.0/README.md

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

Labels

feedback test env Create a remote test environment for this PR in the Ritense product development cluster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collection fetch used in memory

2 participants