From 6f14f63a8e4411836e4fb35e02a924d0a302d20b Mon Sep 17 00:00:00 2001 From: mherman22 Date: Thu, 9 Apr 2026 21:09:00 +0000 Subject: [PATCH 1/4] Suppress MPI sync AOP during patient import to prevent duplicates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When importMpiPatient() saves a patient via createImportedMpiPatient(), the mpi-client PatientSynchronizationAdvice AOP fires and spawns a PatientUpdateWorker. This worker re-queries the MPI, discovers golden record seealso links, and triggers a second import — creating a duplicate local patient. Wrap the savePatient() call with PatientSynchronizationAdvice.SUPPRESS to skip the AOP during import. The export back to MPI is already handled explicitly by exportPatient() at the end of importMpiPatient(), so the AOP-triggered export is redundant anyway. Depends on IsantePlus/openmrs-module-mpi-client#60 which adds the SUPPRESS ThreadLocal flag. --- .../api/impl/RegistrationCoreServiceImpl.java | 8 +++++++- pom.xml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java index 7b121529..daf3229e 100644 --- a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java +++ b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java @@ -33,6 +33,7 @@ import org.openmrs.api.PersonService; import org.openmrs.api.context.Context; import org.openmrs.api.impl.BaseOpenmrsService; +import org.openmrs.module.santedb.mpiclient.aop.PatientSynchronizationAdvice; import org.openmrs.event.Event; import org.openmrs.event.EventMessage; import org.openmrs.module.idgen.IdentifierSource; @@ -716,7 +717,12 @@ private Patient createImportedMpiPatient(Patient mpiPatient) { mpiPatient.addIdentifier(localId); } - return patientService.savePatient(mpiPatient); + PatientSynchronizationAdvice.SUPPRESS.set(true); + try { + return patientService.savePatient(mpiPatient); + } finally { + PatientSynchronizationAdvice.SUPPRESS.set(false); + } } private boolean isBiometricEngineEnabled() { diff --git a/pom.xml b/pom.xml index a3b9fe32..36b65b06 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ 1.4 UTF-8 2.2.1 - 1.1.0 + 1.1.5-SNAPSHOT 4.4.9 4.5 2.2 From 28dca6708685481f387e55323637370b59c8952e Mon Sep 17 00:00:00 2001 From: mherman22 Date: Wed, 15 Apr 2026 07:27:50 +0000 Subject: [PATCH 2/4] Set mpi-client dependency to 1.1.8 release version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 36b65b06..9dc53659 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ 1.4 UTF-8 2.2.1 - 1.1.5-SNAPSHOT + 1.1.8 4.4.9 4.5 2.2 From e33e859d2a1ad6a78787ccd01905aac9dc9d0860 Mon Sep 17 00:00:00 2001 From: mherman22 Date: Wed, 15 Apr 2026 07:29:41 +0000 Subject: [PATCH 3/4] Modernize CI: upgrade to current action versions and remove deprecated cache v2 --- .github/workflows/ci.yml | 63 ++++++++++++---------------------------- 1 file changed, 18 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca491604..8cf7ec95 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,64 +1,37 @@ -# This is a basic workflow to help you get started with Actions +name: Build, Test & Publish -name: CI - -# Controls when the action will run. on: - # Triggers the workflow on push or pull request events but only for the master branch push: branches: [ main ] pull_request: branches: [ main ] release: types: [ created ] - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" build: - # The type of runner that the job will run on runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 8.0.232 - - name: Set up Maven - uses: stCarolas/setup-maven@v4 - with: - maven-version: 3.6.3 - - name: Cache Maven packages - uses: actions/cache@v2 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - uses: s4u/maven-settings-action@v2.2.0 + - name: Set up JDK 8 + uses: actions/setup-java@v5.2.0 with: - servers: | - [{ - "id": "github-packages", - "username": "${{ secrets.RELEASE_USERNAME }}", - "password": "${{ secrets.RELEASE_TOKEN }}" - }] - properties: | - [ - { "maven.wagon.http.ssl.insecure": "true" }, - { "maven.wagon.http.ssl.allowall": "true" }, - { "maven.wagon.http.ssl.ignore.validity.dates": "true"} - ] - githubServer: false - - name: Build with Maven - run: mvn -P 'github-packages' install + java-version: '8' + distribution: zulu + cache: maven + server-id: github-packages + server-username: RELEASE_USERNAME + server-password: RELEASE_TOKEN + + - name: Build and test + run: mvn -B -P github-packages install + - name: Publish package - run: mvn -P github-packages -DskipTests -Dfindbugs.skip=true -Dpmd.skip=true -Dcpd.skip=true -B deploy - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} if: github.event_name == 'release' && github.event.action == 'created' + run: mvn -B -P github-packages -DskipTests -Dfindbugs.skip=true -Dpmd.skip=true -Dcpd.skip=true deploy + env: + RELEASE_USERNAME: ${{ github.actor }} + RELEASE_TOKEN: ${{ secrets.PERSONAL_TOKEN }} From 9928b3f400d4844ec1756f8ec9a9d04358032ac4 Mon Sep 17 00:00:00 2001 From: mherman22 Date: Wed, 15 Apr 2026 07:33:02 +0000 Subject: [PATCH 4/4] Fix CI: set GitHub Packages credentials at job level for dependency resolution --- .github/workflows/ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cf7ec95..f9e4366e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,10 @@ jobs: build: runs-on: ubuntu-latest + env: + RELEASE_USERNAME: ${{ github.actor }} + RELEASE_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + steps: - uses: actions/checkout@v6 @@ -32,6 +36,3 @@ jobs: - name: Publish package if: github.event_name == 'release' && github.event.action == 'created' run: mvn -B -P github-packages -DskipTests -Dfindbugs.skip=true -Dpmd.skip=true -Dcpd.skip=true deploy - env: - RELEASE_USERNAME: ${{ github.actor }} - RELEASE_TOKEN: ${{ secrets.PERSONAL_TOKEN }}