Skip to content

Enhance OAuthBackendImpl with dynamic backend reference#3419

Merged
sfeilmeier merged 4 commits intoOpenEMS:developfrom
Sn0w3y:fix-oauth
Nov 30, 2025
Merged

Enhance OAuthBackendImpl with dynamic backend reference#3419
sfeilmeier merged 4 commits intoOpenEMS:developfrom
Sn0w3y:fix-oauth

Conversation

@Sn0w3y
Copy link
Copy Markdown
Collaborator

@Sn0w3y Sn0w3y commented Nov 16, 2025

  1. Made the backend reference optional - Added cardinality = ReferenceCardinality.OPTIONAL so the component can activate even when Controller.Api.Backend is not configured

  2. Added null safety checks - All three methods now check if backend is available before using it

  3. Added proper error handling - Returns a failed CompletableFuture with a descriptive error message when backend is unavailable

  4. Made the reference dynamic and volatile - Follows the same pattern as UserServiceImpl and AppCenterBackendUtilImpl

1. Made the backend reference optional - Added cardinality = ReferenceCardinality.OPTIONAL so the component can activate even when Controller.Api.Backend is not configured

2. Added null safety checks - All three methods now check if backend is available before using it

3. Added proper error handling - Returns a failed CompletableFuture with a descriptive error message when backend is unavailable

4. Made the reference dynamic and volatile - Follows the same pattern as UserServiceImpl and AppCenterBackendUtilImpl
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 16, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3419      +/-   ##
=============================================
- Coverage      59.62%   59.61%   -0.01%     
  Complexity       112      112              
=============================================
  Files           2894     2894              
  Lines         124658   124661       +3     
  Branches        9343     9344       +1     
=============================================
- Hits           74318    74307      -11     
- Misses         47522    47539      +17     
+ Partials        2818     2815       -3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sfeilmeier
Copy link
Copy Markdown
Contributor

@vision1727
Copy link
Copy Markdown

tested the changes of @Sn0w3y works now without this error "unsatisfied reference"

@michaelgrill
Copy link
Copy Markdown
Contributor

michaelgrill commented Nov 18, 2025

i would prefer a solution where we dont have to touch the OAuthBackendImpl class. IMO it just adds a lot of unnecessary code to it. (and future components like this)

Can we change the validation to only validate classes, which implement OpenemsComponent? Because in this case its only required if its used by TimeOfUseTariffLuoxImpl and in future i believe the log is only required if you have a OpenemsComponent using it.

OsgiValidateWorker now only validates components implementing OpenemsComponent. OAuthBackendImpl is refactored to remove dynamic backend reference handling and logger usage, simplifying method implementations and dependency injection.
@iseeberg79
Copy link
Copy Markdown
Contributor

could you update the PR information accordingly? Latest changes are quite different ;)

@sfeilmeier
Copy link
Copy Markdown
Contributor

I'll work on this to get rid of this issue for next release

@Sn0w3y
Copy link
Copy Markdown
Collaborator Author

Sn0w3y commented Nov 30, 2025

I'll work on this to get rid of this issue for next release

Shall i close this PR or would you work in this PR for it?

Copy link
Copy Markdown
Contributor

@sfeilmeier sfeilmeier left a comment

Choose a reason for hiding this comment

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

Thank you! 👍

@sfeilmeier sfeilmeier merged commit f4defe0 into OpenEMS:develop Nov 30, 2025
6 of 7 checks passed
@Sn0w3y Sn0w3y deleted the fix-oauth branch November 30, 2025 17:04
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.

5 participants