Skip to content

Signalwire media sync, include front/signalwire attachments#958

Merged
rgalanakis merged 16 commits intomainfrom
signalwire-attachments
May 20, 2025
Merged

Signalwire media sync, include front/signalwire attachments#958
rgalanakis merged 16 commits intomainfrom
signalwire-attachments

Conversation

@rgalanakis
Copy link
Contributor

@rgalanakis rgalanakis commented May 19, 2025

Add signalwire_media_v1 replicator.

Add attachment support to Front/Signalwire channel app. Attachments send via SMS are downloaded and attached to Front convos; attachments sent via Front are downloaded, temporarily stored in the database, and sent to Signalwire.

We were potentially zeroing out all data,
but then asking for one specific piece.
Instead, we need to be more deliberate, and recalculate
the entire state machine (after clearing out what is potentially
incorrect, which could be anything).

This fixes this bug across all files by removing
the http status-specific error messages,
and moving those messages to be handled explicitly
when calculating the state machine fails.
It's a child of the Signalwire Message replicator,
and uses that table to figure out what media needs to be synced.
@rgalanakis rgalanakis force-pushed the signalwire-attachments branch from 4c4ff8f to 508ca54 Compare May 19, 2025 23:45
@codecov
Copy link

codecov bot commented May 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.96%. Comparing base (185368f) to head (606bfb4).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #958      +/-   ##
==========================================
+ Coverage   96.90%   96.96%   +0.05%     
==========================================
  Files         480      483       +3     
  Lines       30369    30663     +294     
==========================================
+ Hits        29429    29732     +303     
+ Misses        940      931       -9     

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

It turns out, doing this with a media replicator isn't really feasible.
Instead, when syncing to Front, find the parent signalwire message,
and then download the attachments before syncing.

The issues were around race conditions (both message and media
need to sync in order to import), and storing media files:
at the point the replicator needs to download the media,
the additional 'get media list' is not any more complex.
The alternative would be storing the binary media,
but this doesn't seem necessary or desirable.
@rgalanakis rgalanakis force-pushed the signalwire-attachments branch from 508ca54 to d1f7a47 Compare May 20, 2025 05:26
@rgalanakis rgalanakis changed the title Signalwire attachments Signalwire media sync, include front/signalwire attachments May 20, 2025
@rgalanakis rgalanakis marked this pull request as ready for review May 20, 2025 18:31
@rgalanakis rgalanakis force-pushed the signalwire-attachments branch from 6dbf11e to 606bfb4 Compare May 20, 2025 20:24
@rgalanakis rgalanakis merged commit 234b5b7 into main May 20, 2025
4 checks passed
@rgalanakis rgalanakis deleted the signalwire-attachments branch May 20, 2025 21:14
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