Fix: Correct delivery workflow initialization on checkout - #274
Open
sentry[bot] wants to merge 1 commit into
Open
sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #274 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 16 16
Lines 883 879 -4
Branches 67 66 -1
=====================================
+ Misses 883 879 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
This PR addresses the
MainFragment$BackendAPIException: Failed to init delivery workflowerror.Root Cause:
The issue stemmed from two main problems in
MainFragment.java:processDeliveryItem()method was being called even when the checkout API request toflask.empower-plant.com/checkoutfailed (returned HTTP 500 or anIOException).processDeliveryItem()method itself contained a hardcodedthrow new BackendAPIException(...), meaning it would always throw an exception whenever it was invoked, regardless of the actual delivery workflow status.Solution:
processDeliveryItem()calls from checkout failure paths: TheonResponsecallback's!successbranch and theonFailurecallback no longer invokeprocessDeliveryItem(). Instead, they now correctly finish the Sentry transaction withSpanStatus.INTERNAL_ERROR.processDeliveryItem()to the success path:processDeliveryItem()is now only called within theonResponsecallback whenresponse.isSuccessful()is true, ensuring it's only triggered after a successful checkout.processDeliveryItem()logic: The hardcodedthrow new BackendAPIException(...)has been removed fromprocessDeliveryItem(). The method now correctly logs and sets the span status toOK, simulating a successful delivery workflow initialization.Fixes ANDROID-NQ
@sentry <feedback>: Autofix iterates on these changes@sentry stop iterating: Autofix stops iterating on this run