Skip to content

Fix sample-type visibility and AST commit crash (#14018, #14156, #14124)#14166

Merged
roldy merged 2 commits into
developmentfrom
bugfix-14018-14156-14124-sample-types-ast-binding
Jul 8, 2026
Merged

Fix sample-type visibility and AST commit crash (#14018, #14156, #14124)#14166
roldy merged 2 commits into
developmentfrom
bugfix-14018-14156-14124-sample-types-ast-binding

Conversation

@roldy

@roldy roldy commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #14018 #14156 #14124

Summary by CodeRabbit

  • Bug Fixes
    • Updated sample/material visibility rules so “Clinical Sample / Other” is available for all diseases and peritoneal fluid is no longer hidden for Luxembourg.
    • Prevented an empty drug susceptibility form from being saved when no value is present, reducing form-related errors.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 38230260-e522-4ea8-8b53-67253deab201

📥 Commits

Reviewing files that changed from the base of the PR and between 87d0496 and 280ba79.

📒 Files selected for processing (1)
  • sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java

📝 Walkthrough

Walkthrough

Updates SampleMaterial visibility metadata for two specimen types, adjusts one inline specimen comment, adds a null guard to DrugSusceptibilityForm.commit(), and makes a formatting-only edit in ImiSectionComponent.

Changes

Sample Material Visibility

Layer / File(s) Summary
SampleMaterial annotation and comment updates
sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.java
Removes the disease hide restriction from CLINICAL_SAMPLE, removes the Luxembourg hide restriction from PERITONEAL_FLUID, and adjusts the PLEURAL_FLUID SNOMED-CT export comment.

UI Form Fixes

Layer / File(s) Summary
DrugSusceptibilityForm commit null guard
sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java
Overrides commit() to return early without calling super.commit() when the form value is null.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: KarnaiahPesula, raulbob

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR does not add the Giardia-specific sample list for #14018; it mainly changes other sample visibility rules and a null guard. Implement the Giardia-specific sample list (Stool, Duodenum fluid, Biopsy) in the web app and verify the case-specific sample selection flow.
Out of Scope Changes check ⚠️ Warning It includes unrelated changes for #14156/#14124 and a formatting-only edit, which are outside the provided #14018 objective. Remove or split unrelated fixes and cleanup into separate PRs, or expand the linked issue scope to cover them explicitly.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main changes: sample visibility updates and the commit-crash fix, and it names the relevant issue numbers.
Description check ✅ Passed The description satisfies the template's Fixes line and references the issue numbers needed for this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix-14018-14156-14124-sample-types-ast-binding

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

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java (1)

351-358: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Null guard looks correct given existing clear-on-hide behavior.

Skipping super.commit() when getValue() is null avoids the crash while the form is unbound/inapplicable. Since updateFieldsVisibility() already clears field values whenever the disease/test-type combination doesn't apply or the DTO is null before this state, no user-entered data should be silently dropped by this guard.

One nit: a short comment on why the null check is needed (e.g., referencing the crash it prevents) would help future maintainers avoid removing it by mistake.

📝 Optional: document rationale
 	`@Override`
 	public void commit() {
+		// Guard against committing when no DrugSusceptibilityDto is bound (e.g. form hidden/inapplicable);
+		// calling super.commit() in that state previously caused a crash.
 		if (getValue() == null) {
 			return;
 		}
 		super.commit();
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java`
around lines 351 - 358, Add a brief inline comment in
DrugSusceptibilityForm.commit() next to the getValue() null guard explaining
that super.commit() is skipped because the form can be unbound/inapplicable and
this prevents the crash; keep the existing null check and reference the
clear-on-hide behavior/updateFieldsVisibility logic so the intent is obvious to
future maintainers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java`:
- Around line 351-358: Add a brief inline comment in
DrugSusceptibilityForm.commit() next to the getValue() null guard explaining
that super.commit() is skipped because the form can be unbound/inapplicable and
this prevents the crash; keep the existing null check and reference the
clear-on-hide behavior/updateFieldsVisibility logic so the intent is obvious to
future maintainers.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1d030d1a-823b-464f-85c7-9a13349828d6

📥 Commits

Reviewing files that changed from the base of the PR and between a4846f6 and 87d0496.

📒 Files selected for processing (3)
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/ImiSectionComponent.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java
💤 Files with no reviewable changes (1)
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/ImiSectionComponent.java

@roldy roldy requested review from KarnaiahPesula and raulbob July 7, 2026 15:07
@roldy roldy merged commit 6054d9c into development Jul 8, 2026
7 checks passed
@roldy roldy deleted the bugfix-14018-14156-14124-sample-types-ast-binding branch July 8, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Giardia - Sample list may be wrong

2 participants