feat(cloud-native): add feature to update config-api scopes sync from template by iromli · Pull Request #12909 · JanssenProject/jans (original) (raw)

📝 Walkthrough

Walkthrough

Performs an upsert of scopes.ldif via a dedicated scope_file and self.client.upsert_from_file(...), removes scopes.ldif from the batch LDIF create loop, and retains batch processing for the remaining LDIF files.

Changes

Cohort / File(s) Summary
Scope file handling docker-jans-config-api/scripts/bootstrap.py Adds scope_file pointing to /app/templates/jans-config-api/scopes.ldif, calls self.client.upsert_from_file(scope_file) with logging, removes scopes.ldif from the batch LDIF list so scopes are handled separately.
Batch LDIF processing docker-jans-config-api/scripts/bootstrap.py Keeps existing loop for remaining LDIF files (config.ldif, clients.ldif, scim-scopes.ldif, testing-clients.ldif) unchanged, ensuring they are created/processed in batch without scopes.ldif.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

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 (4 passed)

Check name Status Explanation
Title check ✅ Passed The title clearly describes the feature being added to update config-api scopes from templates, which aligns with the main change in the codebase.
Description check ✅ Passed The description follows the template structure with target issue, implementation details, and test documentation checklists. However, it lacks detailed implementation explanation.
Linked Issues check ✅ Passed The PR addresses the objective from issue #12908 by implementing scope upsert functionality to handle updates when templates change, enabling config-api to sync scope modifications.
Out of Scope Changes check ✅ Passed All changes in bootstrap.py are directly related to the objective of updating scopes from templates. The upsert logic and separate scope handling align with requirements.

✨ Finishing touches


📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2161c9f and 8a75129.

📒 Files selected for processing (1)

jans-pycloudlib/jans/pycloudlib/persistence/sql.py (1)

🪛 Ruff (0.14.10) docker-jans-config-api/scripts/bootstrap.py

413-413: Logging statement uses f-string

(G004)

⏰ 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)

docker-jans-config-api/scripts/bootstrap.py (2)

411-414: LGTM! The upsert approach correctly implements the PR objective.

The switch from create_from_ldif to upsert_from_file for scopes ensures that template changes are reflected in existing scope entries. The added comment clearly explains the rationale for separate handling.


416-416: LGTM! Correctly excludes scopes.ldif from batch processing.

Since scopes are now handled separately via upsert_from_file (line 414), removing scopes.ldif from the batch list is the correct approach.


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.