Skip to content

fix: allow reactivating legacy ASHA users with no facility mapped - #145

Merged
vishwab1 merged 1 commit into
release-3.8.1from
fix/asha-reactivation-facility-check
Aug 7, 2026
Merged

fix: allow reactivating legacy ASHA users with no facility mapped#145
vishwab1 merged 1 commit into
release-3.8.1from
fix/asha-reactivation-facility-check

Conversation

@snehar-nd

Copy link
Copy Markdown
Contributor

Reactivating a soft-deleted USR row was hitting "Facility (SC) is mandatory for ASHA role" for pre-existing ASHA users created before that rule existed, because the reactivation check re-fetched the row via findById() which returned the same JPA-managed instance already mutated by the caller (Open-Session-In-View shares one L1 cache per request), so the old-vs-new deleted comparison always failed.

saveRoleMappingeditedData now takes a wasDeleted flag captured by the caller before mutation, and waives only the facility-mandatory check on reactivation — facility soft-delete and SC-level checks still run whenever a facility is present, so a reactivated row can't silently resume pointing at a facility that went stale while inactive.

📋 Description

JIRA ID:

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

Reactivating a soft-deleted USR row was hitting "Facility (SC) is
mandatory for ASHA role" for pre-existing ASHA users created before
that rule existed, because the reactivation check re-fetched the row
via findById() which returned the same JPA-managed instance already
mutated by the caller (Open-Session-In-View shares one L1 cache per
request), so the old-vs-new deleted comparison always failed.

saveRoleMappingeditedData now takes a wasDeleted flag captured by the
caller before mutation, and waives only the facility-mandatory check
on reactivation — facility soft-delete and SC-level checks still run
whenever a facility is present, so a reactivated row can't silently
resume pointing at a facility that went stale while inactive.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b4817cea-64a4-4c65-bd1e-48f1fb742828

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
6.7% Duplication on New Code (required ≤ 3%)
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@vishwab1
vishwab1 merged commit 3f84fbb into release-3.8.1 Aug 7, 2026
3 of 4 checks passed
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.

2 participants