Skip to content

Conversation

@nas-tabchiche
Copy link
Collaborator

@nas-tabchiche nas-tabchiche commented Nov 28, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved automatic data synchronization for libraries: when a library is saved, associated requirement mappings and frameworks are now detected and loaded asynchronously so library metadata and related engine data remain up-to-date without blocking save operations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Walkthrough

A custom save() method was added to LoadedLibrary that persists the model, computes objects_meta, and conditionally schedules asynchronous engine.load_rms_data() and/or engine.load_frameworks() based on presence of requirement mapping sets or frameworks.

Changes

Cohort / File(s) Change Summary
LoadedLibrary model hook
backend/core/models.py
Added save(self, *args, **kwargs) to LoadedLibrary that calls super().save(), computes objects_meta, imports core.mappings.engine, and conditionally schedules engine.load_rms_data() when requirement mapping sets exist and engine.load_frameworks() when frameworks exist.

Sequence Diagram

sequenceDiagram
    participant Caller as Caller (save call)
    participant LoadedLibrary as LoadedLibrary.save()
    participant BaseSave as super().save()
    participant DB as Database
    participant Engine as core.mappings.engine
    participant Queue as Async Task Queue

    Caller->>LoadedLibrary: save(instance)
    LoadedLibrary->>BaseSave: call super().save()
    BaseSave->>DB: persist instance
    DB-->>BaseSave: persist OK
    BaseSave-->>LoadedLibrary: return

    LoadedLibrary->>LoadedLibrary: compute objects_meta

    alt requirement_mapping_sets present
        LoadedLibrary->>Engine: import engine
        Engine-->>LoadedLibrary: module ready
        LoadedLibrary->>Queue: schedule engine.load_rms_data()
        Queue-->>LoadedLibrary: queued
    end

    alt frameworks present
        LoadedLibrary->>Engine: import engine
        Engine-->>LoadedLibrary: module ready
        LoadedLibrary->>Queue: schedule engine.load_frameworks()
        Queue-->>LoadedLibrary: queued
    end

    LoadedLibrary-->>Caller: save complete
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Check correctness of import path core.mappings.engine.
  • Verify that scheduled functions (load_rms_data, load_frameworks) exist and behave safely when invoked asynchronously.
  • Confirm objects_meta, requirement_mapping_sets, and frameworks field names and expected shapes.

Possibly related PRs

Suggested reviewers

  • ab-smith

Poem

🐰 I saved a lib and gave a little hop,
Queued the engines—no need to stop.
RMS and frameworks wake from nap,
Tasks in line, a tidy map.
Hooray, the background work goes pop! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a custom save() method to LoadedLibrary that reloads mapping engine and frameworks cache, matching the primary functionality introduced in backend/core/models.py.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch CA-1401-reload-mapping-engine-requirement-mapping-set-cache-on-mapping-library-import

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf9c9b8 and 91093bf.

📒 Files selected for processing (1)
  • backend/core/models.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/core/models.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: build_enterprise_frontend
  • GitHub Check: build_community_frontend
  • GitHub Check: test (3.12)
  • GitHub Check: build (3.12)
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: Analyze (python)

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71819da and bf9c9b8.

📒 Files selected for processing (1)
  • backend/core/models.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
backend/core/models.py (1)
backend/core/mappings/engine.py (2)
  • load_rms_data (58-93)
  • load_frameworks (95-101)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: test (3.12)
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: build_community_frontend
  • GitHub Check: build_enterprise_frontend
  • GitHub Check: build (3.12)

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