Skip to content

Conversation

@forus
Copy link
Contributor

@forus forus commented Dec 24, 2025

Summary

Submitting dynamic virtual studies without explicitly defined sample IDs previously resulted in a NullPointerException. This behavior was incorrect, as dynamic studies are designed to derive their sample IDs dynamically from filters, not require them upfront.

Root Cause

The issue was traced to the public Virtual Study controller, which was invoking the session service directly. That service assumed precomputed sample IDs and therefore failed for dynamic studies.

Fix

  • Updated the public VS controller to use the ** VirtualStudy service**.
    • When handling public dynamic virtual studies, the controller now reuses the same computation from the virtualStudyService that is already implemented for regular virtual studies to compute sample IDs dynamically based on the provided filters.
  • This aligns the implementation with the intended design and prevents null-related failures.
  • Sample counts are now calculated dynamically as well, ensuring they stay in sync with the underlying filters.

Result

  • Public dynamic virtual studies can now be submitted safely without specifying sample IDs, as expected.
  • Landing page sample counts are no longer stale and reflect the current filter-based computation.

Please merge the fix to the v6 version as well #11891

@pieterlukasse
Copy link
Member

pieterlukasse commented Jan 2, 2026

Thanks @forus .
Can you please clarify the issue description? I'm not sure I understand this part:

The controller now computes sample IDs dynamically based on the provided filters when handling public dynamic virtual studies.

Does this mean that computation of "sample IDs dynamically based on the provided filters" has not been occurring yet? Or is this an issue specifically with the public virtual studies controller? If it is just this controller, why would it now need compute the sample IDs dynamically instead of just reusing the same computation already implemented for the regular virtual studies? Or is that what you meant?

@forus
Copy link
Contributor Author

forus commented Jan 5, 2026

@pieterlukasse Thanks for the review!

Find my answers below.

Does this mean that computation of "sample IDs dynamically based on the provided filters" has not been occurring yet? Or is this an issue specifically with the public virtual studies controller?

Indeed, the computation has not been running for the public virtual studies controller only, which lists public virtual studies on the landing page. However, the calculation has been occurring for the session service endpoints, which are used everywhere else for virtual studies.

If it is just this controller, why would it now need compute the sample IDs dynamically instead of just reusing the same computation already implemented for the regular virtual studies? Or is that what you meant?

It reuses the same computation in the virtualStudyService that is already implemented for regular virtual studies. That is precisely the point.

@forus forus requested a review from pieterlukasse January 5, 2026 16:11
@forus forus force-pushed the master_demo_fix-sample-list-for-dynamic-virtual-studies branch from 3655bd6 to 8816456 Compare January 5, 2026 16:12
Copy link
Member

@pieterlukasse pieterlukasse left a comment

Choose a reason for hiding this comment

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

Thanks @forus , I see now. Basically the code is adjusted to correctly use getUserVirtualStudies instead of just sessionServiceRequestHandler.getVirtualStudiesAccessibleToUser(ALL_USERS)

Submitting dynamic virtual studies without explicitly defined sample IDs previously resulted in a NullPointerException.
This behavior was incorrect, as dynamic studies are designed to derive their sample IDs dynamically from filters, not require them upfront.
The issue revealed that the public VS controller was not
using the appropriate VirtualStudy service. This change aligns the controller
with the correct service to handle public dynamic virtual studies safely.
@forus forus force-pushed the master_demo_fix-sample-list-for-dynamic-virtual-studies branch from 8816456 to 4d0eb94 Compare January 7, 2026 20:12
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 7, 2026

@forus forus merged commit f9aeb26 into master Jan 7, 2026
17 of 23 checks passed
@forus forus deleted the master_demo_fix-sample-list-for-dynamic-virtual-studies branch January 7, 2026 20:21
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.

3 participants