Skip to content

Fix: Correct delivery workflow initialization on checkout - #274

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/delivery-workflow-init-n5KbQt
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/delivery-workflow-init-n5KbQt

Conversation

@sentry

@sentry sentry Bot commented Sep 17, 2026

Copy link
Copy Markdown

This PR addresses the MainFragment$BackendAPIException: Failed to init delivery workflow error.

Root Cause:
The issue stemmed from two main problems in MainFragment.java:

  1. The processDeliveryItem() method was being called even when the checkout API request to flask.empower-plant.com/checkout failed (returned HTTP 500 or an IOException).
  2. The processDeliveryItem() method itself contained a hardcoded throw new BackendAPIException(...), meaning it would always throw an exception whenever it was invoked, regardless of the actual delivery workflow status.

Solution:

  1. Removed processDeliveryItem() calls from checkout failure paths: The onResponse callback's !success branch and the onFailure callback no longer invoke processDeliveryItem(). Instead, they now correctly finish the Sentry transaction with SpanStatus.INTERNAL_ERROR.
  2. Moved processDeliveryItem() to the success path: processDeliveryItem() is now only called within the onResponse callback when response.isSuccessful() is true, ensuring it's only triggered after a successful checkout.
  3. Fixed processDeliveryItem() logic: The hardcoded throw new BackendAPIException(...) has been removed from processDeliveryItem(). The method now correctly logs and sets the span status to OK, 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

Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
@sentry
sentry Bot requested a review from sdzhong as a code owner September 17, 2026 17:10
@sentry

sentry Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Author

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Android com.example.vu.android 24.12.26 (241226) release
Android com.example.vu.android 24.12.26 (241226) debug
Android com.example.vu.android 24.12.26 (241226) release

⚙️ android Build Distribution Settings

@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (21c77a4) to head (e2cae7a).

Files with missing lines Patch % Lines
.../example/vu/android/empowerplant/MainFragment.java 0.00% 6 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant