Skip to content

Conversation

@christiangoerdes
Copy link
Collaborator

@christiangoerdes christiangoerdes commented Jan 5, 2026

Yaml with Scope class:

 apiKey:
    stores:
      - keys:
          - secret:
              value: demokey
              scopes:
                - scope:
                    value: abc

Yaml with String replacement:

apiKey:
  stores:
    - keys:
        - secret:
            value: demokey
            scopes:
              - abc

Summary by CodeRabbit

  • Refactor
    • Simplified API key scope handling by streamlining internal scope storage and processing logic, improving performance and reducing complexity in scope management.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

📝 Walkthrough

Walkthrough

The pull request refactors the API key store's scope handling by removing the Scope wrapper class and replacing List<Scope> with List<String> throughout the codebase. This simplification directly stores scope strings in the key configuration and updates corresponding store logic and tests.

Changes

Cohort / File(s) Summary
Core scope type refactoring
core/src/main/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/Key.java, core/src/main/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/Scope.java
Changed scopes field type from List<Scope> to List<String>; updated getter and setter signatures. Removed the Scope class entirely, eliminating the intermediate wrapper object.
Store implementation update
core/src/main/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/SimpleKeyStore.java
Simplified scope set construction by directly materializing from the scopes list instead of mapping Scope objects to their string values.
Test updates
core/src/test/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/SimpleKeyStoreTest.java
Updated test to populate scopes using string literals ("admin", "user") via List.of instead of constructing Scope objects.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Scopes once wrapped in objects grand,
Now dance as strings, so light and free,
The Scope class fades across the land,
Simpler flows for all to see!
✨ Refactored with care, no wrapper in sight!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.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 clearly and concisely summarizes the primary change: removing the Scope.java class and replacing it with String types across the codebase.
✨ Finishing touches
  • 📝 Generate docstrings

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: 0

🧹 Nitpick comments (1)
core/src/main/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/Key.java (1)

34-34: JavaDoc could be more descriptive.

The updated description is functional but less informative than it could be. Consider adding a note about the expected format or purpose of the scopes (e.g., "List of scope identifiers that define access permissions for this key").

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2c1a58c and 9a55256.

📒 Files selected for processing (4)
  • core/src/main/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/Key.java
  • core/src/main/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/Scope.java
  • core/src/main/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/SimpleKeyStore.java
  • core/src/test/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/SimpleKeyStoreTest.java
💤 Files with no reviewable changes (1)
  • core/src/main/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/Scope.java
⏰ 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). (1)
  • GitHub Check: Analyze (java)
🔇 Additional comments (3)
core/src/test/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/SimpleKeyStoreTest.java (1)

35-35: LGTM! Clean migration to string-based scopes.

The test correctly uses string literals instead of Scope objects, matching the simplified API.

core/src/main/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/SimpleKeyStore.java (1)

48-48: LGTM! Cleaner implementation with direct HashSet construction.

The refactoring eliminates unnecessary stream mapping since scopes are now strings, making the code more straightforward.

core/src/main/java/com/predic8/membrane/core/interceptor/apikey/stores/inConfig/Key.java (1)

29-29: Migration from Scope to String is complete.

The verification confirms no remaining references to the removed Scope class from the apikey module. All identified Scope usages are from unrelated sources (OpenTelemetry library and other modules), confirming the breaking API change has been fully propagated across the codebase.

@membrane-ci-server
Copy link

This pull request needs "/ok-to-test" from an authorized committer.

@christiangoerdes
Copy link
Collaborator Author

/ok-to-test

@predic8 predic8 merged commit 3773a7d into master Jan 6, 2026
5 checks passed
@predic8 predic8 deleted the rm-scope branch January 6, 2026 07:42
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.

3 participants