Fix immediate sends with pending link previews#6280
Open
bytware-alpha wants to merge 1 commit into
Open
Conversation
bcb4338 to
e138892
Compare
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.
Why
Sending a link should behave like sending any other message. The bubble should appear immediately; the preview can finish a beat later and still belong to that same bubble.
#4550 already ruled out the cheap fixes: blocking Send is bad UX, and sending the preview later is not what the user chose to send. So this does the actual thing: persist the outgoing row now, keep the preview attached to that send, and only hand the finalized payload to the sender.
This is better than the earlier durable-job shape because it does not teach the job queue about half-built sends. No runnable job exists until the message is final. Ordering is held with a small in-memory barrier, which is the sort of short-lived queueing pattern maintainers have accepted before in #4004 and #2529. Less machinery, cleaner contract.
How
Test Plan
xcodebuild test -workspace Signal.xcworkspace -scheme Signal -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5' -only-testing:SignalServiceKitTests/MessageSenderJobQueueTest/test_deferredJobBlocksLaterJobsUntilStarted -only-testing:SignalTests/ThreadUtilSignalUITest/testPendingLinkPreviewDoesNotBlockOutgoingRowPersistencexcodebuild test -workspace Signal.xcworkspace -scheme Signal -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5' -only-testing:SignalUITests/LinkPreviewFetchStateTest/testLinkPreviewDraftForSendingTaskSurvivesClearingCurrentTextPATH="/tmp/signal-swiftformat/SwiftFormat/.build/release:$PATH" Scripts/precommit.py --ref origin/maingit diff --check