Skip to content

Fix/cache org policy#1627

Merged
nevil-mathew merged 2 commits into
ELEVATE-Project:developfrom
borkarsaish65:fix/cache_org_policy
Apr 14, 2026
Merged

Fix/cache org policy#1627
nevil-mathew merged 2 commits into
ELEVATE-Project:developfrom
borkarsaish65:fix/cache_org_policy

Conversation

@borkarsaish65
Copy link
Copy Markdown
Contributor

@borkarsaish65 borkarsaish65 commented Apr 9, 2026

Release Notes

  • Use organization_id as the cache key when warming the organizations cache to ensure lookups match the warmup entry
  • Preserve visible_to_organizations in mentee profile responses by saving it before deleting and restoring it to the final response
  • Invalidate all per-tenant mentee and mentor profile caches after organization policy changes (setOrgPolicies)
  • Invalidate all per-tenant mentee and mentor profile caches after organization relationship updates (updateRelatedOrgs)
  • Improve organization-code extraction for cache invalidation using optional chaining (organizationDetails?.data?.result?.code) and only delete org cache when a valid code is present

Contributions by Author

Author Lines Added Lines Removed
borkarsaish65 20 4

@borkarsaish65
Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 40c72864-3f51-431d-8336-81c8a5b7808f

📥 Commits

Reviewing files that changed from the base of the PR and between fc39a6f and 9ca25a8.

📒 Files selected for processing (3)
  • src/services/admin.js
  • src/services/mentees.js
  • src/services/org-admin.js

Walkthrough

Updates change organization warmup cache key to use organization_id, preserve visible_to_organizations in mentee read responses, and add tenant-wide mentee/mentor profile cache invalidation (with error handling) when org policies or related-org links change.

Changes

Cohort / File(s) Summary
Organization Cache Key Update
src/services/admin.js
Warm-up now stores organizations in cache using orgData.organization_id as the cache key instead of orgCode.
Mentee Data Preservation
src/services/mentees.js
visible_to_organizations is captured to a local variable before deletion and then assigned to finalProfile.visible_to_organizations to preserve the value for responses.
Cache Invalidation & Org Code Extraction
src/services/org-admin.js
After policy or related-org updates, calls cacheHelper.mentee.deleteAll(tenantCode) and cacheHelper.mentor.deleteAll(tenantCode) inside try/catch with console.error logging; org-code lookup changed to organizationDetails?.data?.result?.code and cache deletion now conditional on truthy orgCode.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • nevil-mathew

Poem

🐰 I hopped the cache with nimble paws,
Swapped IDs and saved some laws,
I tucked a field before it flew,
Cleared crumbs of stale cache too,
Happy hops — a tidy cause! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Fix/cache org policy' clearly summarizes the main changes, which involve fixing cache-related issues in organization policy handling across multiple services.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@nevil-mathew nevil-mathew merged commit d14b869 into ELEVATE-Project:develop Apr 14, 2026
1 of 2 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