You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR addresses the technical debt in ApiResponseHelper#createUsageResponse(Usage) by modularizing the 530-line method.
Extracted the 500+ line switch/if-else block into a main dispatcher method populateUsageTypeSpecificDetails.
Created 18 individual private helper methods for each specific UsageType to improve maintainability and readability.
Introduced a UsageResourceDetails container class to safely manage and return resourceId and resourceType state for tag lookups.
Verified zero business logic changes; strictly structural refactoring.
Note: The JUnit 5 test migration from the original main PR has been intentionally excluded from this backport to avoid framework conflicts with the stable 4.22 LTS testing architecture.
Types of changes
Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change which adds functionality)
Bug fix (non-breaking change which fixes an issue)
Enhancement (improves an existing feature and functionality)
Cleanup (Code refactoring and cleanup, that may add test cases)
Build/CI
Test (unit or integration test code)
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Major
Minor
Bug Severity
BLOCKER
Critical
Major
Minor
Trivial
Screenshots (if appropriate):
N/A (Pure backend refactoring)
How Has This Been Tested?
Verified structural integrity locally.
Fixed .toString() type mismatch in usage entity lookups to ensure Simulator CI passes cleanly on the LTS branch.
How did you try to break this feature and the system with this change?
This is a pure structural refactor. Carefully verified that no business logic, string formatting, or calculations were altered.
❌ Patch coverage is 1.88235% with 417 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.69%. Comparing base (0339f31) to head (ffa7089).
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.
Hey @DaanHoogland, checked the Build log, no actual BUILD FAILURE anywhere, every module shows 0 errors/failures. It never even reached the server module where ApiResponseHelper lives, still stuck around module 119/158 in unrelated plugins when it got cut off around 17m. Looks like it just hit a timeout and got cancelled mid run, not a real failure. Don't have re-run rights on my end, could you kick it off again?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: This is the 4.22 LTS backport of PR #13490 as requested by @DaanHoogland.
Fixes #11635
Description
This PR addresses the technical debt in
ApiResponseHelper#createUsageResponse(Usage)by modularizing the 530-line method.populateUsageTypeSpecificDetails.UsageTypeto improve maintainability and readability.UsageResourceDetailscontainer class to safely manage and returnresourceIdandresourceTypestate for tag lookups.mainPR has been intentionally excluded from this backport to avoid framework conflicts with the stable 4.22 LTS testing architecture.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
N/A (Pure backend refactoring)
How Has This Been Tested?
.toString()type mismatch in usage entity lookups to ensureSimulator CIpasses cleanly on the LTS branch.How did you try to break this feature and the system with this change?
This is a pure structural refactor. Carefully verified that no business logic, string formatting, or calculations were altered.