Skip to content

Deliver payload types in order that they were received#3160

Merged
bidetofevil merged 6 commits intomainfrom
hho/ordered-payload-delivery
Mar 30, 2026
Merged

Deliver payload types in order that they were received#3160
bidetofevil merged 6 commits intomainfrom
hho/ordered-payload-delivery

Conversation

@bidetofevil
Copy link
Copy Markdown
Contributor

@bidetofevil bidetofevil commented Mar 20, 2026

Goal

Ensure payloads of a single type are delivered in order. This required some initial refactoring to simplify the streamline the threading and payload queuing model before this could work without problematic race conditions (that existed at least in the integration tests).

Major changes include:

  • Using a dedicated worker for the scheduling thread and consolidating the finding and queuing of the next payload delivery to that
    • This simplifies the "delivery loop" so we always bounce back to the scheduling thread for the payload finding/queuing, thus avoiding annoying race conditions and error scenarios.
  • Debouncing new delivery attempts from payload in takes and retries
  • Synchronize payload delete update with the actual deletion done by the PayloadStorageService, as the real implementation does the deletion async
  • Use blocking mode for executors in unit tests to better orchestrate and verify execution order

There's a bunch of renaming, code consolidation, and tracer updates as well.

Copy link
Copy Markdown
Contributor Author

bidetofevil commented Mar 20, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@bidetofevil bidetofevil changed the title Delivery payload types in order that they were received Deliver payload types in order that they were received Mar 20, 2026
@bidetofevil bidetofevil marked this pull request as ready for review March 20, 2026 15:00
@bidetofevil bidetofevil requested a review from a team as a code owner March 20, 2026 15:00
@bidetofevil bidetofevil requested review from fractalwrench and removed request for a team March 20, 2026 15:00
Copy link
Copy Markdown
Member

@fractalwrench fractalwrench left a comment

Choose a reason for hiding this comment

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

LGTM once CI is passing

@bidetofevil bidetofevil force-pushed the hho/ordered-payload-delivery branch from ed46827 to 764222c Compare March 20, 2026 17:27
@bidetofevil bidetofevil force-pushed the hho/block-on-resurrection branch from 22ee819 to 1a8956e Compare March 20, 2026 17:27
@bidetofevil bidetofevil force-pushed the hho/ordered-payload-delivery branch 3 times, most recently from bbd71dc to 87b8726 Compare March 21, 2026 00:48
@bidetofevil bidetofevil force-pushed the hho/block-on-resurrection branch from 6893d25 to 3f55ab0 Compare March 21, 2026 00:48
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 81.81818% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.00%. Comparing base (b637ff0) to head (a1b4b91).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...esdk/internal/delivery/debug/DeliveryTraceState.kt 21.73% 18 Missing ⚠️
...ernal/delivery/scheduling/SchedulingServiceImpl.kt 93.10% 1 Missing and 5 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3160      +/-   ##
==========================================
+ Coverage   77.89%   78.00%   +0.10%     
==========================================
  Files         558      558              
  Lines       11931    11973      +42     
  Branches     1782     1793      +11     
==========================================
+ Hits         9294     9339      +45     
+ Misses       1927     1924       -3     
  Partials      710      710              
Files with missing lines Coverage Δ
...mbracesdk/internal/injection/DeliveryModuleImpl.kt 91.56% <100.00%> (ø)
...bracesdk/internal/delivery/debug/DeliveryTracer.kt 87.50% <100.00%> (+1.13%) ⬆️
...brace/android/embracesdk/internal/worker/Worker.kt 100.00% <100.00%> (ø)
...ernal/delivery/scheduling/SchedulingServiceImpl.kt 93.37% <93.10%> (+3.50%) ⬆️
...esdk/internal/delivery/debug/DeliveryTraceState.kt 56.00% <21.73%> (+0.89%) ⬆️

... and 8 files with indirect coverage changes

🚀 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.

Copy link
Copy Markdown
Member

@fractalwrench fractalwrench left a comment

Choose a reason for hiding this comment

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

LGTM once CI is passing

Copy link
Copy Markdown
Contributor Author

bidetofevil commented Mar 30, 2026

Merge activity

  • Mar 30, 5:20 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 30, 5:22 PM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 30, 5:23 PM UTC: @bidetofevil merged this pull request with Graphite.

@bidetofevil bidetofevil changed the base branch from hho/block-on-resurrection to graphite-base/3160 March 30, 2026 17:20
@bidetofevil bidetofevil changed the base branch from graphite-base/3160 to main March 30, 2026 17:21
@bidetofevil bidetofevil force-pushed the hho/ordered-payload-delivery branch from 62d636c to a1b4b91 Compare March 30, 2026 17:22
@github-actions
Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA a1b4b91.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@bidetofevil bidetofevil merged commit c8b79bb into main Mar 30, 2026
10 checks passed
@bidetofevil bidetofevil deleted the hho/ordered-payload-delivery branch March 30, 2026 17:23
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.

2 participants