admin-service: add else clause to BulkOperationsService#apply_operation (rubydre:S131) - #1553
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…on (rubydre:S131) Unknown operations now raise BulkOperationsService::UnknownOperationError instead of silently succeeding. Adds a spec covering the new branch. issue_key: AZ6OP-KgRoUIIbwnU9cf
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Remediates SonarCloud rubydre:S131 (
issue_key: AZ6OP-KgRoUIIbwnU9cf) inservices/admin-service/app/services/bulk_operations_service.rb: thecase operationinapply_operationhad noelse, so an operation string that slipped past theVALID_OPERATIONScheck inprocesswould fall through, do nothing to the user, and still be counted as a success.The raise is caught by the existing
rescue StandardErrorinexecute_operations, so an unknown operation now shows up as a per-user failure with an error message rather than a silent no-op success — matching the service's existing error-handling path. The error class follows the pattern already used in the service (Incident::InvalidTransitionError,AuditLogsController::InvalidDateError). Behaviour ofprocessfor valid and invalid operations is unchanged (processstill short-circuits withInvalid operation: ...before reachingapply_operation).Adds a spec that calls
execute_operationsdirectly with an unknown operation and asserts 0 successes / 3 failures / unchanged users; it fails onmain(expected: 0, got: 3) and passes with this change.Not touched: the planted bug in
config/environments/production.rb.Verification
cd services/admin-service && bundle exec rspec— 121 examples, 0 failures (Ruby 3.3.12, local Postgres).bundle exec rubocopwith the repo's.rubocop.ymlcurrently crashes on load (rubocop-rspec_rails 2.29.1vsrubocop 1.86.1plugin API mismatch) independent of this change; the changed files were checked against the equivalent core cops with the repo's limits (MethodLength: 25,LineLength: 120) and are clean.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/0d3a386e79fa4e33bba63c6d1e5299d7
Open in Devin Desktop: https://partner-workshops.devinenterprise.com/desktop/session/0d3a386e79fa4e33bba63c6d1e5299d7?variant=devin
Requested by: @mbatchelor81