Skip to content

fix: Rx previous instructions modal shows nothing ("nada") when clicking *#955

Draft
yingbull with Copilot wants to merge 7 commits into
developfrom
copilot/fix-prev-rx-instructions
Draft

fix: Rx previous instructions modal shows nothing ("nada") when clicking *#955
yingbull with Copilot wants to merge 7 commits into
developfrom
copilot/fix-prev-rx-instructions

Conversation

Copilot AI commented Apr 2, 2026

Copy link
Copy Markdown
Contributor
  • Review the newly requested PR thread and identify any still-actionable feedback
  • Inspect the affected Rx files and compare them to the requested review-thread changes
  • Implement the smallest safe fix needed for any still-valid review feedback
  • Run targeted validation for the touched Rx files and any relevant CI/log checks
  • Run final automated review/security validation on the resulting change
  • Reply on the PR thread with the addressing commit hash and validation summary

Copilot AI linked an issue Apr 2, 2026 that may be closed by this pull request
4 tasks
…scade + null safety)

Agent-Logs-Url: https://github.com/carlos-emr/carlos/sessions/7dcc0e83-dc5f-45c5-93eb-da129870f7f5

Co-authored-by: yingbull <8680161+yingbull@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with retrieving previous Rx instructions fix: Rx previous instructions modal shows nothing ("nada") when clicking * Apr 2, 2026
Copilot AI requested a review from yingbull April 2, 2026 22:55
@yingbull yingbull marked this pull request as ready for review April 2, 2026 22:56
Copilot AI review requested due to automatic review settings April 2, 2026 22:56
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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

Sorry @yingbull, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@penify-dev

penify-dev Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

Copilot AI 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.

Pull request overview

Fixes the Rx “previous instructions” (*) modal failing to open by preventing server-side 500s and ensuring client-side injected scripts don’t abort subsequent execution.

Changes:

  • Hardened DrugDaoImpl.findByParameter by binding the value as a named parameter and allowlisting column names to avoid apostrophe crashes and SQL injection.
  • Updated CarlosAjax.insertContent to isolate injected script execution so one failing script doesn’t prevent later scripts from running.
  • Added null-guards in RxWriteScript2Action.listPreviousInstructions and displayMedHistory.jsp to avoid NPE-driven blank/failed UI.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/main/webapp/share/javascript/carlos-ajax.js Wrap injected script execution per-script to avoid cascade aborts.
src/main/webapp/oscarRx/displayMedHistory.jsp Add null guards around session bean / Rx stash item access.
src/main/java/io/github/carlos_emr/carlos/prescript/pageUtil/RxWriteScript2Action.java Guard missing stash item to avoid NPE when building previous-instructions list.
src/main/java/io/github/carlos_emr/carlos/commn/dao/DrugDaoImpl.java Parameterize native SQL value and add a column allowlist for safe dynamic column selection.

Comment thread src/main/webapp/oscarRx/displayMedHistory.jsp
@yingbull

yingbull commented May 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

Copilot AI and others added 2 commits May 5, 2026 00:37
Co-authored-by: yingbull <8680161+yingbull@users.noreply.github.com>

Copilot AI commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts and pushed true merge commit a7217a19c9. The PR diff is focused back to the 4 Rx-related files after merging latest develop.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • build.shibboleth.net
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.14/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.14/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.14 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.14/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/carlos/carlos org.codehaus.plexus.classworlds.launcher.Launcher -q --no-transfer-progress -DskipTests compile (dns block)
  • jitpack.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.14/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.14/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.14 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.14/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/carlos/carlos org.codehaus.plexus.classworlds.launcher.Launcher -q --no-transfer-progress -DskipTests compile (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@yingbull

yingbull commented May 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot lgtm?

Copilot AI commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot lgtm?

Code-wise, yes: the merge conflict is resolved in a7217a19c9, the PR diff is focused to the 4 intended Rx files, and CodeQL/Socket/submit-maven/code-scanning checks are green. I’d still wait for CI to settle because the copilot job is currently in progress and CodeFactor is reporting failure.

@yingbull

yingbull commented May 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot are all review comments from all reviewers which are valid review addressed?

Copilot AI commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot are all review comments from all reviewers which are valid review addressed?

Yes — from the reviewer feedback on this PR, the valid actionable comments appear addressed in a7217a19c9. Specifically: randomId is now digits-validated and log-sanitized in RxWriteScript2Action, and displayMedHistory.jsp now keeps the table markup inside the null guard so it does not emit a stray </table>. I do not see any other unresolved actionable review comments; the remaining concerns are CI/check status items rather than reviewer feedback.

@yingbull

yingbull commented May 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot apply changes based on the comments in this thread

Copilot AI requested review from Copilot and removed request for Copilot May 5, 2026 20:16
Copilot AI requested review from Copilot and removed request for Copilot May 5, 2026 20:17
Copilot AI requested review from Copilot and removed request for Copilot May 5, 2026 20:18

Copilot AI commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot apply changes based on the comments in this thread

Applied in 05b2cb95. listPreviousInstructions now returns explicit 400/404 errors for invalid or missing randomId state, and I added focused unit coverage for invalid input, missing stash items, and the successful lookup path. git diff --check passed; automated review/CodeQL came back clean; Maven test execution is still blocked in this sandbox by jitpack.io DNS resolution for existing dependencies.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • build.shibboleth.net
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.14/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.14/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.14 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.14/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/carlos/carlos org.codehaus.plexus.classworlds.launcher.Launcher -Dtest=RxWriteScript2ActionListPreviousInstructionsTest test (dns block)
  • jitpack.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.14/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.14/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.14 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.14/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/carlos/carlos org.codehaus.plexus.classworlds.launcher.Launcher -Dtest=RxWriteScript2ActionListPreviousInstructionsTest test (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@yingbull yingbull marked this pull request as draft May 12, 2026 15:48
@yingbull yingbull added this to the may-2026-release milestone May 19, 2026
@Ben-Heerema Ben-Heerema self-assigned this Jun 2, 2026
@Ben-Heerema

Copy link
Copy Markdown
Collaborator

I wasn’t able to confidently verify this manually because the prescription UI is hard to navigate. There are multiple * controls with different meanings and the set up is unideal.

Playwright verification did seem to exercise the intended flow successfully: after staging a medication, clicking the* beside the Instructions field sent listPreviousInstructions and opened the med history popup.

I filed a follow-up ticket for the related Rx UI confusion here: #2633 I don’t think that broader UI cleanup needs to block this PR, but it’s worth linking so the remaining verification difficulty is tracked separately. That said, I was unable to verify manually that this was working.

@Ben-Heerema Ben-Heerema removed their assignment Jun 2, 2026
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.

[Bug]: Unable to get Rx previous instructions

4 participants